@belonguniverseai/react-sdk 0.6.21 → 0.6.23

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 (226) hide show
  1. package/README.md +69 -0
  2. package/dist/api/account-connectors.d.ts +2 -2
  3. package/dist/api/api-keys.d.ts +22 -0
  4. package/dist/api/client-identity.d.ts +12 -0
  5. package/dist/api/client.d.ts +2453 -92
  6. package/dist/api/goals.d.ts +179 -0
  7. package/dist/api/issue-reports.d.ts +13 -0
  8. package/dist/api/query-keys.d.ts +19 -0
  9. package/dist/api/report-client-error.d.ts +3 -0
  10. package/dist/api/retry-fetch.d.ts +19 -0
  11. package/dist/api/session-end.d.ts +2 -0
  12. package/dist/api/skill-library.d.ts +100 -0
  13. package/dist/api/skills.d.ts +3 -1
  14. package/dist/api/task-schedule-sharing.d.ts +166 -0
  15. package/dist/api/task-schedules.d.ts +23 -1
  16. package/dist/app/BelongDock.d.ts +0 -28
  17. package/dist/app/dock-demo-features.d.ts +13 -0
  18. package/dist/app/dock-demo-transport.d.ts +37 -0
  19. package/dist/app/dock-outlet.d.ts +15 -5
  20. package/dist/app/dock-story-data.d.ts +116 -0
  21. package/dist/browser/allowed-ops.d.ts +18 -0
  22. package/dist/browser/host-mcp.d.ts +31 -0
  23. package/dist/component/THIRD_PARTY_NOTICES.txt +24 -0
  24. package/dist/component/{abnfDiagram-N423BO3Z-DZRUOUZQ.js → abnfDiagram-N423BO3Z-bM1BoI0O.js} +4 -4
  25. package/dist/component/{arc-B4biduil.js → arc-DaSgre52.js} +2 -2
  26. package/dist/component/{architectureDiagram-T3A2C74G-q8voStNN.js → architectureDiagram-T3A2C74G-avMCXzQw.js} +3 -3
  27. package/dist/component/{blockDiagram-VBNYF7ZC-C0TDyTgw.js → blockDiagram-VBNYF7ZC-Cg6EDrdt.js} +4 -4
  28. package/dist/component/{c4Diagram-5PPSVZJV-rxRyd6rh.js → c4Diagram-5PPSVZJV-DhUs6wdK.js} +3 -3
  29. package/dist/component/{channel-CUruDJSx.js → channel-DlmuDpcv.js} +2 -2
  30. package/dist/component/{chunk-2GRJ4B5K-Kff5Fvbi.js → chunk-2GRJ4B5K-Drdf-9Az.js} +2 -2
  31. package/dist/component/{chunk-2Q5K7J3B-BT3ZD31a.js → chunk-2Q5K7J3B-CG6mCJjr.js} +2 -2
  32. package/dist/component/{chunk-5RXB4S5H-CYZ36tQD.js → chunk-5RXB4S5H-DYJwqjr4.js} +5 -5
  33. package/dist/component/{chunk-5VM5RSS4-BweQRk7u.js → chunk-5VM5RSS4-B21XfkBj.js} +2 -2
  34. package/dist/component/{chunk-6Q2QTUOP-DHcoXRhe.js → chunk-6Q2QTUOP-DZkWqf90.js} +2 -2
  35. package/dist/component/{chunk-GF5L2VYU-DtE5ljCc.js → chunk-GF5L2VYU-5hBEo1f5.js} +6 -6
  36. package/dist/component/{chunk-JWPE2WC7-ClHq4gN2.js → chunk-JWPE2WC7-DAn-TcDC.js} +2 -2
  37. package/dist/component/{chunk-KBJHAD2P-BeCfHf5W.js → chunk-KBJHAD2P-CEMDhN2A.js} +2 -2
  38. package/dist/component/{chunk-RYQCIY6F-CuAngwHt.js → chunk-RYQCIY6F-BWL1otLK.js} +2 -2
  39. package/dist/component/{chunk-XXDRQBXY-D9c0CJyR.js → chunk-XXDRQBXY-D0TWnqlD.js} +2 -2
  40. package/dist/component/{classDiagram-JCYQIIEL-DdzIbKj1.js → classDiagram-JCYQIIEL-CjU-7xK0.js} +3 -3
  41. package/dist/component/{classDiagram-v2-OCEON4UE-DdzIbKj1.js → classDiagram-v2-OCEON4UE-CjU-7xK0.js} +3 -3
  42. package/dist/component/{cose-bilkent-JH36ORCC-hME9BYGm.js → cose-bilkent-JH36ORCC-MkPQhZKJ.js} +2 -2
  43. package/dist/component/{cynefinDiagram-MW4NZA55-BiceKBPh.js → cynefinDiagram-MW4NZA55-Wf-Eh_MR.js} +3 -3
  44. package/dist/component/{dagre-VZM6K2ZE-DiPOLAUX.js → dagre-VZM6K2ZE-D1ND11ws.js} +3 -3
  45. package/dist/component/{diagram-7IWD3JNH-BSDWgxjs.js → diagram-7IWD3JNH-ChO63Ikp.js} +4 -4
  46. package/dist/component/{diagram-B4RE2ZJO-BdpGOPaT.js → diagram-B4RE2ZJO-CFVIZBxd.js} +3 -3
  47. package/dist/component/{diagram-LBJQPF4R-B0V6_5ih.js → diagram-LBJQPF4R-BFErKt-H.js} +3 -3
  48. package/dist/component/{diagram-Q27KOJAE-CYDb40TJ.js → diagram-Q27KOJAE-3EA2fDKz.js} +4 -4
  49. package/dist/component/{diagram-UB23O5K3-DgwjRdl5.js → diagram-UB23O5K3-D914yr1r.js} +3 -3
  50. package/dist/component/{ebnfDiagram-BXEA7PRR-D-C7SWec.js → ebnfDiagram-BXEA7PRR-BlRDglJm.js} +4 -4
  51. package/dist/component/{erDiagram-JOGREHBK-DLJCjcXM.js → erDiagram-JOGREHBK-BgHUzm41.js} +5 -5
  52. package/dist/component/{flowDiagram-UKHOOZJN-BZfBucKB.js → flowDiagram-UKHOOZJN-Cf42sXVK.js} +7 -7
  53. package/dist/component/{ganttDiagram-PKOTCBZU-CxTHmusv.js → ganttDiagram-PKOTCBZU-Bqai8Nqw.js} +3 -3
  54. package/dist/component/{gitGraphDiagram-DS77QQ5N-B_dWXxMf.js → gitGraphDiagram-DS77QQ5N-M6yX_E4b.js} +4 -4
  55. package/dist/component/{highlighted-body-OFNGDK62-CQ1ZdhQ-.js → highlighted-body-OFNGDK62-C2rmuXAs.js} +2 -2
  56. package/dist/component/index.js +2 -2
  57. package/dist/component/{infoDiagram-6WML65LV-P4GO-aVw.js → infoDiagram-6WML65LV-Bk4qDfY4.js} +2 -2
  58. package/dist/component/{ishikawaDiagram-WSZJBQD7-BMXMrxKI.js → ishikawaDiagram-WSZJBQD7-CQ0-i0XP.js} +2 -2
  59. package/dist/component/{journeyDiagram-NVQOT4AX-DPdTmxkF.js → journeyDiagram-NVQOT4AX-CK9lX22d.js} +5 -5
  60. package/dist/component/{kanban-definition-27J2QSJJ-sYw64NrE.js → kanban-definition-27J2QSJJ-CrIKfzfe.js} +3 -3
  61. package/dist/component/{linear-DYjDg3gl.js → linear-CzN3Xd3g.js} +2 -2
  62. package/dist/component/{mermaid-GHXKKRXX-DfdCmrs3.js → mermaid-GHXKKRXX-B-ea5OKA.js} +116618 -105206
  63. package/dist/component/{mindmap-definition-FAOFIHXS-UkAbrucA.js → mindmap-definition-FAOFIHXS-DUDsEObz.js} +4 -4
  64. package/dist/component/{pegDiagram-VL7TDLO6-BGab1it6.js → pegDiagram-VL7TDLO6-DFJ-rOLH.js} +4 -4
  65. package/dist/component/{pieDiagram-7S7Q4E2Y-BnY70Pr-.js → pieDiagram-7S7Q4E2Y-OwliOUdN.js} +4 -4
  66. package/dist/component/{quadrantDiagram-CIZ2JOQS-Cv1bjdQb.js → quadrantDiagram-CIZ2JOQS-CLKxzqPi.js} +3 -3
  67. package/dist/component/{railroadDiagram-AXF67PYL-DJhLbGB_.js → railroadDiagram-AXF67PYL-_jBOX7-D.js} +4 -4
  68. package/dist/component/{requirementDiagram-LRYGKXZP-CLW3CgbU.js → requirementDiagram-LRYGKXZP-CxfMaDPH.js} +4 -4
  69. package/dist/component/{sankeyDiagram-W5VNT64P-vnapx0yf.js → sankeyDiagram-W5VNT64P-D-qOUzh7.js} +2 -2
  70. package/dist/component/{sequenceDiagram-SI44F4Z6-I43iQsY0.js → sequenceDiagram-SI44F4Z6-B57h29Ae.js} +4 -4
  71. package/dist/component/{sizeCapture-X5ZJPWSS-D9LGwwwC.js → sizeCapture-X5ZJPWSS-DlIoKfk1.js} +2 -2
  72. package/dist/component/snapdom-DkzCA8S0.js +7061 -0
  73. package/dist/component/{stateDiagram-OKZ733FA-BXejMYGk.js → stateDiagram-OKZ733FA-CNNoDNwB.js} +3 -3
  74. package/dist/component/{stateDiagram-v2-UEYNNEHI-BP05TJSl.js → stateDiagram-v2-UEYNNEHI-xYjW9R-s.js} +3 -3
  75. package/dist/component/{swimlanes-SLNWSIFB-CfmDVYhs.js → swimlanes-SLNWSIFB-Chjr6NCU.js} +4 -4
  76. package/dist/component/{swimlanesDiagram-ULZ7WXOC-DfjQBUfV.js → swimlanesDiagram-ULZ7WXOC-A9mWwnCX.js} +3 -3
  77. package/dist/component/{timeline-definition-Z64GVDOM-C0BwzTs3.js → timeline-definition-Z64GVDOM-DldyCd1l.js} +3 -3
  78. package/dist/component/{vennDiagram-T6HMQDX7-CRf8sGBL.js → vennDiagram-T6HMQDX7-BGfiPWG2.js} +2 -2
  79. package/dist/component/{wardleyDiagram-T6FBY63Y-C2h7TQ4a.js → wardleyDiagram-T6FBY63Y-Bzn9DJ27.js} +3 -3
  80. package/dist/component/{xychartDiagram-ELKLHX3M-CBcAwmdF.js → xychartDiagram-ELKLHX3M-nMaNgT12.js} +3 -3
  81. package/dist/components/ai-elements/message.d.ts +2 -2
  82. package/dist/components/ai-elements/prompt-input.d.ts +3 -1
  83. package/dist/components/ai-elements/task.d.ts +2 -1
  84. package/dist/components/ai-elements/terminal-task.d.ts +2 -1
  85. package/dist/components/connectors/portal-theme.d.ts +2 -8
  86. package/dist/components/embed/AgentChatIcon.d.ts +1 -1
  87. package/dist/components/embed/AgentPhaseIcon.d.ts +16 -14
  88. package/dist/components/embed/ApiKeysSettings.d.ts +1 -0
  89. package/dist/components/embed/BetaBadge.d.ts +8 -10
  90. package/dist/components/embed/ComposerContext.d.ts +9 -0
  91. package/dist/components/embed/EmbedAvatar.d.ts +19 -18
  92. package/dist/components/embed/EmbedComposer.d.ts +13 -1
  93. package/dist/components/embed/EmbedHeader.d.ts +13 -30
  94. package/dist/components/embed/EmbedRail.d.ts +29 -10
  95. package/dist/components/embed/EmbedSessions.d.ts +10 -12
  96. package/dist/components/embed/GoalActions.d.ts +15 -0
  97. package/dist/components/embed/GoalBadge.d.ts +17 -0
  98. package/dist/components/embed/GoalClearDialog.d.ts +6 -0
  99. package/dist/components/embed/GoalClearedLine.d.ts +3 -0
  100. package/dist/components/embed/GoalCompletionCard.d.ts +12 -0
  101. package/dist/components/embed/GoalComposeSheet.d.ts +20 -0
  102. package/dist/components/embed/GoalProposalCard.d.ts +29 -0
  103. package/dist/components/embed/GoalRailView.d.ts +15 -0
  104. package/dist/components/embed/GoalRefusalCard.d.ts +22 -0
  105. package/dist/components/embed/GoalSetCard.d.ts +5 -0
  106. package/dist/components/embed/GoalSnoozeMenu.d.ts +14 -0
  107. package/dist/components/embed/GoalStatusRow.d.ts +6 -0
  108. package/dist/components/embed/GoalTimeline.d.ts +6 -0
  109. package/dist/components/embed/LegalShortDisclaimer.d.ts +6 -8
  110. package/dist/components/embed/MentionInput.d.ts +9 -3
  111. package/dist/components/embed/MobileNavBar.d.ts +16 -10
  112. package/dist/components/embed/OnboardingOverlay.d.ts +3 -1
  113. package/dist/components/embed/OnboardingTour.d.ts +1 -10
  114. package/dist/components/embed/OnboardingWelcome.d.ts +1 -11
  115. package/dist/components/embed/PlanPanel.d.ts +3 -1
  116. package/dist/components/embed/PreviewPanel.d.ts +3 -1
  117. package/dist/components/embed/QuestionCard.d.ts +12 -1
  118. package/dist/components/embed/ScheduleNotices.d.ts +23 -0
  119. package/dist/components/embed/SentAsGoalTag.d.ts +1 -0
  120. package/dist/components/embed/SessionSwitcher.d.ts +12 -0
  121. package/dist/components/embed/SubagentAvatar.d.ts +8 -0
  122. package/dist/components/embed/SubagentsPaneBody.d.ts +3 -0
  123. package/dist/components/embed/WorkspacePane.d.ts +3 -1
  124. package/dist/components/embed/navigation-layout.d.ts +7 -0
  125. package/dist/components/embed/rail-flags.d.ts +6 -0
  126. package/dist/components/embed/use-prompt-invocations.d.ts +6 -1
  127. package/dist/components/feedback/IssueReportController.d.ts +1 -0
  128. package/dist/components/feedback/IssueReportDialog.d.ts +6 -0
  129. package/dist/components/prompts/PromptPreviewDialog.d.ts +10 -0
  130. package/dist/components/prompts/PromptsListSurface.d.ts +4 -4
  131. package/dist/components/scheduled/ConfirmDeleteScheduleDialog.d.ts +1 -0
  132. package/dist/components/scheduled/ScheduleDialog.d.ts +4 -0
  133. package/dist/components/scheduled/ScheduledDetailSurface.d.ts +1 -0
  134. package/dist/components/scheduled/ScheduledHeader.d.ts +3 -0
  135. package/dist/components/scheduled/ScheduledListSurface.d.ts +1 -1
  136. package/dist/components/scheduled/ShareScheduleDialog.d.ts +10 -0
  137. package/dist/components/scheduled/SharedSchedulesSurface.d.ts +1 -0
  138. package/dist/components/scheduled/schedule-dialog-model.d.ts +5 -2
  139. package/dist/components/skills/ConfirmDeleteSkillDialog.d.ts +9 -0
  140. package/dist/components/skills/SkillDiscover.d.ts +1 -0
  141. package/dist/components/skills/SkillLibraryToolSync.d.ts +4 -0
  142. package/dist/components/skills/SkillsListSurface.d.ts +29 -0
  143. package/dist/components/skills/UploadSkillDialog.d.ts +32 -0
  144. package/dist/components/skills/skill-archive-file.d.ts +15 -0
  145. package/dist/components/ui/card.d.ts +1 -1
  146. package/dist/components/ui/dialog.d.ts +1 -1
  147. package/dist/components/ui/dropdown-menu.d.ts +2 -2
  148. package/dist/components/ui/hover-card.d.ts +1 -1
  149. package/dist/components/ui/popover.d.ts +1 -1
  150. package/dist/components/ui/select.d.ts +1 -1
  151. package/dist/components/ui/shadow-dialog-focus.d.ts +5 -0
  152. package/dist/components/ui/tooltip.d.ts +1 -1
  153. package/dist/embed/brand-marks.d.ts +3 -3
  154. package/dist/embed/client-error-log.d.ts +72 -0
  155. package/dist/embed/copy.d.ts +8 -2
  156. package/dist/embed/dock-open-request.d.ts +32 -0
  157. package/dist/embed/dock-state.d.ts +1 -1
  158. package/dist/embed/goal-actions-model.d.ts +9 -0
  159. package/dist/embed/goal-cap-notice.d.ts +36 -0
  160. package/dist/embed/goal-deep-link.d.ts +24 -0
  161. package/dist/embed/goal-edit-command.d.ts +25 -0
  162. package/dist/embed/goal-journal.d.ts +53 -0
  163. package/dist/embed/goal-live-status.d.ts +2 -0
  164. package/dist/embed/goal-plain-units.d.ts +35 -0
  165. package/dist/embed/goal-progress.d.ts +15 -0
  166. package/dist/embed/goal-proposal-dismissal.d.ts +11 -0
  167. package/dist/embed/goal-resume-time.d.ts +22 -0
  168. package/dist/embed/goal-row-model.d.ts +27 -0
  169. package/dist/embed/goal-runway.d.ts +5 -0
  170. package/dist/embed/goal-schedule-handoff.d.ts +12 -0
  171. package/dist/embed/goal-status-label.d.ts +3 -0
  172. package/dist/embed/goal-time-usage.d.ts +19 -0
  173. package/dist/embed/issue-report-bus.d.ts +14 -0
  174. package/dist/embed/issue-report-open.d.ts +8 -0
  175. package/dist/embed/issue-report.d.ts +41 -0
  176. package/dist/embed/legal-disclaimer.d.ts +5 -1
  177. package/dist/embed/library-composer.d.ts +24 -0
  178. package/dist/embed/library-navigation.d.ts +6 -0
  179. package/dist/embed/portal-container.d.ts +17 -16
  180. package/dist/embed/presets.d.ts +2 -2
  181. package/dist/embed/schedule-invitation.d.ts +5 -0
  182. package/dist/embed/screen-capture.d.ts +74 -0
  183. package/dist/embed/slash-commands.d.ts +24 -0
  184. package/dist/embed/task-schedule-command.d.ts +7 -0
  185. package/dist/embed/use-session-draft.d.ts +11 -0
  186. package/dist/i18n/messages/en.d.ts +599 -4
  187. package/dist/i18n/messages/surfaces/feedback.d.ts +84 -0
  188. package/dist/i18n/messages/surfaces/files.d.ts +4 -0
  189. package/dist/i18n/messages/surfaces/header.d.ts +20 -0
  190. package/dist/i18n/messages/surfaces/navigation.d.ts +149 -0
  191. package/dist/i18n/messages/surfaces/prompts.d.ts +56 -5
  192. package/dist/i18n/messages/surfaces/scheduled.d.ts +233 -1
  193. package/dist/i18n/messages/surfaces/sessions.d.ts +16 -0
  194. package/dist/i18n/messages/surfaces/settings.d.ts +229 -0
  195. package/dist/i18n/messages/surfaces/skills.d.ts +299 -0
  196. package/dist/i18n/messages/surfaces/stream.d.ts +232 -0
  197. package/dist/i18n/messages/surfaces/usage.d.ts +56 -0
  198. package/dist/i18n/messages/surfaces/workspace.d.ts +20 -0
  199. package/dist/public-api.d.ts +1 -1
  200. package/dist/routes/chat/part-renderer-extra-props.d.ts +43 -0
  201. package/dist/routes/chat/use-goal-receipt.d.ts +37 -0
  202. package/dist/routes/chat/use-host-draft-request.d.ts +2 -0
  203. package/dist/routes/chat/use-session-goal.d.ts +227 -0
  204. package/dist/routes/chat.d.ts +11 -1
  205. package/dist/routes/goal.d.ts +1 -0
  206. package/dist/routes/library.d.ts +4 -0
  207. package/dist/routes/skills.d.ts +2 -0
  208. package/dist/stream/activity-items.d.ts +25 -0
  209. package/dist/stream/ai-sdk-part-renderers.d.ts +67 -32
  210. package/dist/stream/belong-chat-transport.d.ts +157 -2
  211. package/dist/stream/belong-data-parts.d.ts +56 -6
  212. package/dist/stream/goal-store.d.ts +43 -0
  213. package/dist/stream/message-metadata.d.ts +1 -0
  214. package/dist/stream/message-parts.d.ts +42 -0
  215. package/dist/stream/select-goal-set-part-id.d.ts +2 -0
  216. package/dist/stream/select-latest-goal.d.ts +13 -0
  217. package/dist/stream/subagent-controls-store.d.ts +20 -0
  218. package/dist/stream/subagent-lanes-model.d.ts +175 -0
  219. package/dist/stream/subagent-lanes.d.ts +90 -0
  220. package/dist/stream/use-publish-subagent-controls.d.ts +11 -0
  221. package/dist/stream/workspace-focus-store.d.ts +7 -1
  222. package/dist/test/render.d.ts +18 -1
  223. package/dist/test/subagent-fixtures.d.ts +24 -0
  224. package/dist/types/public.d.ts +54 -1
  225. package/package.json +1 -1
  226. package/dist/components/ai-elements/reasoning.d.ts +0 -26
