@belonguniverseai/react-sdk 0.6.24 → 0.6.25

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 (87) hide show
  1. package/dist/api/client.d.ts +98 -0
  2. package/dist/api/query-keys.d.ts +11 -0
  3. package/dist/component/{abnfDiagram-N423BO3Z-BZFjrvGh.js → abnfDiagram-N423BO3Z-D7OrqwMe.js} +4 -4
  4. package/dist/component/{arc-R371iLQK.js → arc-CZN7i2F-.js} +2 -2
  5. package/dist/component/{architectureDiagram-T3A2C74G-CcH5CU8G.js → architectureDiagram-T3A2C74G-CVX4aJSk.js} +3 -3
  6. package/dist/component/{blockDiagram-VBNYF7ZC-CO21oaME.js → blockDiagram-VBNYF7ZC-DrT23ReK.js} +4 -4
  7. package/dist/component/{c4Diagram-5PPSVZJV-DFdczxGA.js → c4Diagram-5PPSVZJV-yA6JuHOr.js} +3 -3
  8. package/dist/component/{channel-CTk2u27P.js → channel-vZcyyovp.js} +2 -2
  9. package/dist/component/{chunk-2GRJ4B5K-DLJBmRlE.js → chunk-2GRJ4B5K-C5DL0bNM.js} +2 -2
  10. package/dist/component/{chunk-2Q5K7J3B-Dn9FHNcv.js → chunk-2Q5K7J3B-B5BiYW__.js} +2 -2
  11. package/dist/component/{chunk-5RXB4S5H-C0lJsrjg.js → chunk-5RXB4S5H-wnHQNeJ5.js} +5 -5
  12. package/dist/component/{chunk-5VM5RSS4-DphP3gZj.js → chunk-5VM5RSS4-CdjvYb3M.js} +2 -2
  13. package/dist/component/{chunk-6Q2QTUOP-oYZ6WlsT.js → chunk-6Q2QTUOP-CNSvyjis.js} +2 -2
  14. package/dist/component/{chunk-GF5L2VYU-CX1jApqq.js → chunk-GF5L2VYU-D7BI1tvK.js} +6 -6
  15. package/dist/component/{chunk-JWPE2WC7-BsHiqT8c.js → chunk-JWPE2WC7-CeLQPuLU.js} +2 -2
  16. package/dist/component/{chunk-KBJHAD2P-JEN3NVHE.js → chunk-KBJHAD2P-DgAf9tRz.js} +2 -2
  17. package/dist/component/{chunk-RYQCIY6F-BJlZTS0d.js → chunk-RYQCIY6F-DjFej6-h.js} +2 -2
  18. package/dist/component/{chunk-XXDRQBXY-CftGkCaP.js → chunk-XXDRQBXY-CkNxuLox.js} +2 -2
  19. package/dist/component/{classDiagram-JCYQIIEL-BEAw2s9m.js → classDiagram-JCYQIIEL-TyORp-Xl.js} +3 -3
  20. package/dist/component/{classDiagram-v2-OCEON4UE-BEAw2s9m.js → classDiagram-v2-OCEON4UE-TyORp-Xl.js} +3 -3
  21. package/dist/component/{cose-bilkent-JH36ORCC-5g5ZQ1kH.js → cose-bilkent-JH36ORCC-C_lOBXUY.js} +2 -2
  22. package/dist/component/{cynefinDiagram-MW4NZA55-C0wLlDn3.js → cynefinDiagram-MW4NZA55-DqMIe0ZV.js} +3 -3
  23. package/dist/component/{dagre-VZM6K2ZE-V9qiC6Cs.js → dagre-VZM6K2ZE-B3HtBfbf.js} +3 -3
  24. package/dist/component/{diagram-7IWD3JNH-D-KPwOWp.js → diagram-7IWD3JNH-1uYIe-Fx.js} +4 -4
  25. package/dist/component/{diagram-B4RE2ZJO-CMiB6Lwu.js → diagram-B4RE2ZJO-DLvDbgTV.js} +3 -3
  26. package/dist/component/{diagram-LBJQPF4R-ve7EbpGW.js → diagram-LBJQPF4R-CdaGcjGt.js} +3 -3
  27. package/dist/component/{diagram-Q27KOJAE-DRINzJd4.js → diagram-Q27KOJAE-u24QPtAZ.js} +4 -4
  28. package/dist/component/{diagram-UB23O5K3-CL0SSPI6.js → diagram-UB23O5K3-D0YnNMp3.js} +3 -3
  29. package/dist/component/{ebnfDiagram-BXEA7PRR-BgU6lPC0.js → ebnfDiagram-BXEA7PRR-DdL9-qpf.js} +4 -4
  30. package/dist/component/{erDiagram-JOGREHBK-BDuqW50a.js → erDiagram-JOGREHBK-1mtJehIC.js} +5 -5
  31. package/dist/component/{flowDiagram-UKHOOZJN-KisN8EgK.js → flowDiagram-UKHOOZJN-BPwuBLmT.js} +7 -7
  32. package/dist/component/{ganttDiagram-PKOTCBZU-kZrnta4w.js → ganttDiagram-PKOTCBZU-C0dhxKZn.js} +3 -3
  33. package/dist/component/{gitGraphDiagram-DS77QQ5N-Dy1S71_C.js → gitGraphDiagram-DS77QQ5N-9pn8I5Ww.js} +4 -4
  34. package/dist/component/{highlighted-body-OFNGDK62-ChNAP6R7.js → highlighted-body-OFNGDK62-BtE2oU8T.js} +2 -2
  35. package/dist/component/index.js +1 -1
  36. package/dist/component/{infoDiagram-6WML65LV-C3CmzQkI.js → infoDiagram-6WML65LV-Un5rOho6.js} +2 -2
  37. package/dist/component/{ishikawaDiagram-WSZJBQD7-DBHVF-fV.js → ishikawaDiagram-WSZJBQD7-B_Q76Ncg.js} +2 -2
  38. package/dist/component/{journeyDiagram-NVQOT4AX-Cg3e2eDS.js → journeyDiagram-NVQOT4AX-CvjCKkXJ.js} +5 -5
  39. package/dist/component/{kanban-definition-27J2QSJJ-tIaMkhvn.js → kanban-definition-27J2QSJJ-DTk-MzTa.js} +3 -3
  40. package/dist/component/{linear-DQ23phHp.js → linear-Bjkwtb4n.js} +2 -2
  41. package/dist/component/{mermaid-GHXKKRXX-CssTT3y2.js → mermaid-GHXKKRXX-CUdhS07I.js} +43886 -41496
  42. package/dist/component/{mindmap-definition-FAOFIHXS-oSuksV41.js → mindmap-definition-FAOFIHXS-NMNGkbeM.js} +4 -4
  43. package/dist/component/{pegDiagram-VL7TDLO6-GLxZEQlj.js → pegDiagram-VL7TDLO6-DP8ndDG1.js} +4 -4
  44. package/dist/component/{pieDiagram-7S7Q4E2Y-4ghKg2jt.js → pieDiagram-7S7Q4E2Y-CneShL4n.js} +4 -4
  45. package/dist/component/{quadrantDiagram-CIZ2JOQS-DOnM2yX5.js → quadrantDiagram-CIZ2JOQS-DwKlYHP_.js} +3 -3
  46. package/dist/component/{railroadDiagram-AXF67PYL-DCf1AdeI.js → railroadDiagram-AXF67PYL-D7hQRdO5.js} +4 -4
  47. package/dist/component/{requirementDiagram-LRYGKXZP-BgUTRz25.js → requirementDiagram-LRYGKXZP-BLxtMc17.js} +4 -4
  48. package/dist/component/{sankeyDiagram-W5VNT64P-93-3TiEZ.js → sankeyDiagram-W5VNT64P-CXp6dM_4.js} +2 -2
  49. package/dist/component/{sequenceDiagram-SI44F4Z6-CjdXsQGo.js → sequenceDiagram-SI44F4Z6-Ce7VH5G7.js} +4 -4
  50. package/dist/component/{sizeCapture-X5ZJPWSS-BZcfJFgu.js → sizeCapture-X5ZJPWSS-CUTOnfZv.js} +2 -2
  51. package/dist/component/{stateDiagram-OKZ733FA-DqZxP_LE.js → stateDiagram-OKZ733FA-Bu73CVSq.js} +3 -3
  52. package/dist/component/{stateDiagram-v2-UEYNNEHI-bW3Xpzm_.js → stateDiagram-v2-UEYNNEHI-ktw3g3Qt.js} +3 -3
  53. package/dist/component/{swimlanes-SLNWSIFB-BCid9HHX.js → swimlanes-SLNWSIFB-DBKvCdnJ.js} +4 -4
  54. package/dist/component/{swimlanesDiagram-ULZ7WXOC-CUXpjQTA.js → swimlanesDiagram-ULZ7WXOC-CEWTxRuN.js} +3 -3
  55. package/dist/component/{timeline-definition-Z64GVDOM-Cl9JeVlC.js → timeline-definition-Z64GVDOM-C3MMj2z6.js} +3 -3
  56. package/dist/component/{vennDiagram-T6HMQDX7-A8wa9sfS.js → vennDiagram-T6HMQDX7-BRuneBor.js} +2 -2
  57. package/dist/component/{wardleyDiagram-T6FBY63Y-CYjNVqXL.js → wardleyDiagram-T6FBY63Y-Dyd4EEZv.js} +3 -3
  58. package/dist/component/{xychartDiagram-ELKLHX3M-CWTWyqQ8.js → xychartDiagram-ELKLHX3M-BDUULgvJ.js} +3 -3
  59. package/dist/components/ai-elements/terminal-task.d.ts +3 -1
  60. package/dist/components/embed/EarlierMessages.d.ts +17 -0
  61. package/dist/components/embed/EmbedConversation.d.ts +6 -1
  62. package/dist/components/embed/VirtualTranscript.d.ts +12 -0
  63. package/dist/components/embed/session-intent.d.ts +3 -0
  64. package/dist/components/embed/virtual-transcript-settings.d.ts +15 -0
  65. package/dist/components/feedback/feedback-votes.d.ts +3 -0
  66. package/dist/components/feedback/message-feedback.d.ts +2 -2
  67. package/dist/i18n/messages/en.d.ts +1 -0
  68. package/dist/lib/remembered-state.d.ts +9 -0
  69. package/dist/lib/use-remembered-disclosure.d.ts +2 -0
  70. package/dist/routes/chat/history-cache.d.ts +47 -0
  71. package/dist/routes/chat/history-paging.d.ts +61 -0
  72. package/dist/routes/chat/kept-chats.d.ts +39 -0
  73. package/dist/routes/chat/live-chats.d.ts +14 -0
  74. package/dist/routes/chat/transcript-pins.d.ts +4 -0
  75. package/dist/routes/chat/transcript-row.d.ts +49 -0
  76. package/dist/routes/chat/use-session-goal.d.ts +6 -1
  77. package/dist/routes/chat.d.ts +8 -21
  78. package/dist/stream/activity-items.d.ts +2 -0
  79. package/dist/stream/ai-sdk-part-renderers.d.ts +14 -1
  80. package/dist/stream/belong-chat-transport.d.ts +22 -0
  81. package/dist/stream/belong-data-parts.d.ts +13 -0
  82. package/dist/stream/dispatch-once.d.ts +12 -0
  83. package/dist/stream/sandbox-output-store.d.ts +14 -0
  84. package/dist/stream/sandbox-output.d.ts +8 -3
  85. package/dist/stream/select-session-usage.d.ts +15 -1
  86. package/dist/stream/tool-call-detail.d.ts +16 -0
  87. package/package.json +1 -1
