@belonguniverseai/react-sdk 0.6.15 → 0.6.16

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 (68) hide show
  1. package/dist/api/client.d.ts +180 -0
  2. package/dist/api/questions.d.ts +41 -0
  3. package/dist/component/{abnfDiagram-N423BO3Z-BHtc0bvC.js → abnfDiagram-N423BO3Z-OROjdfGy.js} +4 -4
  4. package/dist/component/{arc-Cm9wcWlx.js → arc-BV89erXj.js} +2 -2
  5. package/dist/component/{architectureDiagram-T3A2C74G-B5Uz6lDY.js → architectureDiagram-T3A2C74G-DvC153Pa.js} +3 -3
  6. package/dist/component/{blockDiagram-VBNYF7ZC-DtXwzBny.js → blockDiagram-VBNYF7ZC-BhY_gBxr.js} +4 -4
  7. package/dist/component/{c4Diagram-5PPSVZJV-BvFhvePm.js → c4Diagram-5PPSVZJV-l_KLeHXr.js} +3 -3
  8. package/dist/component/{channel-D3rCn2In.js → channel-C04d5zF_.js} +2 -2
  9. package/dist/component/{chunk-2GRJ4B5K-BrKpH2JP.js → chunk-2GRJ4B5K-CEWW_4Iw.js} +2 -2
  10. package/dist/component/{chunk-2Q5K7J3B-BN7qA4Zt.js → chunk-2Q5K7J3B-CB6VkgEJ.js} +2 -2
  11. package/dist/component/{chunk-5RXB4S5H-xmyGOu7k.js → chunk-5RXB4S5H-FAQX8NS6.js} +5 -5
  12. package/dist/component/{chunk-5VM5RSS4-Bo9mNteC.js → chunk-5VM5RSS4-L_UXpqco.js} +2 -2
  13. package/dist/component/{chunk-6Q2QTUOP-o1oblyO-.js → chunk-6Q2QTUOP-Dodzsg9f.js} +2 -2
  14. package/dist/component/{chunk-GF5L2VYU-CBhzNfdK.js → chunk-GF5L2VYU-B6YkOr2d.js} +6 -6
  15. package/dist/component/{chunk-JWPE2WC7-CRCYILZC.js → chunk-JWPE2WC7-BzhR8Ja-.js} +2 -2
  16. package/dist/component/{chunk-KBJHAD2P-CC4Una6D.js → chunk-KBJHAD2P-D7S_ui4V.js} +2 -2
  17. package/dist/component/{chunk-RYQCIY6F--pWAXq1Z.js → chunk-RYQCIY6F-BRnTO8_F.js} +2 -2
  18. package/dist/component/{chunk-XXDRQBXY-DuNREPyH.js → chunk-XXDRQBXY-C7_5LZDu.js} +2 -2
  19. package/dist/component/{classDiagram-JCYQIIEL-Hok8J7EG.js → classDiagram-JCYQIIEL-D3MdI_KC.js} +3 -3
  20. package/dist/component/{classDiagram-v2-OCEON4UE-Hok8J7EG.js → classDiagram-v2-OCEON4UE-D3MdI_KC.js} +3 -3
  21. package/dist/component/{cose-bilkent-JH36ORCC-BfqjApDt.js → cose-bilkent-JH36ORCC-BEuo9qsi.js} +2 -2
  22. package/dist/component/{cynefinDiagram-MW4NZA55-BJZ-okQI.js → cynefinDiagram-MW4NZA55-BfhAjv0p.js} +3 -3
  23. package/dist/component/{dagre-VZM6K2ZE-6H6WAA1H.js → dagre-VZM6K2ZE-DdaRxW4J.js} +3 -3
  24. package/dist/component/{diagram-7IWD3JNH-BQQttfZd.js → diagram-7IWD3JNH-BFbU8Ovo.js} +4 -4
  25. package/dist/component/{diagram-B4RE2ZJO-Cb17vtkY.js → diagram-B4RE2ZJO-CdPb_acC.js} +3 -3
  26. package/dist/component/{diagram-LBJQPF4R-DnfooUZj.js → diagram-LBJQPF4R-Bo8o8x70.js} +3 -3
  27. package/dist/component/{diagram-Q27KOJAE-BUHBKgXu.js → diagram-Q27KOJAE-CugDzXxZ.js} +4 -4
  28. package/dist/component/{diagram-UB23O5K3-B9W7R9HH.js → diagram-UB23O5K3-CYHh9d2Z.js} +3 -3
  29. package/dist/component/{ebnfDiagram-BXEA7PRR-CzDJ9VKS.js → ebnfDiagram-BXEA7PRR-CdqVlgbh.js} +4 -4
  30. package/dist/component/{erDiagram-JOGREHBK-CiKy87rC.js → erDiagram-JOGREHBK-CMh6xOk6.js} +5 -5
  31. package/dist/component/{flowDiagram-UKHOOZJN-BJXlwNPw.js → flowDiagram-UKHOOZJN-ttP65F-a.js} +7 -7
  32. package/dist/component/{ganttDiagram-PKOTCBZU-DTKr0mnS.js → ganttDiagram-PKOTCBZU-CSTsjgxH.js} +3 -3
  33. package/dist/component/{gitGraphDiagram-DS77QQ5N-BqE9LM8q.js → gitGraphDiagram-DS77QQ5N-BtXqSxkQ.js} +4 -4
  34. package/dist/component/{highlighted-body-OFNGDK62-CIm9H1Wq.js → highlighted-body-OFNGDK62-CIltS1BE.js} +2 -2
  35. package/dist/component/index.js +2 -2
  36. package/dist/component/{infoDiagram-6WML65LV-DFm8QCR-.js → infoDiagram-6WML65LV-FqIIsY32.js} +2 -2
  37. package/dist/component/{ishikawaDiagram-WSZJBQD7-Dzu5X93V.js → ishikawaDiagram-WSZJBQD7-BA78Hm4p.js} +2 -2
  38. package/dist/component/{journeyDiagram-NVQOT4AX-B2jpJoxA.js → journeyDiagram-NVQOT4AX-Bu99yxhx.js} +5 -5
  39. package/dist/component/{kanban-definition-27J2QSJJ-DqqjEEqN.js → kanban-definition-27J2QSJJ-CTf66i07.js} +3 -3
  40. package/dist/component/{linear-VKGrBjVp.js → linear-Cr5nCYH-.js} +2 -2
  41. package/dist/component/{mermaid-GHXKKRXX-CvjBCI1T.js → mermaid-GHXKKRXX-Da5y0Kes.js} +35048 -34729
  42. package/dist/component/{mindmap-definition-FAOFIHXS-BxXZphfo.js → mindmap-definition-FAOFIHXS-CQ5erfft.js} +4 -4
  43. package/dist/component/{pegDiagram-VL7TDLO6-BB6KBO45.js → pegDiagram-VL7TDLO6-BP4d3yNS.js} +4 -4
  44. package/dist/component/{pieDiagram-7S7Q4E2Y-BhUDtn0U.js → pieDiagram-7S7Q4E2Y-BvhLQABG.js} +4 -4
  45. package/dist/component/{quadrantDiagram-CIZ2JOQS-BekTYpN9.js → quadrantDiagram-CIZ2JOQS-DEtpNVeI.js} +3 -3
  46. package/dist/component/{railroadDiagram-AXF67PYL-NkCqFfeB.js → railroadDiagram-AXF67PYL-BQ1Tz2JD.js} +4 -4
  47. package/dist/component/{requirementDiagram-LRYGKXZP-DgUbvazW.js → requirementDiagram-LRYGKXZP-DaubiNmJ.js} +4 -4
  48. package/dist/component/{sankeyDiagram-W5VNT64P-BaS-5dxg.js → sankeyDiagram-W5VNT64P-BHuCT4HV.js} +2 -2
  49. package/dist/component/{sequenceDiagram-SI44F4Z6-Brxy8LqB.js → sequenceDiagram-SI44F4Z6-Dds6EZRB.js} +4 -4
  50. package/dist/component/{sizeCapture-X5ZJPWSS-D3PazIzZ.js → sizeCapture-X5ZJPWSS-DgUmHwfK.js} +2 -2
  51. package/dist/component/{stateDiagram-OKZ733FA-DzRMa7xz.js → stateDiagram-OKZ733FA-DIKGff3C.js} +3 -3
  52. package/dist/component/{stateDiagram-v2-UEYNNEHI-5JRd_Kex.js → stateDiagram-v2-UEYNNEHI-D-W1YrbI.js} +3 -3
  53. package/dist/component/{swimlanes-SLNWSIFB-DZR-oUnN.js → swimlanes-SLNWSIFB-B0g61P7R.js} +4 -4
  54. package/dist/component/{swimlanesDiagram-ULZ7WXOC-Dn9jdzUC.js → swimlanesDiagram-ULZ7WXOC-4-qQ_GG9.js} +3 -3
  55. package/dist/component/{timeline-definition-Z64GVDOM-BTWa173z.js → timeline-definition-Z64GVDOM-Df_xk-8z.js} +3 -3
  56. package/dist/component/{vennDiagram-T6HMQDX7-BwE-iIK-.js → vennDiagram-T6HMQDX7-Ce74weIb.js} +2 -2
  57. package/dist/component/{wardleyDiagram-T6FBY63Y-H_pDULPZ.js → wardleyDiagram-T6FBY63Y-CMZ9e32m.js} +3 -3
  58. package/dist/component/{xychartDiagram-ELKLHX3M-DNBPqOgR.js → xychartDiagram-ELKLHX3M-DgbdZWSQ.js} +3 -3
  59. package/dist/components/connectors/ConnectorBrandLogo.d.ts +1 -1
  60. package/dist/components/embed/EmbedComposer.d.ts +6 -1
  61. package/dist/components/embed/QuestionCard.d.ts +25 -0
  62. package/dist/embed/copy.d.ts +3 -0
  63. package/dist/i18n/messages/en.d.ts +19 -1
  64. package/dist/i18n/messages/surfaces/stream.d.ts +58 -3
  65. package/dist/stream/belong-chat-transport.d.ts +44 -36
  66. package/dist/stream/belong-data-parts.d.ts +36 -29
  67. package/dist/stream/pending-question-store.d.ts +22 -0
  68. package/package.json +1 -1