@@ -22,9 +22,9 @@ export declare const choiceAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
22
22
  export declare const choiceStateSchema: z.ZodEnum<{
23
23
  detached: "detached";
24
24
  pending: "pending";
25
+ cancelled: "cancelled";
25
26
  dismissed: "dismissed";
26
27
  answered: "answered";
27
- cancelled: "cancelled";
28
28
  }>;
29
29
  /**
30
30
  * The wire/stored part union. Exported so the history loader (chat.tsx) can
@@ -129,6 +129,22 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
129
129
  stepsUsed: z.ZodOptional<z.ZodNumber>;
130
130
  summary: z.ZodOptional<z.ZodString>;
131
131
  timedOut: z.ZodOptional<z.ZodBoolean>;
132
+ outcome: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
133
+ error: "error";
134
+ ok: "ok";
135
+ timeout: "timeout";
136
+ stopped: "stopped";
137
+ stalled: "stalled";
138
+ interrupted: "interrupted";
139
+ }>>>;
140
+ queued: z.ZodOptional<z.ZodBoolean>;
141
+ startedAt: z.ZodOptional<z.ZodString>;
142
+ durationMs: z.ZodOptional<z.ZodNumber>;
143
+ tokensCount: z.ZodOptional<z.ZodNumber>;
144
+ waveId: z.ZodOptional<z.ZodString>;
145
+ groupLabel: z.ZodOptional<z.ZodString>;
146
+ planStepId: z.ZodOptional<z.ZodString>;
147
+ stoppable: z.ZodOptional<z.ZodBoolean>;
132
148
  }, z.core.$strip>;
133
149
  }, z.core.$strip>, z.ZodObject<{
134
150
  type: z.ZodLiteral<"data-sandbox-command">;
@@ -183,6 +199,17 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
183
199
  title: z.ZodString;
184
200
  mimeType: z.ZodString;
185
201
  }, z.core.$strip>;
202
+ }, z.core.$strip>, z.ZodObject<{
203
+ type: z.ZodLiteral<"data-model-activity">;
204
+ id: z.ZodString;
205
+ data: z.ZodObject<{
206
+ state: z.ZodEnum<{
207
+ waiting: "waiting";
208
+ idle: "idle";
209
+ }>;
210
+ stepIndex: z.ZodNumber;
211
+ elapsedMs: z.ZodNumber;
212
+ }, z.core.$strip>;
186
213
  }, z.core.$strip>, z.ZodObject<{
187
214
  type: z.ZodLiteral<"data-status">;
188
215
  id: z.ZodString;
@@ -228,9 +255,9 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
228
255
  state: z.ZodEnum<{
229
256
  detached: "detached";
230
257
  pending: "pending";
258
+ cancelled: "cancelled";
231
259
  dismissed: "dismissed";
232
260
  answered: "answered";
233
- cancelled: "cancelled";
234
261
  }>;
235
262
  questions: z.ZodArray<z.ZodObject<{
236
263
  id: z.ZodString;
@@ -255,6 +282,92 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
255
282
  }, z.core.$strip>], "kind">>>;
256
283
  reply: z.ZodOptional<z.ZodString>;
257
284
  }, z.core.$strip>;
285
+ }, z.core.$strip>, z.ZodObject<{
286
+ type: z.ZodLiteral<"data-goal">;
287
+ id: z.ZodString;
288
+ data: z.ZodObject<{
289
+ goalId: z.ZodString;
290
+ status: z.ZodEnum<{
291
+ active: "active";
292
+ paused: "paused";
293
+ clarifying: "clarifying";
294
+ completion_claimed: "completion_claimed";
295
+ deferred: "deferred";
296
+ waiting_for_user: "waiting_for_user";
297
+ waiting_for_approval: "waiting_for_approval";
298
+ waiting_for_ui_action: "waiting_for_ui_action";
299
+ blocked: "blocked";
300
+ budget_limited: "budget_limited";
301
+ complete: "complete";
302
+ cleared: "cleared";
303
+ }>;
304
+ statusReason: z.ZodNullable<z.ZodString>;
305
+ objective: z.ZodString;
306
+ successCriteria: z.ZodArray<z.ZodObject<{
307
+ id: z.ZodString;
308
+ text: z.ZodString;
309
+ status: z.ZodEnum<{
310
+ open: "open";
311
+ met: "met";
312
+ }>;
313
+ evidence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
314
+ }, z.core.$strip>>;
315
+ constraints: z.ZodArray<z.ZodString>;
316
+ tokensUsed: z.ZodNumber;
317
+ tokenBudget: z.ZodNumber;
318
+ turnsUsed: z.ZodNumber;
319
+ maxTurns: z.ZodNumber;
320
+ activeSeconds: z.ZodNumber;
321
+ maxActiveSeconds: z.ZodNumber;
322
+ lastProgressNote: z.ZodNullable<z.ZodString>;
323
+ updatedAt: z.ZodString;
324
+ startedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
325
+ originatingClientMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
326
+ clarifyMaxQuestions: z.ZodOptional<z.ZodNumber>;
327
+ judgeFeedback: z.ZodOptional<z.ZodNullable<z.ZodString>>;
328
+ judgeRejections: z.ZodOptional<z.ZodNumber>;
329
+ clarifyingTurns: z.ZodOptional<z.ZodNumber>;
330
+ resumeAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
331
+ journal: z.ZodOptional<z.ZodArray<z.ZodObject<{
332
+ seq: z.ZodNumber;
333
+ kind: z.ZodString;
334
+ actor: z.ZodString;
335
+ toStatus: z.ZodNullable<z.ZodEnum<{
336
+ active: "active";
337
+ paused: "paused";
338
+ clarifying: "clarifying";
339
+ completion_claimed: "completion_claimed";
340
+ deferred: "deferred";
341
+ waiting_for_user: "waiting_for_user";
342
+ waiting_for_approval: "waiting_for_approval";
343
+ waiting_for_ui_action: "waiting_for_ui_action";
344
+ blocked: "blocked";
345
+ budget_limited: "budget_limited";
346
+ complete: "complete";
347
+ cleared: "cleared";
348
+ }>>;
349
+ note: z.ZodNullable<z.ZodString>;
350
+ at: z.ZodString;
351
+ }, z.core.$strip>>>;
352
+ runway: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
353
+ quick: "quick";
354
+ normal: "normal";
355
+ long: "long";
356
+ }>>>;
357
+ }, z.core.$strip>;
358
+ }, z.core.$strip>, z.ZodObject<{
359
+ type: z.ZodLiteral<"data-goal-proposal">;
360
+ id: z.ZodString;
361
+ data: z.ZodObject<{
362
+ objective: z.ZodString;
363
+ why: z.ZodString;
364
+ criteria: z.ZodOptional<z.ZodArray<z.ZodString>>;
365
+ runway: z.ZodOptional<z.ZodEnum<{
366
+ quick: "quick";
367
+ normal: "normal";
368
+ long: "long";
369
+ }>>;
370
+ }, z.core.$strip>;
258
371
  }, z.core.$strip>], "type">;
259
372
  /** A request was 401'd twice (once with a freshly re-read token): the host
260
373
  * session is expired — the dock must surface re-auth, not retry forever. */
