@noodleseed/assistant 1.2.0 → 1.4.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 (40) hide show
  1. package/README.md +136 -20
  2. package/dist/{appearance-KDbtkt2G.d.cts → appearance-BLO7kFYB.d.cts} +39 -0
  3. package/dist/{appearance-KDbtkt2G.d.ts → appearance-BLO7kFYB.d.ts} +39 -0
  4. package/dist/chunk-JIL4B5HD.js +7639 -0
  5. package/dist/chunk-JIL4B5HD.js.map +1 -0
  6. package/dist/chunk-NSBPE2FW.js +17 -0
  7. package/dist/chunk-NSBPE2FW.js.map +1 -0
  8. package/dist/{chunk-WUDHE5BD.js → chunk-P34VLBIK.js} +76 -4
  9. package/dist/chunk-P34VLBIK.js.map +1 -0
  10. package/dist/chunk-UXPKSCID.js +14767 -0
  11. package/dist/chunk-UXPKSCID.js.map +1 -0
  12. package/dist/{client-DkAfqcSb.d.ts → client-1uaN8-yl.d.cts} +17 -5
  13. package/dist/{client-CwvdK4O6.d.cts → client-nW-Zf4bU.d.ts} +17 -5
  14. package/dist/client.cjs +75 -3
  15. package/dist/client.cjs.map +1 -1
  16. package/dist/client.d.cts +2 -2
  17. package/dist/client.d.ts +2 -2
  18. package/dist/client.js +2 -1
  19. package/dist/index.cjs +22912 -1163
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +6 -3
  22. package/dist/index.d.ts +6 -3
  23. package/dist/index.js +4 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/react.cjs +22948 -1177
  26. package/dist/react.cjs.map +1 -1
  27. package/dist/react.d.cts +9 -5
  28. package/dist/react.d.ts +9 -5
  29. package/dist/react.js +33 -9
  30. package/dist/react.js.map +1 -1
  31. package/dist/server.d.cts +1 -1
  32. package/dist/server.d.ts +1 -1
  33. package/dist/server.js +2 -0
  34. package/dist/server.js.map +1 -1
  35. package/dist/v4-2UXPDMWJ.js +485 -0
  36. package/dist/v4-2UXPDMWJ.js.map +1 -0
  37. package/package.json +6 -1
  38. package/dist/chunk-J2YDKISA.js +0 -1113
  39. package/dist/chunk-J2YDKISA.js.map +0 -1
  40. package/dist/chunk-WUDHE5BD.js.map +0 -1
package/README.md CHANGED
@@ -15,10 +15,10 @@ assistant session.
15
15
 
16
16
  The model configuration and SaaS integration credentials have different owners:
17
17
 
18
- | Owner | Configuration | Destination |
19
- | --- | --- | --- |
20
- | Noodle deployment | `ASSISTANT_MODEL_BASE_URL`, `ASSISTANT_MODEL`, `ASSISTANT_MODEL_API_KEY` | Managed with `noodle variables set` / `noodle secrets set` |
21
- | Customer backend | `NOODLE_SERVICE_URL`, `NOODLE_ASSISTANT_CLIENT_ID`, `NOODLE_ASSISTANT_CLIENT_SECRET` | Backend environment or secret manager only |
18
+ | Owner | Configuration | Destination |
19
+ | ----------------- | ------------------------------------------------------------------------------------ | ---------------------------------------------------------- |
20
+ | Noodle deployment | `ASSISTANT_MODEL_BASE_URL`, `ASSISTANT_MODEL`, `ASSISTANT_MODEL_API_KEY` | Managed with `noodle variables set` / `noodle secrets set` |
21
+ | Customer backend | `NOODLE_SERVICE_URL`, `NOODLE_ASSISTANT_CLIENT_ID`, `NOODLE_ASSISTANT_CLIENT_SECRET` | Backend environment or secret manager only |
22
22
 
23
23
  `allowedOrigins` accepts exact origins. Production origins must be HTTPS; plain HTTP is accepted only for
24
24
  loopback development origins such as `http://localhost:3000`. Local MCP authoring remains available without
@@ -41,6 +41,109 @@ example:
41
41
  npm install @noodleseed/assistant