@@ -38,7 +38,12 @@ export type StartGoalInput = {
38
38
  * which is normally one the user already settled. Prefer an explicitly pending
39
39
  * card; otherwise take the last.
40
40
  */
41
- export declare const scrollAndFocusPendingCard: (kind: PendingCardKind) => void;
41
+ export declare const scrollAndFocusPendingCard: (kind: PendingCardKind,
42
+ /**
43
+ * Where to look: the dock's root. In production that is a SHADOW root,
44
+ * which `document.querySelectorAll` cannot see into.
45
+ */
46
+ root?: ParentNode) => void;
42
47
  /** Every prop `<GoalComposeSheet>` takes — named once so `composeSheet` and
43
48
  * `goalDoor.composeSheet` below don't have to repeat the shape. */
44
49
  type GoalComposeSheetProps = {
@@ -1,30 +1,17 @@
1
- /**
2
- * ChatRoute — the embedded dock's chat surface, driven by Vercel AI
3
- * SDK's `useChat` over a custom `BelongChatTransport`.
4
- *
5
- * useChat<BelongUIMessage>({ id, transport, resume })
6
- * ↓ sendMessage({ text }, { body: { fileIds } })
7
- * BelongChatTransport.sendMessages()
8
- * ↓ POST /v1/sessions(/$id)?/messages → { runId }
9
- * ↓ GET /v1/runs/$runId/stream (SSE, Bearer JWT, Last-Event-Id)
10
- * useChat appends to message.parts → <PartRenderer> dispatches.
11
- *
12
- * Features wired here:
13
- * - Attachments: the AI-Elements <PromptInput> owns picking (click /
14
- * drag-drop / paste) and renders inline chips. On submit we upload each
15
- * picked file to POST /v1/files (upload-first) and thread the returned
16
- * fileIds via the sendMessage body, while carrying the `file` parts on the
17
- * user message so the attachments also render on the bubble in the stream.
18
- * - Resume: a stable chat id + `resume` re-attach an in-flight run after a
19
- * page reload (the transport persists the cursor to localStorage).
20
- * - Voice: final transcripts from the dock Mic button submit as messages.
21
- */
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { HistoryScope } from './chat/history-cache.ts';
22
3
  export type QueuedMessage = {
23
4
  readonly clientId: string;
24
5
  readonly text: string;
25
6
  readonly submittedAt: number;
26
7
  readonly state: "queued" | "failed";
27
8
  };
9
+ /**
10
+ * Read a chat's newest page ahead of opening it (the Chats list's
11
+ * `SessionIntentContext`), so it opens painted from the cache. A chat kept
12
+ * live needs no read; a page read in the last 30 s is not read again.
13
+ */
14
+ export declare const prefetchChatHistory: (queryClient: QueryClient, apiBaseUrl: string, scope: HistoryScope) => void;
28
15
  export declare const ChatRoute: ({ sessionId, draftId, reconcileBackgroundRun, onOpenGoalView, onOpenFilesView, }?: {
29
16
  readonly sessionId?: string;
30
17
  readonly draftId?: string;
@@ -3,6 +3,8 @@ import { SandboxCommandData, SubagentData, ToolCallData } from './belong-data-pa
3
3
  export type ToolActivityItem = {
4
4
  readonly tool: ToolCallData;
5
5
  readonly output: SandboxCommandData | null;
6
+ /** The call's part id — how a summarized history card fetches its full output. */
7
+ readonly toolCallId?: string;
6
8
  };
7
9
  /**
8
10
  * BEL-199 — a delegated subagent in an activity run. It sits INSIDE the one
@@ -2,10 +2,19 @@ import { MessageContinuation } from './message-continuation.ts';
2
2
  import { BelongDataParts, BelongUIMessage, GoalProposalData } from './belong-data-parts.ts';
3
3
  import { ActivityItem } from './activity-items.ts';
4
4
  import { SubagentLanesContext, SubagentMessageIndex } from './subagent-lanes-model.ts';
5
- export declare const ActivityGroup: ({ items, live, subagents, }: {
5
+ export declare const ActivityGroup: ({ items, live, keepContentMounted, subagents, }: {
6
6
  readonly items: readonly ActivityItem[];
7
7
  /** The collapsed line's shimmer: true only for the LAST group of the streaming message. */
8
8
  readonly live?: boolean | undefined;
9
+ /**
10
+ * Keep the collapsed content mounted (hidden). A live group needs it: its
11
+ * terminal cards accumulate streamed output in component state
12
+ * (`useSandboxOutputText`) and `SkillLibraryToolSync` must see the call
13
+ * finish. A settled, restored group has neither, so `MessageParts` passes
14
+ * `false` and its content mounts on open — otherwise a long conversation
15
+ * mounts every tool card of every turn at once.
16
+ */
17
+ readonly keepContentMounted?: boolean | undefined;
9
18
  /**
10
19
  * Spec 2026-09-16 §4a — the message this group belongs to. The lanes nest
11
20
  * their calls (and a wave its lanes) from every group of it, and tick and
@@ -30,6 +39,10 @@ type TextSegment = {
30
39
  * `text.slice(start+1, end)` with its `\ ` escapes resolved, so a filename with
31
40
  * spaces renders as one pill. Text with no mention yields a single `text`
32
41
  * segment. Pure.
42
+ *
43
+ * An `@` inside markdown code (`@media` in CSS, `@Component`, `@belong/sdk` in
44
+ * a shell line) is code, never a reference: splitting there would cut the
45
+ * markdown mid-fence and render the rest of the block as live markup.
33
46
  */
34
47
  export declare const splitMentionSegments: (text: string) => readonly TextSegment[];
35
48
  export type BelongMessagePart = BelongUIMessage["parts"][number];
@@ -114,6 +114,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
114
114
  }>>;
115
115
  }, z.core.$strip>>;
116
116
  subagentId: z.ZodOptional<z.ZodString>;
117
+ summary: z.ZodOptional<z.ZodLiteral<true>>;
117
118
  }, z.core.$strip>;
118
119
  }, z.core.$strip>, z.ZodObject<{
119
120
  type: z.ZodLiteral<"data-subagent">;
@@ -161,7 +162,10 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
161
162
  stderr: "stderr";
162
163
  }>>;
