@docyrus/ui-pro-ai-assistant 0.8.0 → 0.8.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/README.md CHANGED
@@ -10,6 +10,7 @@ A full-featured, drop-in AI assistant chat UI for React. Ships with multi-turn c
10
10
  - **Multi-model & multi-agent** — Let users switch between AI models and agent deployments on the fly. Agent avatars display in the header and message list.
11
11
  - **Deep research** — Extended research mode with live progress streaming.
12
12
  - **AI memories** — Persistent memory management across sessions.
13
+ - **Agent consent gate** — Agents requiring consent show a non-closable terms dialog and block the prompt input until a `super_admin` approves.
13
14
  - **Edit & resend prompts** — Hover any user message to edit it; subsequent assistant replies are archived server-side and the conversation regenerates from that point.
14
15
  - **Voice input** — Browser-native speech-to-text.
15
16
  - **File uploads** — Attach files to messages with configurable format restrictions.
@@ -221,11 +222,14 @@ interface AssistantUser {
221
222
  firstname?: string;
222
223
  lastname?: string;
223
224
  photo?: string; // optional — avatar in chat messages
225
+ roles?: string[]; // optional — tenant roles; `'super_admin'` may approve an agent's consent terms
224
226
  }
225
227
  ```
226
228
 
227
229
  > **Note:** `user.id` must be the authenticated user's UUID as stored in Docyrus. Without it, the session list will not be filtered and all tenant users' threads will be visible.
228
230
 
231
+ > **Agent consent:** When an agent requires consent (`agent.consent` is `false`/`null`), the assistant shows a non-closable "Terms & Agreement" gate and hides the prompt input until the terms are accepted. Only users whose `roles` include `'super_admin'` can approve; everyone else sees the terms with the Approve button disabled.
232
+
229
233
  ---
230
234
 
231
235
  ### `<DocyAssistant>`
@@ -0,0 +1,22 @@
1
+ export interface PendingConsent {
2
+ agentId: string;
3
+ deploymentId?: string;
4
+ }
5
+ interface AgentConsentDialogProps {
6
+ /** Pending consent for the active agent, or `null` when none is required. */
7
+ pending: PendingConsent | null;
8
+ /** Called after the terms are approved (consent satisfied). */
9
+ onApproved: () => void;
10
+ /** Called when the user declines — should close the assistant. */
11
+ onDeclined: () => void;
12
+ t: (key: string) => string;
13
+ }
14
+ /**
15
+ * Gates the assistant behind an agent's "Terms & Agreement" consent.
16
+ *
17
+ * Shown (non-closable) the first time an agent is used (`agent.consent` is
18
+ * falsy). Only `super_admin` users can approve; everyone else sees the terms
19
+ * but the Approve button stays disabled — mirroring the Vue `KvAssistantView`.
20
+ */
21
+ export declare function AgentConsentDialog({ pending, onApproved, onDeclined, t }: AgentConsentDialogProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};
@@ -33,6 +33,20 @@ interface UseAssistantApiReturn {
33
33
  * an in-flight tool call (e.g. switch to AdaptiveCard rendering).
34
34
  */
35
35
  agentTools: Array<Record<string, any>>;
36
+ /**
37
+ * Set when the active agent requires consent that has not been given yet
38
+ * (`agent.consent` is falsy). `null` once consent is satisfied. Drives the
39
+ * "Terms & Agreement" gate. Mirrors the Vue `KvAssistantView` consent flow.
40
+ */
41
+ consentRequiredFor: {
42
+ agentId: string;
43
+ deploymentId?: string;
44
+ } | null;
45
+ /** Clears the pending consent (call after approve, or to dismiss the gate). */
46
+ setConsentRequiredFor: (value: {
47
+ agentId: string;
48
+ deploymentId?: string;
49
+ } | null) => void;
36
50
  fetchThreads: () => Promise<AssistantSession[]>;
37
51
  fetchProjectThreads: (projectId: string) => Promise<AssistantSession[]>;
38
52
  loadThreadMessages: (threadId: string) => Promise<any[]>;