@@ -262,6 +375,22 @@ export declare const AUTH_EXPIRED_ERROR_PREFIX = "auth_expired:";
262
375
  /** The SSE reconnect loop exhausted its attempt budget without the backend
263
376
  * delivering a single event — the service is unreachable. */
264
377
  export declare const BACKEND_UNAVAILABLE_ERROR_PREFIX = "backend_unavailable:";
378
+ /**
379
+ * `POST /v1/sessions/:id/messages` refused the send. Carries the raw status
380
+ * + body — the same shape as `AttachmentUploadError`'s precedent
381
+ * (`chat-upload.ts`) — so a caller can recognize a SPECIFIC refusal (e.g. the
382
+ * goal-cap 429s, `goal_cap_user` / `goal_cap_tenant`) instead of pattern-
383
+ * matching the thrown `Error`'s message string. Deviation 11: this is the
384
+ * minimum honest channel — the send path had no error surface at all before
385
+ * this, so `goal_exists` and the new caps were previously invisible in the
386
+ * dock. The message text is unchanged from the plain `Error` this replaces,
387
+ * so every existing `.rejects.toThrow(...)` assertion still passes.
388
+ */
389
+ export declare class PostMessageError extends Error {
390
+ readonly status: number;
391
+ readonly body: string;
392
+ constructor(status: number, body: string);
393
+ }
265
394
  /** First reconnect delay — identical to the historic fixed delay, so the
266
395
  * BEL-48 mid-run clean-EOF reconnect regains the stream just as fast. */
