@belonguniverseai/react-sdk 0.6.15 → 0.6.17

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 (82) hide show
  1. package/dist/api/account-connector-contract.d.ts +2 -0
  2. package/dist/api/account-connectors.d.ts +86 -0
  3. package/dist/api/client.d.ts +391 -2
  4. package/dist/api/connectors.d.ts +12 -0
  5. package/dist/api/query-keys.d.ts +1 -0
  6. package/dist/api/questions.d.ts +41 -0
  7. package/dist/api/task-schedules.d.ts +33 -1
  8. package/dist/component/{abnfDiagram-N423BO3Z-BHtc0bvC.js → abnfDiagram-N423BO3Z-DQQzuYZD.js} +4 -4
  9. package/dist/component/{arc-Cm9wcWlx.js → arc-DyP79PGf.js} +2 -2
  10. package/dist/component/{architectureDiagram-T3A2C74G-B5Uz6lDY.js → architectureDiagram-T3A2C74G-D_elSQ1O.js} +3 -3
  11. package/dist/component/{blockDiagram-VBNYF7ZC-DtXwzBny.js → blockDiagram-VBNYF7ZC-LCbtrdey.js} +4 -4
  12. package/dist/component/{c4Diagram-5PPSVZJV-BvFhvePm.js → c4Diagram-5PPSVZJV-BavpcOfZ.js} +3 -3
  13. package/dist/component/{channel-D3rCn2In.js → channel-BZqwTbw2.js} +2 -2
  14. package/dist/component/{chunk-2GRJ4B5K-BrKpH2JP.js → chunk-2GRJ4B5K-CUnqSIZ_.js} +2 -2
  15. package/dist/component/{chunk-2Q5K7J3B-BN7qA4Zt.js → chunk-2Q5K7J3B-BXbvDQmH.js} +2 -2
  16. package/dist/component/{chunk-5RXB4S5H-xmyGOu7k.js → chunk-5RXB4S5H-9sfSr0mD.js} +5 -5
  17. package/dist/component/{chunk-5VM5RSS4-Bo9mNteC.js → chunk-5VM5RSS4-VnYY-ckg.js} +2 -2
  18. package/dist/component/{chunk-6Q2QTUOP-o1oblyO-.js → chunk-6Q2QTUOP-cjY3qI3C.js} +2 -2
  19. package/dist/component/{chunk-GF5L2VYU-CBhzNfdK.js → chunk-GF5L2VYU-B4uiGrvB.js} +6 -6
  20. package/dist/component/{chunk-JWPE2WC7-CRCYILZC.js → chunk-JWPE2WC7-C_FwRGti.js} +2 -2
  21. package/dist/component/{chunk-KBJHAD2P-CC4Una6D.js → chunk-KBJHAD2P-BThvKHPK.js} +2 -2
  22. package/dist/component/{chunk-RYQCIY6F--pWAXq1Z.js → chunk-RYQCIY6F-CNf0rdtW.js} +2 -2
  23. package/dist/component/{chunk-XXDRQBXY-DuNREPyH.js → chunk-XXDRQBXY-BDEUQoWy.js} +2 -2
  24. package/dist/component/{classDiagram-JCYQIIEL-Hok8J7EG.js → classDiagram-JCYQIIEL-Dp0ahzb0.js} +3 -3
  25. package/dist/component/{classDiagram-v2-OCEON4UE-Hok8J7EG.js → classDiagram-v2-OCEON4UE-Dp0ahzb0.js} +3 -3
  26. package/dist/component/{cose-bilkent-JH36ORCC-BfqjApDt.js → cose-bilkent-JH36ORCC-Dc-CE5JY.js} +2 -2
  27. package/dist/component/{cynefinDiagram-MW4NZA55-BJZ-okQI.js → cynefinDiagram-MW4NZA55-BA2fEkMD.js} +3 -3
  28. package/dist/component/{dagre-VZM6K2ZE-6H6WAA1H.js → dagre-VZM6K2ZE-B4d8ixBl.js} +3 -3
  29. package/dist/component/{diagram-7IWD3JNH-BQQttfZd.js → diagram-7IWD3JNH-DKOeWl-_.js} +4 -4
  30. package/dist/component/{diagram-B4RE2ZJO-Cb17vtkY.js → diagram-B4RE2ZJO-DvvRtQm3.js} +3 -3
  31. package/dist/component/{diagram-LBJQPF4R-DnfooUZj.js → diagram-LBJQPF4R-DXFi21rR.js} +3 -3
  32. package/dist/component/{diagram-Q27KOJAE-BUHBKgXu.js → diagram-Q27KOJAE-BkZNFrtu.js} +4 -4
  33. package/dist/component/{diagram-UB23O5K3-B9W7R9HH.js → diagram-UB23O5K3-D_IJQzxk.js} +3 -3
  34. package/dist/component/{ebnfDiagram-BXEA7PRR-CzDJ9VKS.js → ebnfDiagram-BXEA7PRR-DD6VLDvv.js} +4 -4
  35. package/dist/component/{erDiagram-JOGREHBK-CiKy87rC.js → erDiagram-JOGREHBK-D2GUhORW.js} +5 -5
  36. package/dist/component/{flowDiagram-UKHOOZJN-BJXlwNPw.js → flowDiagram-UKHOOZJN-BO76VMQu.js} +7 -7
  37. package/dist/component/{ganttDiagram-PKOTCBZU-DTKr0mnS.js → ganttDiagram-PKOTCBZU-DiZEbOvk.js} +3 -3
  38. package/dist/component/{gitGraphDiagram-DS77QQ5N-BqE9LM8q.js → gitGraphDiagram-DS77QQ5N-3JU_fIgh.js} +4 -4
  39. package/dist/component/{highlighted-body-OFNGDK62-CIm9H1Wq.js → highlighted-body-OFNGDK62-DyUfTvlp.js} +2 -2
  40. package/dist/component/index.js +2 -2
  41. package/dist/component/{infoDiagram-6WML65LV-DFm8QCR-.js → infoDiagram-6WML65LV-wQDDhFdJ.js} +2 -2
  42. package/dist/component/{ishikawaDiagram-WSZJBQD7-Dzu5X93V.js → ishikawaDiagram-WSZJBQD7-ByqLAAAH.js} +2 -2
  43. package/dist/component/{journeyDiagram-NVQOT4AX-B2jpJoxA.js → journeyDiagram-NVQOT4AX-CJrAO9iO.js} +5 -5
  44. package/dist/component/{kanban-definition-27J2QSJJ-DqqjEEqN.js → kanban-definition-27J2QSJJ-BK-6EIGy.js} +3 -3
  45. package/dist/component/{linear-VKGrBjVp.js → linear-5HARV3Z1.js} +2 -2
  46. package/dist/component/{mermaid-GHXKKRXX-CvjBCI1T.js → mermaid-GHXKKRXX-BYmG2b26.js} +38064 -37241
  47. package/dist/component/{mindmap-definition-FAOFIHXS-BxXZphfo.js → mindmap-definition-FAOFIHXS-CWZ3W_zW.js} +4 -4
  48. package/dist/component/{pegDiagram-VL7TDLO6-BB6KBO45.js → pegDiagram-VL7TDLO6-DHCzlDWN.js} +4 -4
  49. package/dist/component/{pieDiagram-7S7Q4E2Y-BhUDtn0U.js → pieDiagram-7S7Q4E2Y-BbgPCeI4.js} +4 -4
  50. package/dist/component/{quadrantDiagram-CIZ2JOQS-BekTYpN9.js → quadrantDiagram-CIZ2JOQS-CVNb4Dn0.js} +3 -3
  51. package/dist/component/{railroadDiagram-AXF67PYL-NkCqFfeB.js → railroadDiagram-AXF67PYL-BZtclau2.js} +4 -4
  52. package/dist/component/{requirementDiagram-LRYGKXZP-DgUbvazW.js → requirementDiagram-LRYGKXZP-DJeluZaM.js} +4 -4
  53. package/dist/component/{sankeyDiagram-W5VNT64P-BaS-5dxg.js → sankeyDiagram-W5VNT64P-CxVyzRB-.js} +2 -2
  54. package/dist/component/{sequenceDiagram-SI44F4Z6-Brxy8LqB.js → sequenceDiagram-SI44F4Z6-DrkHqtHC.js} +4 -4
  55. package/dist/component/{sizeCapture-X5ZJPWSS-D3PazIzZ.js → sizeCapture-X5ZJPWSS-Ctgo1XlA.js} +2 -2
  56. package/dist/component/{stateDiagram-OKZ733FA-DzRMa7xz.js → stateDiagram-OKZ733FA-DhCABcA4.js} +3 -3
  57. package/dist/component/{stateDiagram-v2-UEYNNEHI-5JRd_Kex.js → stateDiagram-v2-UEYNNEHI-D_zLh09v.js} +3 -3
  58. package/dist/component/{swimlanes-SLNWSIFB-DZR-oUnN.js → swimlanes-SLNWSIFB-C40PaZQK.js} +4 -4
  59. package/dist/component/{swimlanesDiagram-ULZ7WXOC-Dn9jdzUC.js → swimlanesDiagram-ULZ7WXOC-BIpHviIl.js} +3 -3
  60. package/dist/component/{timeline-definition-Z64GVDOM-BTWa173z.js → timeline-definition-Z64GVDOM-Byx2AKIE.js} +3 -3
  61. package/dist/component/{vennDiagram-T6HMQDX7-BwE-iIK-.js → vennDiagram-T6HMQDX7-CqLQjKUJ.js} +2 -2
  62. package/dist/component/{wardleyDiagram-T6FBY63Y-H_pDULPZ.js → wardleyDiagram-T6FBY63Y-S9fJVDcY.js} +3 -3
  63. package/dist/component/{xychartDiagram-ELKLHX3M-DNBPqOgR.js → xychartDiagram-ELKLHX3M-B3t1Zyyn.js} +3 -3
  64. package/dist/components/connectors/AccountConnectorDialog.d.ts +8 -0
  65. package/dist/components/connectors/ConnectorBrandLogo.d.ts +1 -1
  66. package/dist/components/connectors/ConnectorMarketplaceDialog.d.ts +3 -1
  67. package/dist/components/connectors/NewConnectorDialog.d.ts +2 -2
  68. package/dist/components/embed/EmbedComposer.d.ts +6 -1
  69. package/dist/components/embed/QuestionCard.d.ts +25 -0
  70. package/dist/components/scheduled/ScheduledDetailSurface.d.ts +3 -0
  71. package/dist/components/ui/badge.d.ts +1 -1
  72. package/dist/components/ui/button.d.ts +1 -1
  73. package/dist/components/ui/input-group.d.ts +1 -1
  74. package/dist/embed/copy.d.ts +3 -0
  75. package/dist/i18n/messages/en.d.ts +39 -1
  76. package/dist/i18n/messages/surfaces/connectors.d.ts +27 -0
  77. package/dist/i18n/messages/surfaces/scheduled.d.ts +33 -0
  78. package/dist/i18n/messages/surfaces/stream.d.ts +58 -3
  79. package/dist/stream/belong-chat-transport.d.ts +60 -36
  80. package/dist/stream/belong-data-parts.d.ts +51 -29
  81. package/dist/stream/pending-question-store.d.ts +22 -0
  82. package/package.json +1 -1