163
164
  delta: z.ZodOptional<z.ZodString>;
165
+ seq: z.ZodOptional<z.ZodNumber>;
166
+ throughSeq: z.ZodOptional<z.ZodNumber>;
164
167
  exitCode: z.ZodOptional<z.ZodNumber>;
168
+ summary: z.ZodOptional<z.ZodLiteral<true>>;
165
169
  }, z.core.$strip>;
166
170
  }, z.core.$strip>, z.ZodObject<{
167
171
  type: z.ZodLiteral<"data-ui-action">;
@@ -510,6 +514,24 @@ export declare class BelongChatTransport implements ChatTransport<BelongUIMessag
510
514
  /** Includes an outstanding SSE handshake and the transport's retry loop,
511
515
  * which can own the Session before useChat reports `streaming`. */
512
516
  get hasLiveStream(): boolean;
517
+ /** Like {@link hasLiveStream}, but only when the live stream is THIS
518
+ * transport's: what it reads lands in its own chat. */
519
+ get holdsLiveStream(): boolean;
520
+ /** The run this transport is following; null before one, and once it ended. */
521
+ get runId(): string | null;
522
+ /**
523
+ * The newest row of the server history the chat now holds. A resume with no
524
+ * cursor names it (`historyThrough`), so the server leaves to the history
525
+ * only the turns it holds: a reply saved after that history was read is
526
+ * replayed rather than lost.
527
+ */
528
+ noteHistoryThrough(messageId: string | null): void;
529
+ /**
530
+ * A kept chat shown again is the foreground chat: stamp its later
531
+ * `select_if_empty` writes with the current generation, as a fresh mount's
532
+ * transport would be (R2).
533
+ */
534
+ takeForeground(): void;
513
535
  /** Forget an unavailable session so the next send creates a fresh one. */
514
536
  reset(): void;
515
537
  /**
@@ -148,6 +148,12 @@ export type ToolCallData = {
148
148
  * lane is in the same group; otherwise it stays a flat item (§41).
149
149
  */
150
150
  readonly subagentId?: string | undefined;
151
+ /**
152
+ * Set only on a HISTORY part the server's summary view capped (a shell
153
+ * call's command/output, a skill's body): the full part is one
154
+ * `GET /v1/sessions/:id/tool-calls/:toolCallId` away (`tool-call-detail.ts`).
155
+ */
156
+ readonly summary?: true | undefined;
151
157
  };