267
396
  export declare const RECONNECT_BASE_DELAY_MS = 1000;
@@ -336,6 +465,10 @@ export type BelongChatTransportOptions = {
336
465
  readonly foregroundGeneration?: number;
337
466
  };
338
467
  export type StreamContext = {
468
+ modelActivity?: {
469
+ id: string;
470
+ stepIndex: number;
471
+ };
339
472
  /** Stable id we emit on every `text-delta`. Null when no text run is open. */
340
473
  textRunId: string | null;
341
474
  /**
@@ -391,6 +524,28 @@ export declare class BelongChatTransport implements ChatTransport<BelongUIMessag
391
524
  * best-effort.
392
525
  */
393
526
  cancelRun: (runId: string) => Promise<readonly RecalledQueuedMessage[]>;
527
+ /**
528
+ * Spec 2026-09-16 §1.4/§3.5 — ask belong-cloud to stop ONE subagent of a
529
+ * live run (`POST /v1/runs/:runId/subagents/:subagentId/stop`, 202
530
+ * `{ status: "stop_requested" }`). Modelled on `cancelRun`: same auth
531
+ * headers, same transient retries (the route is idempotent, §18). It changes
532
+ * nothing locally — the lane flips only when the `subagent_finished` part
533
+ * arrives — and the stop is best-effort BY DESIGN (spec §5: the backend
534
+ * swallows delivery failures too), so the dock promises nothing here.
535
+ *
536
+ * The two failure families are deliberately NOT collapsed into one. A 404
537
+ * (`subagent_not_found`, or an API that has not deployed the route yet) and a
538
+ * 409 (`subagent_not_running` — it finished while the user was clicking) are
539
+ * ordinary things that happen to a working product: the lane simply never
540
+ * flips and nothing is said. A 401 is something else entirely — the host
541
+ * session going stale mid-click — so it takes the same §C3 treatment every
542
+ * other authed call in this transport gets: one FORCED token rotation and one
543
+ * retry, which makes a merely stale token still stop the subagent. Only a
544
+ * SECOND 401 is a genuinely expired session, and that is reported as
545
+ * `auth_expired` (the evidence behind the dock's re-auth surface), never as an
546
+ * unaccepted stop.
547
+ */
548
+ stopSubagent: (runId: string, subagentId: string) => Promise<void>;
394
549
  sendMessages: ChatTransport<BelongUIMessage>["sendMessages"];
395
550
  reconnectToStream: ChatTransport<BelongUIMessage>["reconnectToStream"];
396
551
  }
