@belonguniverseai/react-sdk 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +26 -2
- package/dist/api/connectors.d.ts +18 -4
- package/dist/component/{abnfDiagram-N423BO3Z-CXjvUYJM.js → abnfDiagram-N423BO3Z-BqLDpZdq.js} +4 -4
- package/dist/component/{arc-hvj1AfZf.js → arc-Dm2SU8j1.js} +2 -2
- package/dist/component/{architectureDiagram-T3A2C74G-I5KD4X7d.js → architectureDiagram-T3A2C74G-_yMyGOA0.js} +3 -3
- package/dist/component/{blockDiagram-VBNYF7ZC-CSQEI_L6.js → blockDiagram-VBNYF7ZC-D9VflzkZ.js} +4 -4
- package/dist/component/{c4Diagram-5PPSVZJV-V-_GQMfV.js → c4Diagram-5PPSVZJV-BOFK9ZLh.js} +3 -3
- package/dist/component/{channel-DgTylL82.js → channel-D6iPJYsJ.js} +2 -2
- package/dist/component/{chunk-2GRJ4B5K-CqJYsH7w.js → chunk-2GRJ4B5K-ByfnPvD5.js} +2 -2
- package/dist/component/{chunk-2Q5K7J3B-C7NzQAsc.js → chunk-2Q5K7J3B-CDcsbCAg.js} +2 -2
- package/dist/component/{chunk-5RXB4S5H-Ci5a7f5K.js → chunk-5RXB4S5H-CirI8O1U.js} +5 -5
- package/dist/component/{chunk-5VM5RSS4-CQBdXt0M.js → chunk-5VM5RSS4-BLesnWRv.js} +2 -2
- package/dist/component/{chunk-6Q2QTUOP-x3sbaebY.js → chunk-6Q2QTUOP-DIHfg6-c.js} +2 -2
- package/dist/component/{chunk-GF5L2VYU-C4q114zP.js → chunk-GF5L2VYU-BMK_1X_n.js} +6 -6
- package/dist/component/{chunk-JWPE2WC7-DgW2FuHu.js → chunk-JWPE2WC7-Ddx_68I1.js} +2 -2
- package/dist/component/{chunk-KBJHAD2P-Dt9ytyoa.js → chunk-KBJHAD2P-912yr8bT.js} +2 -2
- package/dist/component/{chunk-RYQCIY6F-B57mbXBS.js → chunk-RYQCIY6F-DxWixBuO.js} +2 -2
- package/dist/component/{chunk-XXDRQBXY-D2xqks7p.js → chunk-XXDRQBXY-Cibjy2LI.js} +2 -2
- package/dist/component/{classDiagram-JCYQIIEL-DhM1DBzI.js → classDiagram-JCYQIIEL-BYJ-xvn2.js} +3 -3
- package/dist/component/{classDiagram-v2-OCEON4UE-DhM1DBzI.js → classDiagram-v2-OCEON4UE-BYJ-xvn2.js} +3 -3
- package/dist/component/{cose-bilkent-JH36ORCC-DomQ6QD0.js → cose-bilkent-JH36ORCC-CkJMpr0H.js} +2 -2
- package/dist/component/{cynefinDiagram-MW4NZA55-mSCoPfKo.js → cynefinDiagram-MW4NZA55-Dc4taWcA.js} +3 -3
- package/dist/component/{dagre-VZM6K2ZE-COqD1FR_.js → dagre-VZM6K2ZE-CQDP68CU.js} +3 -3
- package/dist/component/{diagram-7IWD3JNH-D8ytEGTC.js → diagram-7IWD3JNH-BT7cLIyC.js} +4 -4
- package/dist/component/{diagram-B4RE2ZJO-qVHv3tAJ.js → diagram-B4RE2ZJO-CVLcZUKA.js} +3 -3
- package/dist/component/{diagram-LBJQPF4R-1M4VqIQr.js → diagram-LBJQPF4R-DEt0GZKG.js} +3 -3
- package/dist/component/{diagram-Q27KOJAE-D-yRwFL5.js → diagram-Q27KOJAE-BHMIeQwZ.js} +4 -4
- package/dist/component/{diagram-UB23O5K3-CdhwwwXT.js → diagram-UB23O5K3-lC1h_7bO.js} +3 -3
- package/dist/component/{ebnfDiagram-BXEA7PRR-DvkSWdzm.js → ebnfDiagram-BXEA7PRR-abeSj1v8.js} +4 -4
- package/dist/component/{erDiagram-JOGREHBK-DYW6soKC.js → erDiagram-JOGREHBK-BQdnbLcP.js} +5 -5
- package/dist/component/{flowDiagram-UKHOOZJN-lX9bPH3y.js → flowDiagram-UKHOOZJN-B74okJcm.js} +7 -7
- package/dist/component/{ganttDiagram-PKOTCBZU-Bw3yFu0c.js → ganttDiagram-PKOTCBZU-BQlzoH1e.js} +3 -3
- package/dist/component/{gitGraphDiagram-DS77QQ5N-u2K3ajVq.js → gitGraphDiagram-DS77QQ5N-Dl10ZpNn.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-Be7lfVfE.js → highlighted-body-OFNGDK62-B7yKnIXR.js} +2 -2
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-6WML65LV-COd4dLXc.js → infoDiagram-6WML65LV-BGv4zoM9.js} +2 -2
- package/dist/component/{ishikawaDiagram-WSZJBQD7-Nlv7r7nV.js → ishikawaDiagram-WSZJBQD7-D-RA5Yc4.js} +2 -2
- package/dist/component/{journeyDiagram-NVQOT4AX-aW2s3vBQ.js → journeyDiagram-NVQOT4AX-BOOPZEr8.js} +5 -5
- package/dist/component/{kanban-definition-27J2QSJJ-DxgoZxJ8.js → kanban-definition-27J2QSJJ-CM_21e1u.js} +3 -3
- package/dist/component/{linear-C5t7R621.js → linear-DsxFFYAT.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-DXjO7GoH.js → mermaid-GHXKKRXX-BjL6GrCJ.js} +27640 -27017
- package/dist/component/{mindmap-definition-FAOFIHXS-DfshragM.js → mindmap-definition-FAOFIHXS-BoTqL6A9.js} +4 -4
- package/dist/component/{pegDiagram-VL7TDLO6-Cjc4vpZL.js → pegDiagram-VL7TDLO6-B_z2a0XU.js} +4 -4
- package/dist/component/{pieDiagram-7S7Q4E2Y-DzlAv5UT.js → pieDiagram-7S7Q4E2Y-CCdt1OHn.js} +4 -4
- package/dist/component/{quadrantDiagram-CIZ2JOQS-BTeDvdk2.js → quadrantDiagram-CIZ2JOQS-kcV72RQS.js} +3 -3
- package/dist/component/{railroadDiagram-AXF67PYL-DZB_qxuO.js → railroadDiagram-AXF67PYL-ojpLGzl3.js} +4 -4
- package/dist/component/{requirementDiagram-LRYGKXZP-DgjBkSr6.js → requirementDiagram-LRYGKXZP-UVwuNLy3.js} +4 -4
- package/dist/component/{sankeyDiagram-W5VNT64P-D8oLUeD_.js → sankeyDiagram-W5VNT64P-BVdf40Ow.js} +2 -2
- package/dist/component/{sequenceDiagram-SI44F4Z6-CRpbHwQ7.js → sequenceDiagram-SI44F4Z6-D5Z2GwYL.js} +4 -4
- package/dist/component/{sizeCapture-X5ZJPWSS-Df3Ns8Nm.js → sizeCapture-X5ZJPWSS-CAPosGsq.js} +2 -2
- package/dist/component/{stateDiagram-OKZ733FA-CE1YjTrH.js → stateDiagram-OKZ733FA-wLT_bEJl.js} +3 -3
- package/dist/component/{stateDiagram-v2-UEYNNEHI-BFXplBoV.js → stateDiagram-v2-UEYNNEHI-B4qtJwo7.js} +3 -3
- package/dist/component/{swimlanes-SLNWSIFB-B47nc8HV.js → swimlanes-SLNWSIFB-CmrQLu5e.js} +4 -4
- package/dist/component/{swimlanesDiagram-ULZ7WXOC-B3YQjLat.js → swimlanesDiagram-ULZ7WXOC-DiUEgAmt.js} +3 -3
- package/dist/component/{timeline-definition-Z64GVDOM-CY_DoEYn.js → timeline-definition-Z64GVDOM-Ci7BxWuT.js} +3 -3
- package/dist/component/{vennDiagram-T6HMQDX7-DTDLVncM.js → vennDiagram-T6HMQDX7-Ce-UaIN7.js} +2 -2
- package/dist/component/{wardleyDiagram-T6FBY63Y-B3wQ9kzy.js → wardleyDiagram-T6FBY63Y-VS7-6gi5.js} +3 -3
- package/dist/component/{xychartDiagram-ELKLHX3M-D_iSaGH-.js → xychartDiagram-ELKLHX3M-BKOueA7C.js} +3 -3
- package/dist/components/connectors/ConnectorAvatar.d.ts +3 -2
- package/dist/components/connectors/ConnectorBrandLogo.d.ts +11 -0
- package/dist/components/connectors/ConnectorImageInput.d.ts +8 -0
- package/dist/components/connectors/ConnectorMarketplaceDialog.d.ts +2 -2
- package/dist/components/connectors/NewConnectorDialog.d.ts +2 -2
- package/dist/components/connectors/connector-form.d.ts +2 -0
- package/dist/components/embed/ContextWindowPanel.d.ts +5 -0
- package/dist/components/embed/format-tokens.d.ts +19 -0
- package/dist/embed/global.d.ts +5 -1
- package/dist/i18n/messages/en.d.ts +27 -1
- package/dist/i18n/messages/surfaces/connectors.d.ts +30 -0
- package/dist/i18n/messages/surfaces/usage.d.ts +52 -4
- package/dist/stream/belong-chat-transport.d.ts +11 -0
- package/dist/stream/belong-data-parts.d.ts +30 -1
- package/dist/stream/select-session-usage.d.ts +13 -2
- package/package.json +1 -1
|
@@ -1,31 +1,79 @@
|
|
|
1
|
-
/** Usage meter dock strings. */
|
|
1
|
+
/** Usage meter + context-window panel dock strings. */
|
|
2
2
|
export declare const usageEn: {
|
|
3
3
|
readonly usage: {
|
|
4
4
|
readonly tooltip: "Auto-compacts at {{chars}} chars; {{tokens}} tokens used this session";
|
|
5
|
+
readonly windowTooltip: "Context window: {{used}} of {{window}} tokens used ({{pct}}%)";
|
|
5
6
|
readonly context: "Context {{pct}}%";
|
|
6
7
|
readonly tokens: "{{count}} tokens";
|
|
7
|
-
readonly
|
|
8
|
+
readonly inOut: "Input {{in}} · output {{out}}";
|
|
8
9
|
readonly turnsThisSessionOne: "{{count}} turn this session";
|
|
9
10
|
readonly turnsThisSessionOther: "{{count}} turns this session";
|
|
11
|
+
readonly panel: {
|
|
12
|
+
readonly title: "Context window";
|
|
13
|
+
readonly segments: {
|
|
14
|
+
readonly messages: "Messages";
|
|
15
|
+
readonly system_prompt: "System prompt";
|
|
16
|
+
readonly tools: "Tools";
|
|
17
|
+
readonly skills: "Skills";
|
|
18
|
+
readonly memory: "Memory";
|
|
19
|
+
};
|
|
20
|
+
readonly freeSpace: "Free space";
|
|
21
|
+
readonly estimateNote: "Breakdown is estimated; the total is as reported by the model.";
|
|
22
|
+
readonly sessionTokens: "{{tokens}} tokens this session";
|
|
23
|
+
readonly cacheLine: "Cache: {{read}} read · {{write}} written";
|
|
24
|
+
readonly autoCompact: "Auto-compact: {{pct}}% of budget";
|
|
25
|
+
};
|
|
10
26
|
};
|
|
11
27
|
};
|
|
12
28
|
export declare const usageEs: {
|
|
13
29
|
usage: {
|
|
14
30
|
tooltip: string;
|
|
31
|
+
windowTooltip: string;
|
|
15
32
|
context: string;
|
|
16
33
|
tokens: string;
|
|
17
|
-
|
|
34
|
+
inOut: string;
|
|
18
35
|
turnsThisSessionOne: string;
|
|
19
36
|
turnsThisSessionOther: string;
|
|
37
|
+
panel: {
|
|
38
|
+
title: string;
|
|
39
|
+
segments: {
|
|
40
|
+
messages: string;
|
|
41
|
+
system_prompt: string;
|
|
42
|
+
tools: string;
|
|
43
|
+
skills: string;
|
|
44
|
+
memory: string;
|
|
45
|
+
};
|
|
46
|
+
freeSpace: string;
|
|
47
|
+
estimateNote: string;
|
|
48
|
+
sessionTokens: string;
|
|
49
|
+
cacheLine: string;
|
|
50
|
+
autoCompact: string;
|
|
51
|
+
};
|
|
20
52
|
};
|
|
21
53
|
};
|
|
22
54
|
export declare const usagePt: {
|
|
23
55
|
usage: {
|
|
24
56
|
tooltip: string;
|
|
57
|
+
windowTooltip: string;
|
|
25
58
|
context: string;
|
|
26
59
|
tokens: string;
|
|
27
|
-
|
|
60
|
+
inOut: string;
|
|
28
61
|
turnsThisSessionOne: string;
|
|
29
62
|
turnsThisSessionOther: string;
|
|
63
|
+
panel: {
|
|
64
|
+
title: string;
|
|
65
|
+
segments: {
|
|
66
|
+
messages: string;
|
|
67
|
+
system_prompt: string;
|
|
68
|
+
tools: string;
|
|
69
|
+
skills: string;
|
|
70
|
+
memory: string;
|
|
71
|
+
};
|
|
72
|
+
freeSpace: string;
|
|
73
|
+
estimateNote: string;
|
|
74
|
+
sessionTokens: string;
|
|
75
|
+
cacheLine: string;
|
|
76
|
+
autoCompact: string;
|
|
77
|
+
};
|
|
30
78
|
};
|
|
31
79
|
};
|
|
@@ -171,8 +171,19 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
|
|
|
171
171
|
inputTokens: z.ZodNumber;
|
|
172
172
|
outputTokens: z.ZodNumber;
|
|
173
173
|
totalTokens: z.ZodNumber;
|
|
174
|
+
cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
175
|
+
cacheWriteInputTokens: z.ZodOptional<z.ZodNumber>;
|
|
174
176
|
historyChars: z.ZodNumber;
|
|
175
177
|
autoCompactThresholdChars: z.ZodNumber;
|
|
178
|
+
contextWindow: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
contextWindowTokens: z.ZodNumber;
|
|
180
|
+
usedTokens: z.ZodNumber;
|
|
181
|
+
segments: z.ZodArray<z.ZodObject<{
|
|
182
|
+
key: z.ZodString;
|
|
183
|
+
tokens: z.ZodNumber;
|
|
184
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
186
|
+
}, z.core.$strip>>;
|
|
176
187
|
}, z.core.$strip>;
|
|
177
188
|
}, z.core.$strip>, z.ZodObject<{
|
|
178
189
|
type: z.ZodLiteral<"data-choice-request">;
|
|
@@ -199,18 +199,47 @@ export type StatusData = {
|
|
|
199
199
|
*/
|
|
200
200
|
readonly retryable?: boolean | undefined;
|
|
201
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* One slice of the context-window breakdown. `key` is an open string on the
|
|
204
|
+
* wire; the KNOWN values are rendered as labeled rows (`messages`,
|
|
205
|
+
* `system_prompt`, `tools`, `skills`, `memory`) and unknown ones are skipped
|
|
206
|
+
* rather than failing the part (see the transport schema).
|
|
207
|
+
*/
|
|
208
|
+
export type ContextWindowSegmentData = {
|
|
209
|
+
readonly key: string;
|
|
210
|
+
readonly tokens: number;
|
|
211
|
+
readonly count?: number | undefined;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* The turn-end snapshot of the model's context window (own-loop runtimes
|
|
215
|
+
* only). `usedTokens` is the REAL last-request prompt + its output as the
|
|
216
|
+
* provider reported it; `segments` are estimates scaled to sum to it. Free
|
|
217
|
+
* space is `contextWindowTokens - usedTokens`, computed at render.
|
|
218
|
+
*/
|
|
219
|
+
export type ContextWindowData = {
|
|
220
|
+
readonly contextWindowTokens: number;
|
|
221
|
+
readonly usedTokens: number;
|
|
222
|
+
readonly segments: readonly ContextWindowSegmentData[];
|
|
223
|
+
};
|
|
202
224
|
/**
|
|
203
225
|
* F3 — per-turn token usage + compaction context. Emitted once per turn at
|
|
204
226
|
* the end of the stream; the SDK renders the quiet context meter from this.
|
|
205
227
|
* `historyChars / autoCompactThresholdChars` gives compaction proximity;
|
|
206
|
-
* `threshold === 0` means no auto-compact is configured — hide the meter
|
|
228
|
+
* `threshold === 0` means no auto-compact is configured — hide the meter
|
|
229
|
+
* unless a `contextWindow` report is present (the panel stands on its own).
|
|
230
|
+
* The optional fields are absent on rows persisted before they existed.
|
|
207
231
|
*/
|
|
208
232
|
export type UsageData = {
|
|
209
233
|
readonly inputTokens: number;
|
|
210
234
|
readonly outputTokens: number;
|
|
211
235
|
readonly totalTokens: number;
|
|
236
|
+
/** BEL-206 — the turn's prompt-cache reads/writes. */
|
|
237
|
+
readonly cacheReadInputTokens?: number | undefined;
|
|
238
|
+
readonly cacheWriteInputTokens?: number | undefined;
|
|
212
239
|
readonly historyChars: number;
|
|
213
240
|
readonly autoCompactThresholdChars: number;
|
|
241
|
+
/** The detailed context-window breakdown (own-loop runtimes only). */
|
|
242
|
+
readonly contextWindow?: ContextWindowData | undefined;
|
|
214
243
|
};
|
|
215
244
|
/**
|
|
216
245
|
* Single source of truth for Belong's custom data parts. The record
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BelongUIMessage } from './belong-data-parts.ts';
|
|
1
|
+
import { BelongUIMessage, ContextWindowData } from './belong-data-parts.ts';
|
|
2
2
|
export type SessionUsageSummary = {
|
|
3
3
|
/** Sum of all per-turn input tokens. */
|
|
4
4
|
readonly totalInputTokens: number;
|
|
@@ -6,6 +6,9 @@ export type SessionUsageSummary = {
|
|
|
6
6
|
readonly totalOutputTokens: number;
|
|
7
7
|
/** Sum of all per-turn combined tokens. */
|
|
8
8
|
readonly totalTokens: number;
|
|
9
|
+
/** BEL-206 — sums of the per-turn prompt-cache reads/writes (0 when unreported). */
|
|
10
|
+
readonly totalCacheReadInputTokens: number;
|
|
11
|
+
readonly totalCacheWriteInputTokens: number;
|
|
9
12
|
/** How many turns have reported usage. */
|
|
10
13
|
readonly turns: number;
|
|
11
14
|
/**
|
|
@@ -16,8 +19,16 @@ export type SessionUsageSummary = {
|
|
|
16
19
|
readonly historyChars: number;
|
|
17
20
|
/**
|
|
18
21
|
* Auto-compact threshold in chars (last-wins). 0 means auto-compact is
|
|
19
|
-
* not configured — the meter
|
|
22
|
+
* not configured — the legacy meter is hidden when this is 0 AND no
|
|
23
|
+
* context-window report is present.
|
|
20
24
|
*/
|
|
21
25
|
readonly autoCompactThresholdChars: number;
|
|
26
|
+
/**
|
|
27
|
+
* The most recent turn's context-window breakdown (last-wins — the
|
|
28
|
+
* current context IS the latest turn's context). Null when no turn has
|
|
29
|
+
* reported one (older sessions, or the claude-agent-sdk runtime); the
|
|
30
|
+
* panel then falls back to the session-usage view.
|
|
31
|
+
*/
|
|
32
|
+
readonly contextWindow: ContextWindowData | null;
|
|
22
33
|
};
|
|
23
34
|
export declare const selectSessionUsage: (messages: readonly BelongUIMessage[]) => SessionUsageSummary | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belonguniverseai/react-sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
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",
|