152
158
  /**
153
159
  * BEL-199 — one delegated subagent. `running → finished | failed`, one part per
@@ -212,7 +218,14 @@ export type SandboxCommandData = {
212
218
  * identity churns on every unrelated stream chunk and is NOT a signal.
213
219
  */
214
220
  readonly seq?: number | undefined;
221
+ /**
222
+ * A resumed run's replay (belong-cloud `run-replay-snapshot.ts`): `delta` is
223
+ * the command's WHOLE output through this seq, to set rather than append.
224
+ */
225
+ readonly throughSeq?: number | undefined;
215
226
  readonly exitCode?: number | undefined;
227
+ /** A history part whose output the summary view cut to its tail (see ToolCallData). */
228
+ readonly summary?: true | undefined;
216
229
  };
217
230
  export type UiActionData = {
218
231
  readonly uiActionRequestId: string;
@@ -0,0 +1,12 @@
1
+ /** Claims `key`; false when it already fired on this page. */
2
+ export declare const claimDispatch: (key: string) => boolean;
3
+ /**
4
+ * Run `effect` once for `key` on this page — or, without a key, once for the
5
+ * component's lifetime (React 19 StrictMode double-invokes included).
6
+ */
7
+ export declare const useDispatchOnce: (key: string | undefined, effect: () => void, deps: readonly unknown[]) => void;
8
+ /** Where a dispatch card's one-shot call stands. */
9
+ export type DispatchStatus = "dispatching" | "running" | "ok" | "no_handler" | "failed" | "done";
10
+ /** What a dispatch card shows, remembered by the same key as its guard. */
11
+ export declare const dispatchStatuses: import('../lib/remembered-state.ts').RememberedState<DispatchStatus>;
12
+ export declare const __resetDispatchOnceForTest: () => void;
@@ -0,0 +1,14 @@
1
+ import { SandboxCommandData } from './belong-data-parts.ts';
2
+ type Accumulated = {
3
+ readonly text: string;
4
+ /** Highest live seq folded into `text`; -1 before any. */
5
+ readonly appliedThroughSeq: number;
6
+ };
7
+ /** The next state for one part, or `current` itself when it changes nothing. */
8
+ export declare const accumulateSandboxPart: (current: Accumulated, data: SandboxCommandData) => Accumulated;
9
+ /** Fold one received part into its command's output. */
10
+ export declare const applySandboxPart: (toolCallId: string, data: SandboxCommandData) => void;
11
+ export declare const peekSandboxOutput: (toolCallId: string) => string;
12
+ export declare const subscribeSandboxOutput: (toolCallId: string, listener: () => void) => (() => void);
13
+ export declare const __resetSandboxOutputStoreForTest: () => void;
14
+ export {};
@@ -53,12 +53,17 @@ export declare const sandboxDeltaKey: (data: SandboxCommandData) => string;
53
53
  /** Sort order for merging deltas: the folded full-text part precedes any live seq. */
54
54
  export declare const sandboxDeltaOrder: (data: SandboxCommandData) => number;
55
55
  /**
56
- * Accumulate a sandbox part's streamed deltas into one string across
57
- * re-renders, applying each delta exactly once by {@link sandboxDeltaKey}.
56
+ * A command's accumulated output: its streamed deltas folded into one string,
57
+ * each applied exactly once (`sandbox-output-store.ts`).
58
+ *
59
+ * The sum lives in a store keyed by `toolCallId`, so it survives the card
60
+ * unmounting — a virtualized transcript unmounts every row that scrolls out of
61
+ * view. Without an id (a part rendered outside a message) the card keeps its
62
+ * own key and the sum lasts as long as the card.
58
63
  *
59
64
  * Deliberately `useLayoutEffect` (not `useEffect`): it runs synchronously after
60
65
  * DOM mutations, so the flushSync-based test harness observes the accumulated
61
66
  * text within the same render flush. In production it's equally correct — it
62
67
  * runs before paint, so streamed output never renders a frame late.
63
68
  */
64
- export declare const useSandboxOutputText: (output: SandboxCommandData | null) => string;
69
+ export declare const useSandboxOutputText: (output: SandboxCommandData | null, toolCallId?: string) => string;
@@ -31,4 +31,18 @@ export type SessionUsageSummary = {
31
31
  */
32
32
  readonly contextWindow: ContextWindowData | null;
33
33
  };
34
- export declare const selectSessionUsage: (messages: readonly BelongUIMessage[]) => SessionUsageSummary | null;
34
+ /** The chat's usage total as of a history read (the ledger's sums). */
35
+ export type SessionUsageBaseline = {
36
+ readonly totalInputTokens: number;
37
+ readonly totalOutputTokens: number;
38
+ readonly totalTokens: number;
39
+ readonly totalCacheReadInputTokens: number;
40
+ readonly totalCacheWriteInputTokens: number;
41
+ readonly turns: number;
42
+ };
43
+ export declare const selectSessionUsage: (messages: readonly BelongUIMessage[],
44
+ /**
45
+ * The newest history page's total (`null`: the chat had no usage yet);
46
+ * `undefined` when there is none to go by — then every part is summed.
47
+ */
48
+ baseline?: SessionUsageBaseline | null) => SessionUsageSummary | null;
@@ -0,0 +1,16 @@
1
+ import { SandboxCommandData, ToolCallData } from './belong-data-parts.ts';
2
+ export type ToolCallDetail = {
3
+ readonly command: ToolCallData | null;
4
+ readonly output: SandboxCommandData | null;
5
+ };
6
+ /** Resolves a call's full parts; rejects when they cannot be read. */
7
+ export type ToolCallDetailLoader = (toolCallId: string) => Promise<ToolCallDetail>;
8
+ /** Null outside a chat transcript (live-only surfaces): cards keep what they have. */
9
+ export declare const ToolCallDetailContext: import('react').Context<ToolCallDetailLoader | null>;
10
+ /** `GET /v1/sessions/:id/tool-calls/:toolCallId` — throws on any failure. */
11
+ export declare const fetchToolCallDetail: (apiBaseUrl: string, sessionId: string, toolCallId: string) => Promise<ToolCallDetail>;
12
+ /**
13
+ * A summarized card's full parts, loaded once `wanted` (the card is open and
14
+ * was cut). Null until they arrive — and for good when they cannot be read.
15
+ */
16
+ export declare const useToolCallDetail: (toolCallId: string | undefined, wanted: boolean) => ToolCallDetail | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "0.6.24",
3
+ "version": "0.6.25",
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",