@@ -1,5 +1,7 @@
1
1
  import { UIMessage } from 'ai';
2
2
  import { BelongMessageMetadata } from './message-metadata.ts';
3
+ import { GoalView } from '../api/goals.ts';
4
+ import { GoalRunwayPreset } from '../embed/goal-runway.ts';
3
5
  /**
4
6
  * F2 — per-step execution status. Optional: absent means `pending`
5
7
  * (back-compat with plans proposed before F2 and the initial propose). The
@@ -20,6 +22,11 @@ export type SandboxCommandState = "started" | "output" | "completed" | "failed";
20
22
  export type SandboxStream = "stdout" | "stderr";
21
23
  export type UiActionState = "requested" | "completed" | "failed";
22
24
  export type RunStatusKind = "continuing" | "completed" | "cancelled" | "failed" | "throttled";
25
+ export type ModelActivityData = {
26
+ readonly state: "waiting" | "idle";
27
+ readonly stepIndex: number;
28
+ readonly elapsedMs: number;
29
+ };
23
30
  export type ReasoningData = {
24
31
  readonly delta: string;
25
32
  };
@@ -137,8 +144,8 @@ export type ToolCallData = {
137
144
  /**
138
145
  * BEL-199 — the `data-subagent` part id this call ran INSIDE. Absent on every
139
146
  * main-loop call (and on every part emitted before BEL-199). The expanded
140
- * activity group chips a matching item with a muted "via <name>" —
141
- * attribution, not nesting.
147
+ * activity group nests a matching item under that subagent's lane when the
148
+ * lane is in the same group; otherwise it stays a flat item (§41).
142
149
  */
143
150
  readonly subagentId?: string | undefined;
144
151
  };