42
42
  ```
43
43
 
44
+ ### Author `server.ts`
45
+
46
+ Put customer identity and colors in the server's top-level `branding` option. Put only assistant-specific
47
+ structure and treatment in `embeddedAssistant({ presentation })`:
48
+
49
+ ```ts
50
+ import {
51
+ embeddedAssistant,
52
+ openAICompatible,
53
+ secret,
54
+ server,
55
+ tool,
56
+ variable,
57
+ z,
58
+ } from "@noodleseed/one";
59
+
60
+ export default server(
61
+ "acme_support",
62
+ {
63
+ title: "Acme Support",
64
+ version: "1.0.0",
65
+ branding: {
66
+ name: "Acme Assistant",
67
+ accent: "#5B4CF0",
68
+ surface: "#FFFFFF",
69
+ surfaceDark: "#15131A",
70
+ mark: { uri: "https://assets.acme.example/mark.svg", alt: "Acme" },
71
+ colorScheme: "auto",
72
+ },
73
+ assistant: embeddedAssistant({
74
+ model: openAICompatible({
75
+ baseUrl: variable("ASSISTANT_MODEL_BASE_URL"),
76
+ model: variable("ASSISTANT_MODEL"),
77
+ apiKey: secret("ASSISTANT_MODEL_API_KEY"),
78
+ }),
79
+ allowedOrigins: ["http://localhost:3000", "https://app.acme.example"],
80
+ layout: {
81
+ mode: "floating",
82
+ position: "bottom-right",
83
+ panelWidth: 520,
84
+ panelMinHeight: 540,
85
+ panelMaxHeight: 740,
86
+ edgeOffset: 24,
87
+ },
88
+ behavior: { showTimestamps: true },
89
+ labels: {
90
+ welcomeHeading: "How can Acme help?",
91
+ welcomeMessage: "Fast answers from the tools your team already uses.",
92
+ composerPlaceholder: "Message Acme Support…",
93
+ sessionReady: "Acme support is online",
94
+ },
95
+ presentation: {
96
+ panel: {
97
+ surface: "solid",
98
+ elevation: "dramatic",
99
+ border: "strong",
100
+ radius: 20,
101
+ },
102
+ launcher: {
103
+ icon: "chat",
104
+ size: "lg",
105
+ status: "session",
106
+ effect: "pulse",
107
+ },
108
+ header: {
109
+ mark: "status",
110
+ badge: { text: "Support online", tone: "success", indicator: true },
111
+ },
112
+ composer: {
113
+ leadingIcon: "brand-mark",
114
+ sendIcon: "paper-plane",
115
+ shape: "rounded",
116
+ },
117
+ messages: { userStyle: "accent", assistantStyle: "bubble" },
118
+ },
119
+ }),
120
+ },
121
+ [
122
+ tool("status", {
123
+ description: "Read the support service status.",
124
+ input: z.object({}),
125
+ output: z.object({ status: z.string() }),
126
+ fulfil: () => ({ status: "operational" }),
127
+ }),
128
+ ],
129
+ );
130
+ ```
131
+
132
+ `presentation` is a closed set of semantic primitives for the panel, launcher, header, composer, and
133
+ messages. The Atlas-style product treatment above is the maximum supported customization level: it can
134
+ change geometry, status decoration, controls, and message treatment without replacing the assistant's
135
+ structure. It has no raw HTML, CSS, inline SVG, class-name, or callback field;
136
+ markup-looking text stays text. `presentation.panel.radius` is a bounded panel-specific geometry override,
137
+ not a second color or identity source. An HTTPS or packaged SVG referenced by `branding.logo`, `branding.mark`, or
138
+ `branding.avatar` is a bounded asset, not inline renderer markup.
139
+
140
+ If `presentation` is omitted, the complete Halo baseline remains: glass panel, soft elevation, subtle
141
+ border/motion, medium brand-mark launcher without status or effect, undecorated header, pill composer with
142
+ no leading icon and an arrow-up send icon, and bubble user/plain assistant messages at comfortable width.
143
+ Partial objects merge with those defaults.
144
+
145
+ ### Configure and deploy
146
+
44
147
  Configure the model through Noodle managed config, validate, and deploy the assistant-enabled server before
45
148
  creating the embed client:
46
149
 
@@ -63,7 +166,7 @@ Move those values to the customer backend's secret manager without printing or c
63
166
  route can exchange the current signed-in user like this:
64
167
 
65
168
  ```ts