@@ -15,7 +15,7 @@ export type PlanStep = {
15
15
  };
16
16
  export type ApprovalState = "pending" | "approved" | "rejected" | "amend_requested" | "expired";
17
17
  export type ToolCallState = "started" | "completed" | "failed";
18
- export type ChoiceState = "pending" | "resolved" | "expired";
18
+ export type ChoiceState = "pending" | "answered" | "dismissed" | "detached" | "cancelled";
19
19
  export type SandboxCommandState = "started" | "output" | "completed" | "failed";
20
20
  export type SandboxStream = "stdout" | "stderr";
21
21
  export type UiActionState = "requested" | "completed" | "failed";
@@ -48,44 +48,51 @@ export type ApprovalRequestData = {
48
48
  readonly subagentId?: string | undefined;
49
49
  };
50
50
  /**
51
- * BEL-93 a friendly question widget the agent emits instead of dumping a wall
52
- * of questions as prose. Discriminated on `mode`:
53
- * - "single": choose exactly one option (radio group)
54
- * - "multi": choose several options (checkbox list), bounded by
55
- * min/maxChoicesCount when present
56
- * - "open": free-text answer (textarea)
57
- * The user answers in-dock; the SDK posts the answer back through the same
58
- * `ui-actions/:uiActionRequestId/result` endpoint the UI-action renderer uses,
59
- * so no new backend route is needed. `state` mirrors the approval lifecycle
60
- * (see ChoiceState) so a resolved/expired question survives a reload.
51
+ * Plan 013 (supersedes BEL-93's single-question shape) the agent's
52
+ * `AskUserQuestion` call as ONE part: 1–4 questions, each single- or
53
+ * multi-select with 2–4 options (label + description). The dock adds its own
54
+ * "Something else" free-text row and a per-question Skip. Answers post to
55
+ * `POST /v1/questions/:questionRequestId/answer` by option id; `answers` /
56
+ * `reply` are filled in by the backend on resolution (live) or by the history
57
+ * patch (reload) so the transcript record renders identically either way.
61
58
  */