@@ -146,15 +153,22 @@ export type ToolCallData = {
146
153
  * BEL-199 — one delegated subagent. `running → finished | failed`, one part per
147
154
  * subagent, reconciled by id like every other lifecycle part.
148
155
  *
149
- * It renders as an ACTIVITY ITEM: one thin line INSIDE the §42 collapsed
150
- * activity line, never a card beside it. A failed subagent carries no
156
+ * It renders as an inspectable ACTIVITY ITEM inside the §42 collapsed
157
+ * activity group, never a card beside it. A failed subagent carries no
151
158
  * `ToolErrorSeverity` — deliberately, so it can never reach the collapsed line:
152
159
  * the parent agent reads the failure in its tool result and recovers, and
153
160
  * surfacing it would read as breakage. Nothing about it is ever red.
154
161
  */
155
162
  export type SubagentState = "running" | "finished" | "failed";
163
+ /**
164
+ * Spec 2026-09-16 §1.2 — how a subagent ended. An optional FIELD beside
165
+ * `state` (never new `state` values: older docks strict-parse that enum). The
166
+ * dock parses it leniently, so a future value degrades to "absent" and the
167
+ * outcome is derived from `state` / `timedOut` instead.
168
+ */
169
+ export type SubagentOutcome = "ok" | "error" | "timeout" | "stopped" | "stalled" | "interrupted";
156
170
  export type SubagentData = {
157
- /** Registry name, e.g. "general-purpose" — the "via <name>" chip's text. */
171
+ /** Registry name, e.g. "general-purpose". Operator vocabulary: never rendered (§42). */
158
172
  readonly name: string;
159
173
  /** The model's own task label; this is what the line shows. */
160
174
  readonly description: string;
@@ -169,6 +183,23 @@ export type SubagentData = {
169
183
  * server prose.
170
184
  */
171
185
  readonly timedOut?: boolean | undefined;
186
+ readonly outcome?: SubagentOutcome | undefined;
187
+ /** Waiting for a concurrency slot; re-emitted without it (same id) once started. */
188
+ readonly queued?: boolean | undefined;
189
+ /** ISO instant the subagent actually started; the elapsed timer's origin (§41). */
190
+ readonly startedAt?: string | undefined;
191
+ /** Integer ms from `startedAt` to finish; 0 when it never left the queue. */
192
+ readonly durationMs?: number | undefined;
193
+ /** Operator-only (insights). The dock never renders token counts (§42). */
194
+ readonly tokensCount?: number | undefined;
195
+ /** Subagents launched together share one wave id. */
196
+ readonly waveId?: string | undefined;
197
+ /** Model-provided name for the wave's work, e.g. "Auditing datasets". */
198
+ readonly groupLabel?: string | undefined;
199
+ /** The single plan step in progress at launch — a wave-label fallback. */
200
+ readonly planStepId?: string | undefined;
201
+ /** Only the own loop can stop a subagent; gates the dock's Stop. Never set once finished. */
202
+ readonly stoppable?: boolean | undefined;
172
203
  };
173
204
  export type SandboxCommandData = {
174
205
  readonly state: SandboxCommandState;
@@ -267,6 +298,20 @@ export type UsageData = {
267
298
  /** The detailed context-window breakdown (own-loop runtimes only). */
268
299
  readonly contextWindow?: ContextWindowData | undefined;
269
300
  };
301
+ /**
302
+ * Goal Mode M6 — a goal the agent OFFERED. Nothing exists on the backend
303
+ * until the user confirms; this part is the offer itself.
304
+ *
305
+ * Task 17 — `criteria`/`runway` are optional so a pre-Task-17 stored part
306
+ * still parses (§4): when present, Start skips the interview the same way
307
+ * the compose sheet's "Done when…" field does.
308
+ */
309
+ export type GoalProposalData = {
310
+ readonly objective: string;
311
+ readonly why: string;
312
+ readonly criteria?: readonly string[] | undefined;
313
+ readonly runway?: GoalRunwayPreset | undefined;
314
+ };
270
315
  /**
271
316
  * Single source of truth for Belong's custom data parts. The record
272
317
  * keys (`reasoning`, `plan`, …) become the part-type suffix:
@@ -274,6 +319,7 @@ export type UsageData = {
274
319
  * `data-reasoning` part.
275
320
  */
276
321
  export type BelongDataParts = {
322
+ "model-activity": ModelActivityData;
277
323
  reasoning: ReasoningData;
278
324
  plan: PlanData;
279
325
  "approval-request": ApprovalRequestData;
@@ -289,6 +335,10 @@ export type BelongDataParts = {
289
335
  status: StatusData;
290
336
  /** F3 — context/cost meter. Additive; absent on old sessions. */
291
337
  usage: UsageData;
338
+ /** Goal Mode M1 — the session's live long-running-goal snapshot. */
339
+ goal: GoalView;
340
+ /** Goal Mode M6 — a goal the agent offered via `propose_goal`. */
341
+ "goal-proposal": GoalProposalData;
292
342
  };
293
343
  /**
294
344
  * The concrete `UIMessage` shape the chat surface and transport speak.
@@ -313,5 +363,5 @@ export type WireDataPart<NAME extends keyof BelongDataParts> = {
313
363
  readonly id: string;
314
364
  readonly data: BelongDataParts[NAME];
315
365
  };
316
- export type WireStreamPart = WireTextPart | WireDataPart<"reasoning"> | WireDataPart<"plan"> | WireDataPart<"approval-request"> | WireDataPart<"choice-request"> | WireDataPart<"tool-call"> | WireDataPart<"subagent"> | WireDataPart<"sandbox-command"> | WireDataPart<"ui-action"> | WireDataPart<"cli-reconnect"> | WireDataPart<"navigation"> | WireDataPart<"artifact"> | WireDataPart<"status"> | WireDataPart<"usage">;
366
+ export type WireStreamPart = WireTextPart | WireDataPart<"model-activity"> | WireDataPart<"reasoning"> | WireDataPart<"plan"> | WireDataPart<"approval-request"> | WireDataPart<"choice-request"> | WireDataPart<"tool-call"> | WireDataPart<"subagent"> | WireDataPart<"sandbox-command"> | WireDataPart<"ui-action"> | WireDataPart<"cli-reconnect"> | WireDataPart<"navigation"> | WireDataPart<"artifact"> | WireDataPart<"status"> | WireDataPart<"usage"> | WireDataPart<"goal"> | WireDataPart<"goal-proposal">;
317
367
  export type WireStreamPartType = WireStreamPart["type"];
@@ -0,0 +1,43 @@
1
+ import { GoalView } from '../api/goals.ts';
2
+ export type GoalState = {
3
+ readonly sessionId: string;
4
+ readonly goal: GoalView;
5
+ } | null;
6
+ /**
7
+ * Whether `next` should replace `current` in the store. Accepts when: the
8
+ * store is empty; `next` is `null` (an explicit clear always wins); the
9
+ * session changed; or `next`'s goal is strictly newer by `updatedAt`.
10
+ *
11
+ * On an EQUAL `updatedAt` several tie-breaks still accept: a higher
12
+ * `turnsUsed`, a different `status`, a different `objective`/`maxTurns`/
13
+ * `tokenBudget`, or a different `tokensUsed`/`activeSeconds`. Postgres stamps
14
+ * `updated_at` per write and the dock's two writers can observe two different
15
+ * rows carrying the same timestamp (a goal turn and its status flip inside
16
+ * one drain iteration, or a timestamp truncated to the same millisecond on
17
+ * the wire); rejecting those pinned the pill to the older of two genuinely
18
+ * different states. The objective/turns/budget tie-break covers `/goal edit`:
19
+ * an edit bumps `updatedAt` but leaves `status` and `turnsUsed` untouched, so
20
+ * without it a same-millisecond edit would be indistinguishable from a no-op
21
+ * and get dropped. The tokensUsed/activeSeconds tie-break covers M3
22
+ * accounting (`recordTurnOutcome`): it writes counters on every turn without
23
+ * necessarily changing `status` or `turnsUsed` (a mid-drain accounting write
24
+ * followed by a same-millisecond read). Only a view equal on all nine —
25
+ * timestamp, turns, status, objective, maxTurns, tokenBudget, tokensUsed,
26
+ * activeSeconds and resumeAt — is rejected as a no-op.
27
+ *
28
+ * The resumeAt tie-break covers M5: a goal deferred again to a NEW time
29
+ * (the backoff doubling) changes neither `status` nor `turnsUsed`, so a
30
+ * same-millisecond republish would otherwise pin the pill to the old time.
31
+ *
32
+ * The journal-length tie-break covers M6: a repo-backed view that appended a
33
+ * History entry (a progress note, a status transition already covered
34
+ * above) without otherwise changing any of the other tie-break fields would
35
+ * be a no-op by the old rule, dropping the fresher History off the panel.
36
+ */
37
+ export declare const isNewerGoalState: (current: GoalState, next: GoalState) => boolean;
38
+ export declare const publishGoalState: (next: GoalState) => void;
39
+ export declare const peekGoalState: () => GoalState;
40
+ export declare const subscribeGoalState: (listener: () => void) => (() => void);
41
+ export declare const useGoalState: () => GoalState;
42
+ export declare const publishGoalFetchSettled: (next: boolean) => void;
43
+ export declare const useGoalFetchSettled: () => boolean;
@@ -11,5 +11,6 @@ export declare const belongMessageMetadataSchema: z.ZodObject<{
11
11
  createdAt: z.ZodOptional<z.ZodString>;
12
12
  skill: z.ZodOptional<z.ZodString>;
13
13
  fromHistory: z.ZodOptional<z.ZodBoolean>;
14
+ clientMessageId: z.ZodOptional<z.ZodString>;
14
15
  }, z.core.$strip>;
15
16
  export type BelongMessageMetadata = z.infer<typeof belongMessageMetadataSchema>;
@@ -0,0 +1,42 @@
1
+ import { BelongMessagePart, PartRendererProps } from './ai-sdk-part-renderers.tsx';
2
+ /**
3
+ * The parts a message is INDEXED from (spec deviation 16). File parts render as
4
+ * chips above the message and never reach a render group, and dropping one
5
+ * shifts every later group's key — so the chat here and the fullscreen pane
6
+ * (`collectSubagentWaves`) must drop them the same way, or the two would draw
7
+ * the same message's lanes with different step keys.
8
+ *
9
+ * Idempotent: ChatRoute already filters before it renders, and filtering twice
10
+ * is the same list.
11
+ */
12
+ export declare const indexableMessageParts: (parts: readonly BelongMessagePart[]) => readonly BelongMessagePart[];
13
+ export declare const MessageParts: ({ parts, streaming, historical, onContinueConnector, onExecutePlan, onFollowContinuation, partProps, }: {
14
+ /** The message's parts, file parts already removed (they render as chips). */
15
+ readonly parts: readonly BelongMessagePart[];
16
+ /** This message is the one a run is streaming into right now. */
17
+ readonly streaming: boolean;
18
+ /**
19
+ * Restored history must render settled, never re-fire the dispatch
20
+ * renderers' one-shot side effects (reconnect grant mint, host navigation,
21
+ * ui-action result POST).
22
+ */
23
+ readonly historical: boolean;
24
+ readonly onContinueConnector?: PartRendererProps["onContinueConnector"];
25
+ /** The plan card's "Run this plan" CTA — omitted while a run streams. */
26
+ readonly onExecutePlan?: PartRendererProps["onExecutePlan"];
27
+ /**
28
+ * An agent-raised plan card's decision: the server posts it as the user's
29
+ * message and names the turn it started, which the chat must then follow
30
+ * live. Without it the card settles and the run it began never appears.
31
+ */
32
+ readonly onFollowContinuation?: PartRendererProps["onFollowContinuation"];
33
+ /**
34
+ * Extra `PartRenderer` props computed PER PART — the goal surfaces' wiring
35
+ * (`routes/chat/part-renderer-extra-props.ts`), whose `renderGoalSetCard`
36
+ * gate depends on the specific part's id, so it cannot be hoisted to one
37
+ * value per message. Spread AFTER the props above, so a caller that routes
38
+ * `onContinueConnector` / `onExecutePlan` through here rather than through
39
+ * the named props still wins. Absent = no goal wiring (stories, tests).
40
+ */
41
+ readonly partProps?: ((part: BelongMessagePart) => Partial<PartRendererProps>) | undefined;
42
+ }) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { BelongUIMessage } from './belong-data-parts.ts';
2
+ export declare const selectGoalSetPartIds: (messages: readonly BelongUIMessage[]) => ReadonlySet<string>;
@@ -0,0 +1,13 @@
1
+ import { BelongUIMessage } from './belong-data-parts.ts';
2
+ import { GoalView } from '../api/goals.ts';
3
+ export declare const selectLatestGoal: (messages: readonly BelongUIMessage[]) => GoalView | null;
4
+ /**
5
+ * Task 13 — the completion card's cue for whether "Get the files" has
6
+ * anything to show: every `file` (user attachment) or `data-artifact`
7
+ * (agent-published) part across the WHOLE session, not just the goal's own
8
+ * turns — the objective can reference something attached earlier in the same
9
+ * conversation. Counts part instances rather than deduping by id, so a
10
+ * re-emitted historical part only ever makes the button MORE likely to show,
11
+ * never hides files that were actually produced.
12
+ */
13
+ export declare const countSessionFiles: (messages: readonly BelongUIMessage[]) => number;
@@ -0,0 +1,20 @@
1
+ import { SubagentLane } from './subagent-lanes-model.ts';
2
+ export type PublishedSubagentWave = {
3
+ readonly waveId: string;
4
+ /** Arrival order; readers sort with `orderLanes`. */
5
+ readonly lanes: readonly SubagentLane[];
6
+ /** In the last message while a run is active — the only time Stop applies. */
7
+ readonly live: boolean;
8
+ };
9
+ export type SubagentControlsState = {
10
+ /** The active run of this chat, or null when none (Stop hides). */
11
+ readonly runId: string | null;
12
+ readonly stop: (subagentId: string) => Promise<void>;
13
+ /** Stops every stoppable running or queued lane of the wave, in parallel (§15). */
14
+ readonly stopAll: (waveId: string) => Promise<void>;
15
+ readonly waves: readonly PublishedSubagentWave[];
16
+ };
17
+ export declare const publishSubagentControls: (next: SubagentControlsState | null) => void;
18
+ export declare const peekSubagentControls: () => SubagentControlsState | null;
19
+ export declare const useSubagentControls: () => SubagentControlsState | null;
20
+ export declare const findPublishedWave: (controls: SubagentControlsState | null, waveId: string) => PublishedSubagentWave | undefined;
@@ -0,0 +1,175 @@
1
+ import { ActivityItem, ToolActivityItem } from './activity-items.ts';
2
+ import { ApprovalState, BelongUIMessage, PlanData, SubagentData } from './belong-data-parts.ts';
3
+ /** A lane's state: the two in-flight states plus every §1.2 outcome. */
4
+ export type SubagentLaneStatus = "queued" | "running" | "ok" | "error" | "timeout" | "stalled" | "stopped" | "interrupted";
5
+ /** §3.3 colour column: accent while running, orange when it ended badly, else neutral. */
6
+ export type SubagentLaneTone = "active" | "notice" | "quiet";
7
+ /** §3.3 + §4a — what a lane's subline says; running and ok lanes say nothing of their own. */
8
+ export type SubagentLaneSubline = "waiting" | Exclude<SubagentLaneStatus, "running" | "ok">;
9
+ type SubagentLaneStep = {
10
+ /**
11
+ * `<group key>:item-<index in that group>` — unique across the message (a
12
+ * lane's steps can come from several groups) and stable as the stream
13
+ * appends, so a step never remounts.
14
+ */
15
+ readonly key: string;
16
+ readonly item: ToolActivityItem;
17
+ };
18
+ export type SubagentLane = {
19
+ readonly subagentId: string;
20
+ readonly data: SubagentData;
21
+ readonly status: SubagentLaneStatus;
22
+ /** §4a — an approval this subagent raised is still pending in its message. */
23
+ readonly waiting: boolean;
24
+ readonly steps: readonly SubagentLaneStep[];
25
+ };
26
+ /**
27
+ * One render group of a message, the shape `groupMessageParts` returns —
28
+ * restated structurally so this model never imports the renderers file
29
+ * (depcruise counts type-only imports, and the renderers import this file).
30
+ */
31
+ export type SubagentIndexGroup = {
32
+ readonly kind: "activity";
33
+ readonly key: string;
34
+ readonly items: readonly ActivityItem[];
35
+ } | {
36
+ readonly kind: "part";
37
+ readonly key: string;
38
+ readonly part: BelongUIMessage["parts"][number];
39
+ };
40
+ /** §4a — what every lane needs to know about ITS message, computed once per message. */
41
+ export type SubagentMessageIndex = {
42
+ /** subagentId → its lane: steps from every group, `waiting` from every approval card. */
43
+ readonly lanesById: ReadonlyMap<string, SubagentLane>;
44
+ /** waveId → its lanes, in arrival order across every group. */
45
+ readonly lanesByWaveId: ReadonlyMap<string, readonly SubagentLane[]>;
46
+ };
47
+ /**
48
+ * What a group's lanes read from the message around them. `live` is the
49
+ * MESSAGE's liveness (it is the one a run streams into), not the group's: an
50
+ * approval or question card after the lanes makes their group non-last while
51
+ * the subagents still run, and their timers and Stop must not vanish then.
52
+ */
53
+ export type SubagentLanesContext = {
54
+ readonly index: SubagentMessageIndex;
55
+ readonly live: boolean;
56
+ };
57
+ export type SubagentActivityEntry = {
58
+ readonly kind: "tool";
59
+ readonly key: string;
60
+ readonly item: ToolActivityItem;
61
+ } | {
62
+ readonly kind: "lane";
63
+ readonly key: string;
64
+ readonly lane: SubagentLane;
65
+ } | {
66
+ readonly kind: "wave";
67
+ readonly key: string;
68
+ readonly waveId: string;
69
+ /** Arrival order across the message. `orderLanes` sorts for display. */
70
+ readonly lanes: readonly SubagentLane[];
71
+ };
72
+ export type SubagentWaveCounts = {
73
+ readonly total: number;
74
+ /** `ok` */
75
+ readonly done: number;
76
+ readonly running: number;
77
+ readonly queued: number;
78
+ /** `error`, `timeout`, `stalled` */
79
+ readonly needsLook: number;
80
+ readonly stopped: number;
81
+ /** Every lane no longer running or queued (the meter's numerator). */
82
+ readonly ended: number;
83
+ };
84
+ export type SubagentWaveLabel = {
85
+ readonly kind: "text";
86
+ readonly text: string;
87
+ } | {
88
+ /**
89
+ * No label anywhere: the renderer words the wave itself. It needs both
90
+ * numbers, because "{{count}} running" is a STATE CLAIM — an unlabelled
91
+ * wave whose lanes have all ended must read its progress instead (§42).
92
+ */
93
+ readonly kind: "count";
94
+ readonly count: number;
95
+ /** `ok` lanes. */
96
+ readonly done: number;
97
+ readonly running: number;
98
+ };
99
+ /**
100
+ * §3.3 — the lane's state. `outcome` wins when present; an OLD part without it
101
+ * derives one: `finished` → ok, `failed` + `timedOut` → timeout, `failed` → error.
102
+ */
103
+ export declare const subagentLaneStatus: (data: SubagentData) => SubagentLaneStatus;
104
+ export declare const subagentLaneTone: (status: SubagentLaneStatus) => SubagentLaneTone;
105
+ /**
106
+ * §4a — an approval card still waiting for a decision. The WIRE half of
107
+ * `ApprovalRenderer`'s own reading: `approved`, `rejected`, `amend_requested`
108
+ * and `expired` settle the card; only `pending` keeps it armed. (The card also
109
+ * settles on the viewer's own click before the wire catches up; a lane follows
110
+ * the wire, so the two agree once `approval_state_changed` lands, and after any
111
+ * reload.)
112
+ */
113
+ export declare const isApprovalPending: (state: ApprovalState) => boolean;
114
+ /**
115
+ * §3.3 + §4a — a running lane is silent unless an approval it raised is pending
116
+ * ("Waiting for you"); an ok lane is silent; every other state names itself. An
117
+ * ENDED lane never reads "waiting": its approval settled or went with it.
118
+ */
119
+ export declare const laneSubline: (status: SubagentLaneStatus, waiting: boolean) => SubagentLaneSubline | null;
120
+ /**
121
+ * §4a — read ONE message's groups once: every lane with its steps and wait, every wave.
122
+ *
123
+ * Known gap (spec deviation 15, a BACKEND defect the dock must not work around):
124
+ * when the executor's approval dedupe join binds two sibling subagents to one
125
+ * approval row, the joining seat re-emits the card under ITS OWN `subagentId`.
126
+ * The earlier sibling — still blocked on the same human — therefore loses its
127
+ * "Waiting for you" here, because the dock has no wire signal for the join.
128
+ */
129
+ export declare const indexMessageSubagents: (groups: readonly SubagentIndexGroup[]) => SubagentMessageIndex;
130
+ /**
131
+ * Lay ONE group out against its message's index. Without an `index` the items
132
+ * are treated as a whole message of their own (a story, a unit test, a pane).
133
+ */
134
+ export declare const partitionActivityItems: (items: readonly ActivityItem[], index?: SubagentMessageIndex) => readonly SubagentActivityEntry[];
135
+ /**
136
+ * §3.2 — running (earliest `startedAt` first), then queued, then ended badly,
137
+ * then interrupted, then ok. Ties keep first appearance.
138
+ */
139
+ export declare const orderLanes: (lanes: readonly SubagentLane[]) => readonly SubagentLane[];
140
+ export declare const capLanes: (lanes: readonly SubagentLane[], showAll: boolean) => {
141
+ readonly visible: readonly SubagentLane[];
142
+ readonly hiddenCount: number;
143
+ };
144
+ export declare const waveCounts: (lanes: readonly SubagentLane[]) => SubagentWaveCounts;
145
+ /** Integer percent for the wave meter: ended / total. */
146
+ export declare const waveMeterPercent: (counts: SubagentWaveCounts) => number;
147
+ /**
148
+ * §3.2 — the first non-blank `groupLabel` (arrival order), else the title of
149
+ * the plan step a lane names, else the counts the renderer words (how many
150
+ * still run decides WHICH wording it may honestly use).
151
+ */
152
+ export declare const waveLabel: (lanes: readonly SubagentLane[], plan: PlanData | null) => SubagentWaveLabel;
153
+ /** §3.3 — the collapsed line's progress: how many subagents, how many are `ok`. */
154
+ export declare const subagentProgress: (items: readonly ActivityItem[]) => {
155
+ readonly count: number;
156
+ readonly done: number;
157
+ };
158
+ /**
159
+ * §3.4 — `m:ss` (`h:mm:ss` from one hour). Running: `nowMs − startedAt`, and
160
+ * only while live (a crashed run's reloaded `running` part must not count up
161
+ * forever). Ended: `durationMs`. No `startedAt` → no timer.
162
+ */
163
+ export declare const laneElapsedLabel: (input: {
164
+ readonly data: SubagentData;
165
+ readonly status: SubagentLaneStatus;
166
+ readonly live: boolean;
167
+ readonly nowMs: number;
168
+ }) => string | null;
169
+ /** Still in flight — the only states Stop applies to. */
170
+ export declare const isLaneInFlight: (status: SubagentLaneStatus) => boolean;
171
+ /** §3.6 — the fullscreen pane's filters. "running" includes queued lanes (still in flight). */
172
+ export type SubagentPaneFilter = "all" | "running" | "attention" | "done";
173
+ export declare const SUBAGENT_PANE_FILTERS: readonly SubagentPaneFilter[];
174
+ export declare const laneMatchesFilter: (status: SubagentLaneStatus, filter: SubagentPaneFilter) => boolean;
175
+ export {};