@happyvertical/smrt-chat 0.57.6 → 0.57.8

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 (29) hide show
  1. package/AGENTS.md +2 -0
  2. package/agents/assistant-questions.md +39 -0
  3. package/dist/chunks/{chat-stream-B1qPPm8j.js → chat-stream-QjWaKuCs.js} +2 -2
  4. package/dist/chunks/{chat-stream-B1qPPm8j.js.map → chat-stream-QjWaKuCs.js.map} +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/manifest.json +1 -1
  7. package/dist/smrt-knowledge.json +11 -5
  8. package/dist/svelte/components/assistant/AssistantDock.svelte +84 -20
  9. package/dist/svelte/components/assistant/AssistantDock.svelte.d.ts.map +1 -1
  10. package/dist/svelte/components/assistant/AssistantQuestionForm.svelte +245 -0
  11. package/dist/svelte/components/assistant/AssistantQuestionForm.svelte.d.ts +17 -0
  12. package/dist/svelte/components/assistant/AssistantQuestionForm.svelte.d.ts.map +1 -0
  13. package/dist/svelte/components/assistant/assistant-question.d.ts +88 -0
  14. package/dist/svelte/components/assistant/assistant-question.d.ts.map +1 -0
  15. package/dist/svelte/components/assistant/assistant-question.js +222 -0
  16. package/dist/svelte/components/assistant/assistant-transport.d.ts +7 -1
  17. package/dist/svelte/components/assistant/assistant-transport.d.ts.map +1 -1
  18. package/dist/svelte/components/assistant/assistant-transport.js +0 -9
  19. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.d.ts +9 -0
  20. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.d.ts.map +1 -1
  21. package/dist/svelte/components/assistant/create-assistant-dock-controller.svelte.js +46 -0
  22. package/dist/svelte/i18n.d.ts +2 -0
  23. package/dist/svelte/i18n.d.ts.map +1 -1
  24. package/dist/svelte/i18n.js +3 -0
  25. package/dist/svelte/index.d.ts +2 -0
  26. package/dist/svelte/index.d.ts.map +1 -1
  27. package/dist/svelte/index.js +2 -0
  28. package/dist/sveltekit.js +1 -1
  29. package/package.json +17 -17
package/AGENTS.md CHANGED
@@ -208,6 +208,8 @@ the config `ai` block. Pass `runtime`: a turn never keeps the RLS request tx
208
208
  (`clientRequestMessageId`): the PK is the retry reservation. See
209
209
  [docs](../../docs/assistant-dock.md).
210
210
 
211
+ Structured questions and page requests (#4100): [agents/assistant-questions.md](agents/assistant-questions.md).
212
+
211
213
  ## Recipes (#3719)
212
214
 
213
215
  `src/recipes.ts` declares `chat.assistant` (the AssistantDock as a `header.end`
@@ -0,0 +1,39 @@
1
+ # Structured assistant questions (#4100)
2
+
3
+ Part of the [smrt-chat guidance](../AGENTS.md).
4
+
5
+ An assistant turn that asks the person to choose is data, not prose. A
6
+ transport attaches an `{ kind: 'assistant-question', id, prompt, fields }`
7
+ object to an assistant message's `toolCallData` (alone or in an array). Fields
8
+ are choice fields: `options` (`value`, `label`, `hint?`, `keywords?`),
9
+ `multiple?`, `default?`, `required?`. `assistant-question.ts` validates it
10
+ (`parseAssistantQuestion`, `assistantQuestionFromMessage`), seeds defaults,
11
+ validates answers and describes them in one line.
12
+
13
+ The dock renders structured cards (a question, a tool result component, a
14
+ host's `toolCall` content) under the message's text bubble at the full thread
15
+ width; plain text stays in bubbles. `AssistantDock` renders it as `AssistantQuestionForm`: one fieldset whose
16
+ legend is the prompt; a single choice is a smrt-ui radio group (a select past
17
+ six options), several choices are checkboxes; the default is preselected and
18
+ focus moves into the newest form. Once answered it is a read-only summary.
19
+
20
+ Submitting calls the optional `AssistantTransport.answerQuestion({ threadId,
21
+ messageId, questionId, values, clientRequestId })`, so the transport continues
22
+ the turn in code with no model round-trip, and the dock merges its result like
23
+ a send. A transport without it gets the answer as an ordinary message
24
+ (`describeAssistantQuestionAnswer`, "Group by: Status"). A typed reply still
25
+ works: `matchAssistantQuestionText` resolves free text against the options
26
+ (shared words with label, value, hint and keywords; earlier option on a tie).
27
+
28
+ Options always come from code that knows the domain (a report source's
29
+ dimensions, for example), never from a model's free text. The planner's
30
+ runtime-report follow-ups are the first user.
31
+
32
+ ## Page requests
33
+
34
+ `AssistantDock` takes smrt-ui's `requestAssistant(element, { prompt })` (the bubbling,
35
+ cancelable `smrt-assistant-request` event), as a "New report" button sends: it fills the
36
+ composer with the prompt and focuses it, never sends it, and marks the event taken
37
+ (`preventDefault`), so the requester knows an assistant heard it. A request another listener
38
+ already took is left alone. smrt-svelte's `AdminShell` opens a closed dock first and
39
+ re-dispatches the request from inside it, because a dock's content mounts only when open.