@@ -29,9 +29,26 @@ export declare const streamEn: {
29
29
  readonly submitError: "That didn't go through — {{message}}. Try again.";
30
30
  readonly errorServerAnswered: "the server answered {{status}}";
31
31
  readonly errorRequestUnreachable: "the request didn't reach the server";
32
- readonly answered: "answered";
33
32
  readonly alreadyAnswered: "already answered";
33
+ readonly questionPending: "Waiting for your answer";
34
+ readonly questionSkipped: "skipped";
35
+ readonly questionClosed: "closed without answering";
36
+ readonly questionDetached: "still open — answer it or reply in the chat";
37
+ readonly questionCancelled: "cancelled";
38
+ readonly youReplied: "You replied: {{reply}}";
34
39
  readonly submit: "Submit";
40
+ readonly questionOf: "{{n}} of {{total}}";
41
+ readonly previousQuestion: "Previous question";
42
+ readonly nextQuestion: "Next question";
43
+ readonly close: "Close";
44
+ readonly somethingElse: "Something else";
45
+ readonly typeYourAnswer: "Type your answer…";
46
+ readonly skip: "Skip";
47
+ readonly selectedCount_one: "{{count}} selected";
48
+ readonly selectedCount_other: "{{count}} selected";
49
+ readonly answer: "Answer";
50
+ readonly next: "Next";
51
+ readonly questionDetachedHint: "Belong moved on — your answer will be sent as a new message";
35
52
  readonly toolShellRunning: "Running a command";
36
53
  readonly toolShellDone: "Ran a command";
37
54
  readonly toolShellFailed: "A command didn't complete";
@@ -71,6 +88,8 @@ export declare const streamEn: {
71
88
  readonly actionMadePlan: "Put a plan together";
72
89
  readonly actionCheckedRules: "Checked the rules";
73
90
  readonly actionScheduledTask: "Set up a scheduled task";
91
+ /** Plan 013 — `ask_user_question` / `AskUserQuestion`. */
92
+ readonly actionAskedQuestion: "Asked a question";
74
93
  /** A tool this build has no copy for — a neutral line, never its name. */
75
94
  readonly actionGeneric: "Worked on it";
76
95
  readonly executingTasks: "Working on it…";
@@ -120,9 +139,26 @@ export declare const streamEs: {
120
139
  submitError: string;
121
140
  errorServerAnswered: string;
122
141
  errorRequestUnreachable: string;
123
- answered: string;
124
142
  alreadyAnswered: string;
143
+ questionPending: string;
144
+ questionSkipped: string;
145
+ questionClosed: string;
146
+ questionDetached: string;
147
+ questionCancelled: string;
148
+ youReplied: string;
125
149
  submit: string;
150
+ questionOf: string;
151
+ previousQuestion: string;
152
+ nextQuestion: string;
153
+ close: string;
154
+ somethingElse: string;
155
+ typeYourAnswer: string;
156
+ skip: string;
157
+ selectedCount_one: string;
158
+ selectedCount_other: string;
159
+ answer: string;
160
+ next: string;
161
+ questionDetachedHint: string;
126
162
  toolShellRunning: string;
127
163
  toolShellDone: string;
128
164
  toolShellFailed: string;
@@ -162,6 +198,7 @@ export declare const streamEs: {
162
198
  actionMadePlan: string;
163
199
  actionCheckedRules: string;
164
200
  actionScheduledTask: string;
201
+ actionAskedQuestion: string;
165
202
  actionGeneric: string;
166
203
  executingTasks: string;
167
204
  workedSteps_one: string;
@@ -209,9 +246,26 @@ export declare const streamPt: {
209
246
  submitError: string;
210
247
  errorServerAnswered: string;
211
248
  errorRequestUnreachable: string;
212
- answered: string;
213
249
  alreadyAnswered: string;
250
+ questionPending: string;
251
+ questionSkipped: string;
252
+ questionClosed: string;
253
+ questionDetached: string;
254
+ questionCancelled: string;
255
+ youReplied: string;
214
256
  submit: string;
257
+ questionOf: string;
258
+ previousQuestion: string;
259
+ nextQuestion: string;
260
+ close: string;
261
+ somethingElse: string;
262
+ typeYourAnswer: string;
263
+ skip: string;
264
+ selectedCount_one: string;
265
+ selectedCount_other: string;
266
+ answer: string;
267
+ next: string;
268
+ questionDetachedHint: string;
215
269
  toolShellRunning: string;
216
270
  toolShellDone: string;
217
271
  toolShellFailed: string;
@@ -251,6 +305,7 @@ export declare const streamPt: {
251
305
  actionMadePlan: string;
252
306
  actionCheckedRules: string;
253
307
  actionScheduledTask: string;
308
+ actionAskedQuestion: string;
254
309
  actionGeneric: string;
255
310
  executingTasks: string;
256
311
  workedSteps_one: string;
@@ -9,6 +9,23 @@ declare const cancelRunResponseSchema: z.ZodObject<{
9
9
  }, z.core.$strip>>>;
10
10
  }, z.core.$strip>;
11
11
  export type RecalledQueuedMessage = z.infer<typeof cancelRunResponseSchema>["recalledMessages"][number];
12
+ export declare const choiceAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
13
+ kind: z.ZodLiteral<"options">;
14
+ optionIds: z.ZodArray<z.ZodString>;
15
+ text: z.ZodOptional<z.ZodString>;
16
+ }, z.core.$strip>, z.ZodObject<{
17
+ kind: z.ZodLiteral<"text">;
18
+ text: z.ZodString;
19
+ }, z.core.$strip>, z.ZodObject<{
20
+ kind: z.ZodLiteral<"skipped">;
21
+ }, z.core.$strip>], "kind">;
22
+ export declare const choiceStateSchema: z.ZodEnum<{
23
+ pending: "pending";
24
+ detached: "detached";
25
+ answered: "answered";
26
+ dismissed: "dismissed";
27
+ cancelled: "cancelled";
28
+ }>;
12
29
  /**
13
30
  * The wire/stored part union. Exported so the history loader (chat.tsx) can
14
31
  * validate persisted assistant parts against the SAME shapes the live stream
@@ -58,6 +75,22 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
58
75
  expired: "expired";
59
76
  }>;
60
77
  toolName: z.ZodOptional<z.ZodString>;
78
+ preview: z.ZodOptional<z.ZodObject<{
79
+ heading: z.ZodString;
80
+ fields: z.ZodArray<z.ZodObject<{
81
+ label: z.ZodString;
82
+ value: z.ZodString;
83
+ emphasis: z.ZodOptional<z.ZodEnum<{
84
+ normal: "normal";
85
+ warning: "warning";
86
+ }>>;
87
+ }, z.core.$strip>>;
88
+ body: z.ZodNullable<z.ZodObject<{
89
+ label: z.ZodString;
90
+ content: z.ZodString;
91
+ }, z.core.$strip>>;
92
+ }, z.core.$strip>>;
93
+ persistentConsentAllowed: z.ZodOptional<z.ZodBoolean>;
61
94
  subagentId: z.ZodOptional<z.ZodString>;
62
95
  }, z.core.$strip>;
63
96
  }, z.core.$strip>, z.ZodObject<{
@@ -188,47 +221,38 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
188
221
  }, z.core.$strip>, z.ZodObject<{
189
222
  type: z.ZodLiteral<"data-choice-request">;
190
223
  id: z.ZodString;
191
- data: z.ZodDiscriminatedUnion<[z.ZodObject<{
192
- mode: z.ZodLiteral<"single">;
193
- uiActionRequestId: z.ZodString;
194
- question: z.ZodString;
195
- options: z.ZodArray<z.ZodObject<{
196
- id: z.ZodString;
197
- label: z.ZodString;
198
- description: z.ZodOptional<z.ZodString>;
199
- }, z.core.$strip>>;
224
+ data: z.ZodObject<{
225
+ questionRequestId: z.ZodString;
200
226
  state: z.ZodEnum<{
201
227
  pending: "pending";
202
- expired: "expired";
203
- resolved: "resolved";
228
+ detached: "detached";
229
+ answered: "answered";
230
+ dismissed: "dismissed";
231
+ cancelled: "cancelled";
204
232
  }>;
205
- }, z.core.$strip>, z.ZodObject<{
206
- mode: z.ZodLiteral<"multi">;
207
- uiActionRequestId: z.ZodString;
208
- question: z.ZodString;
209
- options: z.ZodArray<z.ZodObject<{
233
+ questions: z.ZodArray<z.ZodObject<{
210
234
  id: z.ZodString;
211
- label: z.ZodString;
212
- description: z.ZodOptional<z.ZodString>;
235
+ question: z.ZodString;
236
+ header: z.ZodString;
237
+ multiSelect: z.ZodBoolean;
238
+ options: z.ZodArray<z.ZodObject<{
239
+ id: z.ZodString;
240
+ label: z.ZodString;
241
+ description: z.ZodString;
242
+ }, z.core.$strip>>;
213
243
  }, z.core.$strip>>;
214
- state: z.ZodEnum<{
215
- pending: "pending";
216
- expired: "expired";
217
- resolved: "resolved";
218
- }>;
219
- minChoicesCount: z.ZodOptional<z.ZodNumber>;
220
- maxChoicesCount: z.ZodOptional<z.ZodNumber>;
221
- }, z.core.$strip>, z.ZodObject<{
222
- mode: z.ZodLiteral<"open">;
223
- uiActionRequestId: z.ZodString;
224
- question: z.ZodString;
225
- state: z.ZodEnum<{
226
- pending: "pending";
227
- expired: "expired";
228
- resolved: "resolved";
229
- }>;
230
- placeholder: z.ZodOptional<z.ZodString>;
231
- }, z.core.$strip>], "mode">;
244
+ answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
245
+ kind: z.ZodLiteral<"options">;
246
+ optionIds: z.ZodArray<z.ZodString>;
247
+ text: z.ZodOptional<z.ZodString>;
248
+ }, z.core.$strip>, z.ZodObject<{
249
+ kind: z.ZodLiteral<"text">;
250
+ text: z.ZodString;
251
+ }, z.core.$strip>, z.ZodObject<{
252
+ kind: z.ZodLiteral<"skipped">;
253
+ }, z.core.$strip>], "kind">>>;
254
+ reply: z.ZodOptional<z.ZodString>;
255
+ }, z.core.$strip>;
232
256
  }, z.core.$strip>], "type">;
233
257
  /** A request was 401'd twice (once with a freshly re-read token): the host
234
258
  * session is expired — the dock must surface re-auth, not retry forever. */
@@ -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";
@@ -28,6 +28,18 @@ export type PlanData = {
28
28
  readonly summary: string;
29
29
  readonly steps: readonly PlanStep[];
30
30
  };
31
+ export type ApprovalPreview = {
32
+ readonly heading: string;
33
+ readonly fields: readonly {
34
+ readonly label: string;
35
+ readonly value: string;
36
+ readonly emphasis?: "normal" | "warning" | undefined;
37
+ }[];
38
+ readonly body: {
39
+ readonly label: string;
40
+ readonly content: string;
41
+ } | null;
42
+ };
31
43
  export type ApprovalRequestData = {
32
44
  readonly approvalId: string;
33
45
  readonly reason: string;
@@ -40,6 +52,9 @@ export type ApprovalRequestData = {
40
52
  * messages; render the generic label when undefined.
41
53
  */
42
54
  readonly toolName?: string | undefined;
55
+ readonly preview?: ApprovalPreview | undefined;
56
+ /** False for exact-action approvals that must never become standing consent. */
57
+ readonly persistentConsentAllowed?: boolean | undefined;
43
58
  /**
44
59
  * BEL-199 attribution — the `data-subagent` part id whose gated call raised this
45
60
  * card. The resolution event (`approval_state_changed`) carries no subagentId, so
@@ -48,44 +63,51 @@ export type ApprovalRequestData = {
48
63
  readonly subagentId?: string | undefined;
49
64
  };
50
65
  /**
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.
66
+ * Plan 013 (supersedes BEL-93's single-question shape) the agent's
67
+ * `AskUserQuestion` call as ONE part: 1–4 questions, each single- or
68
+ * multi-select with 2–4 options (label + description). The dock adds its own
69
+ * "Something else" free-text row and a per-question Skip. Answers post to
70
+ * `POST /v1/questions/:questionRequestId/answer` by option id; `answers` /
71
+ * `reply` are filled in by the backend on resolution (live) or by the history
72
+ * patch (reload) so the transcript record renders identically either way.
61
73
  */
62
74
  export type ChoiceOption = {
63
75
  readonly id: string;
64
76
  readonly label: string;
65
- readonly description?: string | undefined;
77
+ readonly description: string;
66
78
  };
67
- export type ChoiceRequestData = {
68
- readonly mode: "single";
69
- readonly uiActionRequestId: string;
79
+ export type ChoiceQuestion = {
80
+ readonly id: string;
70
81
  readonly question: string;
82
+ /** Chip label, ≤ 12 chars. */
83
+ readonly header: string;
84
+ readonly multiSelect: boolean;
71
85
  readonly options: readonly ChoiceOption[];
72
- readonly state: ChoiceState;
86
+ };
87
+ /**
88
+ * One question's answer. On a MULTI-select question `text` alongside
89
+ * `optionIds` is the "Something else" free text combined with the ticks — the
90
+ * agent gets both. A single-select answer is exactly one option OR `text`
91
+ * (the server rejects options + text there).
92
+ */
93
+ export type ChoiceAnswer = {
94
+ readonly kind: "options";
95
+ readonly optionIds: readonly string[];
96
+ readonly text?: string | undefined;
73
97
  } | {
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;
98
+ readonly kind: "text";
99
+ readonly text: string;
83
100
  } | {
84
- readonly mode: "open";
85
- readonly uiActionRequestId: string;
86
- readonly question: string;
101
+ readonly kind: "skipped";
102
+ };
103
+ export type ChoiceRequestData = {
104
+ readonly questionRequestId: string;
87
105
  readonly state: ChoiceState;
88
- readonly placeholder?: string | undefined;
106
+ readonly questions: readonly ChoiceQuestion[];
107
+ /** Keyed by question id. Present once answered. */
108
+ readonly answers?: Readonly<Record<string, ChoiceAnswer>> | undefined;
109
+ /** The composer text when the user replied in chat instead of choosing. */
110
+ readonly reply?: string | undefined;
89
111
  };
90
112
  /**
91
113
  * 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.17",
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",