62
59
  export type ChoiceOption = {
63
60
  readonly id: string;
64
61
  readonly label: string;
65
- readonly description?: string | undefined;
62
+ readonly description: string;
66
63
  };
67
- export type ChoiceRequestData = {
68
- readonly mode: "single";
69
- readonly uiActionRequestId: string;
64
+ export type ChoiceQuestion = {
65
+ readonly id: string;
70
66
  readonly question: string;
67
+ /** Chip label, ≤ 12 chars. */
68
+ readonly header: string;
69
+ readonly multiSelect: boolean;
71
70
  readonly options: readonly ChoiceOption[];
72
- readonly state: ChoiceState;
71
+ };
72
+ /**
73
+ * One question's answer. On a MULTI-select question `text` alongside
74
+ * `optionIds` is the "Something else" free text combined with the ticks — the
75
+ * agent gets both. A single-select answer is exactly one option OR `text`
76
+ * (the server rejects options + text there).
77
+ */
78
+ export type ChoiceAnswer = {
79
+ readonly kind: "options";
80
+ readonly optionIds: readonly string[];
81
+ readonly text?: string | undefined;
73
82
  } | {
74
- readonly mode: "multi";
75
- readonly uiActionRequestId: string;
76
- readonly question: string;
77
- readonly options: readonly ChoiceOption[];
78
- readonly state: ChoiceState;
79
- /** Inclusive lower bound on selected options. Absent ⇒ at least one (1). */
80
- readonly minChoicesCount?: number | undefined;
81
- /** Inclusive upper bound on selected options. Absent ⇒ no maximum. */
82
- readonly maxChoicesCount?: number | undefined;
83
+ readonly kind: "text";
84
+ readonly text: string;
83
85
  } | {
84
- readonly mode: "open";
85
- readonly uiActionRequestId: string;
86
- readonly question: string;
86
+ readonly kind: "skipped";
87
+ };
88
+ export type ChoiceRequestData = {
89
+ readonly questionRequestId: string;
87
90
  readonly state: ChoiceState;
88
- readonly placeholder?: string | undefined;
91
+ readonly questions: readonly ChoiceQuestion[];
92
+ /** Keyed by question id. Present once answered. */
93
+ readonly answers?: Readonly<Record<string, ChoiceAnswer>> | undefined;
94
+ /** The composer text when the user replied in chat instead of choosing. */
95
+ readonly reply?: string | undefined;
89
96
  };
90
97
  /**
91
98
  * Optional fields declared with explicit `| undefined` so Zod's
@@ -0,0 +1,22 @@
1
+ import { BelongUIMessage, ChoiceRequestData } from './belong-data-parts.ts';
2
+ /** Snapshot — identity is stable until the set changes (useSyncExternalStore). */
3
+ export declare const peekHiddenQuestions: () => ReadonlySet<string>;
4
+ export declare const subscribeHiddenQuestions: (listener: () => void) => (() => void);
5
+ export declare const isQuestionHidden: (questionRequestId: string) => boolean;
6
+ export declare const hideQuestion: (questionRequestId: string) => void;
7
+ export declare const unhideQuestion: (questionRequestId: string) => void;
8
+ export declare const __resetPendingQuestionStoreForTest: () => void;
9
+ /**
10
+ * The question the bottom card should show: the NEWEST answerable
11
+ * `data-choice-request` part across the conversation that is not hidden, or
12
+ * null. Same-id parts replace each other in `useChat` (a resolution arrives
13
+ * as the same part id with a terminal state), so a question that was answered
14
+ * — from this tab, another tab, or a reload's history patch — un-arms the card
15
+ * from the wire without any local bookkeeping.
16
+ *
17
+ * The LAST occurrence of each question id wins before "newest" is decided: a
18
+ * restored history part and a resumed stream's re-emit of the same question
19
+ * (§40 re-attach) can sit in different messages, and only the later one
20
+ * carries the current state.
21
+ */
22
+ export declare const selectActiveQuestion: (messages: readonly BelongUIMessage[], hiddenIds: ReadonlySet<string>) => ChoiceRequestData | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "0.6.15",
3
+ "version": "0.6.16",
4
4
  "description": "Belong — embeddable React AI assistant dock. Mount <BelongWidget> in your app tree with getToken dependency-injection auth.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",