66
- import { createAssistantSession } from '@noodleseed/assistant/server';
169
+ import { createAssistantSession } from "@noodleseed/assistant/server";
67
170
 
68
171
  export async function POST(request: Request) {
69
172
  const user = await requireCurrentUser(request);
@@ -84,17 +187,20 @@ export async function POST(request: Request) {
84
187
  Then add the framework-neutral element:
85
188
 
86
189
  ```ts
87
- import '@noodleseed/assistant';
190
+ import "@noodleseed/assistant";
88
191
  ```
89
192
 
90
193
  ```html
91
- <noodle-assistant session-endpoint="/api/assistant/session" theme="auto"></noodle-assistant>
194
+ <noodle-assistant
195
+ session-endpoint="/api/assistant/session"
196
+ theme="auto"
197
+ ></noodle-assistant>
92
198
  ```
93
199
 
94
200
  Or use React:
95
201
 
96
202
  ```tsx
97
- import { NoodleAssistant } from '@noodleseed/assistant/react';
203
+ import { NoodleAssistant } from "@noodleseed/assistant/react";
98
204
 
99
205
  <NoodleAssistant sessionEndpoint="/api/assistant/session" theme="auto" />;
100
206
  ```
@@ -103,10 +209,10 @@ For a customer-owned renderer, subscribe to the same turn and interaction stream
103
209
  custom element or touching browser storage:
104
210
 
105
211
  ```ts
106
- import { createAssistantClient } from '@noodleseed/assistant/client';
212
+ import { createAssistantClient } from "@noodleseed/assistant/client";
107
213
 
108
214
  const assistant = createAssistantClient({
109
- sessionEndpoint: '/api/assistant/session',
215
+ sessionEndpoint: "/api/assistant/session",
110
216
  clientContext: () => ({
111
217
  locale: navigator.language,
112
218
  timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -114,18 +220,18 @@ const assistant = createAssistantClient({
114
220
  });
115
221
 
116
222
  assistant.updateModelContext({
117
- content: [{ type: 'text', text: 'The time-off form is mounted.' }],
118
- structuredContent: { widget: { name: 'time-off', lifecycle: 'mounted' } },
223
+ content: [{ type: "text", text: "The time-off form is mounted." }],
224
+ structuredContent: { widget: { name: "time-off", lifecycle: "mounted" } },
119
225
  });
120
226
 
121
227
  const unsubscribe = assistant.subscribe((event) => {
122
228
  renderAssistantEvent(event);
123
- if (event.event === 'view_available') {
229
+ if (event.event === "view_available") {
124
230
  renderRegisteredView(event.data.resourceUri, event.data.result);
125
231
  }
126
232
  });
127
- await assistant.sendMessage('Book next Thursday and Friday off');
128
- await assistant.respond('interaction_123', { action: 'accept' });
233
+ await assistant.sendMessage("Book next Thursday and Friday off");
234
+ await assistant.respond("interaction_123", { action: "accept" });
129
235
  // Resolve one interaction once; alternatives are { action: 'decline' } or { action: 'cancel' }.
130
236
 
131
237
  unsubscribe();
@@ -173,7 +279,7 @@ fetch the `ui://` URI or inject its resource HTML into your page. The standard e
173
279
  but forwards the same detail as a DOM event:
174
280
 
175
281
  ```ts
176
- element.addEventListener('assistant-view-available', (event) => {
282
+ element.addEventListener("assistant-view-available", (event) => {
177
283
  renderRegisteredView(event.detail.resourceUri, event.detail.result);
178
284
  });
179
285
  ```
@@ -186,15 +292,18 @@ replay across sessions. React applications may observe recovery and structured f
186
292
  <NoodleAssistant
187
293
  sessionEndpoint="/api/assistant/session"
188
294
  onSessionExpired={() => reportAssistantRecovery()}
189
- onError={({ code, status, retryable }) => reportAssistantError({ code, status, retryable })}
190
- />;
295
+ onError={({ code, status, retryable }) =>
296
+ reportAssistantError({ code, status, retryable })
297
+ }
298
+ />
191
299
  ```
192
300
 
193
301
  `createAssistantSession` returns the opaque token, expiry, resolved non-secret configuration, and explicit
194
302
  turn/interaction endpoint URLs. Forward that response unchanged to the component or headless client.
195
303
 
196
- The MCP server's top-level `branding` block provides the shared identity and theme for widgets and the
197
- assistant. Set semantic CSS variables only for application-level integration overrides:
304
+ The MCP server's top-level `branding` block is the sole deployment source for identity and colors shared by
305
+ widgets and the assistant. Set public semantic CSS variables only for application-level integration
306
+ overrides:
198
307
 
199
308
  ```css
200
309
  noodle-assistant {
@@ -204,6 +313,13 @@ noodle-assistant {
204
313
  }
205
314
  ```
206
315
 
316
+ For each matching region or token, precedence is host-provided slot content or a public CSS custom property,
317
+ then compiled server `presentation`/`branding`, then Halo defaults. The public slots are `launcher-icon`,
318
+ `header-leading`, `header-actions`, `empty-state`, `composer-leading`, `composer-trailing`, and
319
+ `conversation-footer`; slotted host DOM replaces the renderer fallback for that region. Slots are a trusted
320
+ embedding-page integration API, not a way to put HTML or callbacks in deployment configuration. Internal
321
+ shadow-DOM selectors and classes are not public API.
322
+
207
323
  Server branding controls customer name, themed logo/mark/avatar assets, semantic light/dark colors, density,
208
324
  radius, typography, and automatic theme. `embeddedAssistant(...)` controls floating/inline/drawer layout,
209
325
  position and dimensions, mobile and launcher/header/avatar/timestamp behavior, visible labels, suggested
@@ -1,6 +1,38 @@
1
1
  type AssistantThemeMode = 'auto' | 'light' | 'dark';
2
2
  type AssistantLayoutMode = 'floating' | 'inline' | 'drawer';
3
3
  type AssistantPosition = 'bottom-left' | 'bottom-right';
4
+ type AssistantPresentationTone = 'neutral' | 'success' | 'warning' | 'danger';
5
+ interface AssistantPresentationConfiguration {
6
+ readonly panel?: {
7
+ readonly surface?: 'solid' | 'glass';
8
+ readonly elevation?: 'soft' | 'dramatic';
9
+ readonly border?: 'subtle' | 'strong';
10
+ readonly radius?: number;
11
+ };
12
+ readonly launcher?: {
13
+ readonly icon?: 'brand-mark' | 'chat' | 'none';
14
+ readonly size?: 'md' | 'lg';
15
+ readonly status?: 'none' | 'session';
16
+ readonly effect?: 'none' | 'pulse';
17
+ };
18
+ readonly header?: {
19
+ readonly mark?: 'none' | 'brand-mark' | 'status';
20
+ readonly badge?: {
21
+ readonly text: string;
22
+ readonly tone?: AssistantPresentationTone;
23
+ readonly indicator?: boolean;
24
+ };
25
+ };
26
+ readonly composer?: {
27
+ readonly leadingIcon?: 'none' | 'brand-mark';
28
+ readonly sendIcon?: 'arrow-up' | 'paper-plane';
29
+ readonly shape?: 'rounded' | 'pill';
30
+ };
31
+ readonly messages?: {
32
+ readonly userStyle?: 'bubble' | 'accent';
33
+ readonly assistantStyle?: 'plain' | 'bubble';
34
+ };
35
+ }
4
36
  interface AssistantConfiguration {
5
37
  readonly branding?: {
6
38
  readonly name?: string;
@@ -50,6 +82,7 @@ interface AssistantUiConfiguration {
50
82
  readonly panelWidth?: number;
51
83
  readonly panelMinHeight?: number;
52
84
  readonly panelMaxHeight?: number;
85
+ readonly edgeOffset?: number;
53
86
  readonly zIndex?: number;
54
87
  readonly density?: 'compact' | 'comfortable';
55
88
  readonly mobileFullscreen?: boolean;
@@ -64,6 +97,7 @@ interface AssistantUiConfiguration {
64
97
  readonly showTimestamps?: boolean;
65
98
  };
66
99
  readonly labels?: Partial<AssistantLabels>;
100
+ readonly presentation?: AssistantPresentationConfiguration;
67
101
  readonly suggestedPrompts?: readonly string[];
68
102
  readonly privacyUrl?: string;
69
103
  readonly termsUrl?: string;
@@ -74,6 +108,7 @@ interface AssistantLabels {
74
108
  readonly welcomeHeading: string;
75
109
  readonly welcomeMessage: string;
76
110
  readonly composerPlaceholder: string;
111
+ readonly thinking: string;
77
112
  readonly send: string;
78
113
  readonly stop: string;
79
114
  readonly close: string;
@@ -83,6 +118,10 @@ interface AssistantLabels {
83
118
  readonly retry: string;
84
119
  readonly unavailable: string;
85
120
  readonly sessionExpired: string;
121
+ readonly sessionIdle: string;
122
+ readonly sessionLoading: string;
123
+ readonly sessionReady: string;
124
+ readonly sessionError: string;
86
125
  }
87
126
 
88
127
  export type { AssistantThemeMode as A, AssistantConfiguration as a };
@@ -1,6 +1,38 @@
1
1
  type AssistantThemeMode = 'auto' | 'light' | 'dark';
2
2
  type AssistantLayoutMode = 'floating' | 'inline' | 'drawer';
3
3
  type AssistantPosition = 'bottom-left' | 'bottom-right';
4
+ type AssistantPresentationTone = 'neutral' | 'success' | 'warning' | 'danger';
5
+ interface AssistantPresentationConfiguration {
6
+ readonly panel?: {
7
+ readonly surface?: 'solid' | 'glass';
8
+ readonly elevation?: 'soft' | 'dramatic';
9
+ readonly border?: 'subtle' | 'strong';
10
+ readonly radius?: number;
11
+ };
12
+ readonly launcher?: {
13
+ readonly icon?: 'brand-mark' | 'chat' | 'none';
14
+ readonly size?: 'md' | 'lg';
15
+ readonly status?: 'none' | 'session';
16
+ readonly effect?: 'none' | 'pulse';
17
+ };
18
+ readonly header?: {
19
+ readonly mark?: 'none' | 'brand-mark' | 'status';
20
+ readonly badge?: {
21
+ readonly text: string;
22
+ readonly tone?: AssistantPresentationTone;
23
+ readonly indicator?: boolean;
24
+ };
25
+ };
26
+ readonly composer?: {
27
+ readonly leadingIcon?: 'none' | 'brand-mark';
28
+ readonly sendIcon?: 'arrow-up' | 'paper-plane';
29
+ readonly shape?: 'rounded' | 'pill';
30
+ };
31
+ readonly messages?: {
32
+ readonly userStyle?: 'bubble' | 'accent';
33
+ readonly assistantStyle?: 'plain' | 'bubble';
34
+ };
35
+ }
4
36
  interface AssistantConfiguration {
5
37
  readonly branding?: {
6
38
  readonly name?: string;
@@ -50,6 +82,7 @@ interface AssistantUiConfiguration {
50
82
  readonly panelWidth?: number;
51
83
  readonly panelMinHeight?: number;
52
84
  readonly panelMaxHeight?: number;
85
+ readonly edgeOffset?: number;
53
86
  readonly zIndex?: number;
54
87
  readonly density?: 'compact' | 'comfortable';
55
88
  readonly mobileFullscreen?: boolean;
@@ -64,6 +97,7 @@ interface AssistantUiConfiguration {
64
97
  readonly showTimestamps?: boolean;
65
98
  };
66
99
  readonly labels?: Partial<AssistantLabels>;
100
+ readonly presentation?: AssistantPresentationConfiguration;
67
101
  readonly suggestedPrompts?: readonly string[];
68
102
  readonly privacyUrl?: string;
69
103
  readonly termsUrl?: string;
@@ -74,6 +108,7 @@ interface AssistantLabels {
74
108
  readonly welcomeHeading: string;
75
109
  readonly welcomeMessage: string;
76
110
  readonly composerPlaceholder: string;
111
+ readonly thinking: string;
77
112
  readonly send: string;
78
113
  readonly stop: string;
79
114
  readonly close: string;
@@ -83,6 +118,10 @@ interface AssistantLabels {
83
118
  readonly retry: string;
84
119
  readonly unavailable: string;
85
120
  readonly sessionExpired: string;
121
+ readonly sessionIdle: string;
122
+ readonly sessionLoading: string;
123
+ readonly sessionReady: string;
124
+ readonly sessionError: string;
86
125
  }
87
126
 
88
127
  export type { AssistantThemeMode as A, AssistantConfiguration as a };