@belonguniverseai/react-sdk 0.1.3 → 0.1.4
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 +57 -9
- package/dist/api/query-keys.d.ts +9 -0
- package/dist/api/workspace-files.d.ts +1 -1
- package/dist/component/{arc-Dftg9hbM.js → arc-BEnKmFiH.js} +2 -2
- package/dist/component/{architectureDiagram-3BPJPVTR-LDQnfAgM.js → architectureDiagram-3BPJPVTR-qrW4PiqE.js} +3 -3
- package/dist/component/{blockDiagram-GPEHLZMM-7C0jnncw.js → blockDiagram-GPEHLZMM-Cy83RTvZ.js} +4 -4
- package/dist/component/{c4Diagram-AAUBKEIU-BGEe9CdO.js → c4Diagram-AAUBKEIU-DA1KAAqR.js} +3 -3
- package/dist/component/{channel-CsGW22vj.js → channel-S3CulQua.js} +2 -2
- package/dist/component/{chunk-2J33WTMH-Dg3NXbVg.js → chunk-2J33WTMH-B3IpUX0y.js} +2 -2
- package/dist/component/{chunk-4BX2VUAB-BDtEKe-l.js → chunk-4BX2VUAB-TXwXVoCn.js} +2 -2
- package/dist/component/{chunk-55IACEB6-Da2BRT6c.js → chunk-55IACEB6-TgAuWAzl.js} +2 -2
- package/dist/component/{chunk-727SXJPM-DhH-ppYY.js → chunk-727SXJPM-CRzAhEpU.js} +6 -6
- package/dist/component/{chunk-AQP2D5EJ-D8PxFJHV.js → chunk-AQP2D5EJ-BGyYD9fu.js} +4 -4
- package/dist/component/{chunk-FMBD7UC4--IsNL9At.js → chunk-FMBD7UC4-DMPGLPzn.js} +2 -2
- package/dist/component/{chunk-ND2GUHAM-DbdImadK.js → chunk-ND2GUHAM-D4Pq2Sbn.js} +2 -2
- package/dist/component/{chunk-QZHKN3VN-6IxJ3-HB.js → chunk-QZHKN3VN-pAuUtuaS.js} +2 -2
- package/dist/component/{classDiagram-4FO5ZUOK-BhkVSVk_.js → classDiagram-4FO5ZUOK-Cfk5JVma.js} +3 -3
- package/dist/component/{classDiagram-v2-Q7XG4LA2-BhkVSVk_.js → classDiagram-v2-Q7XG4LA2-Cfk5JVma.js} +3 -3
- package/dist/component/{cose-bilkent-S5V4N54A-_2z1EHfc.js → cose-bilkent-S5V4N54A-DDqAk-Nd.js} +2 -2
- package/dist/component/{dagre-BM42HDAG-DlKG5hsO.js → dagre-BM42HDAG-CRWiZgwY.js} +2 -2
- package/dist/component/{diagram-2AECGRRQ-CFAaADeR.js → diagram-2AECGRRQ-vfIORQjw.js} +3 -3
- package/dist/component/{diagram-5GNKFQAL-ZJ957Qm9.js → diagram-5GNKFQAL-BrdNWhYp.js} +4 -4
- package/dist/component/{diagram-KO2AKTUF-CROmuIwX.js → diagram-KO2AKTUF-BzvQZ4om.js} +3 -3
- package/dist/component/{diagram-LMA3HP47-4YR2hh1P.js → diagram-LMA3HP47-ByWVR7eR.js} +3 -3
- package/dist/component/{diagram-OG6HWLK6-CfsgJnIX.js → diagram-OG6HWLK6-DFJUF0-3.js} +4 -4
- package/dist/component/{erDiagram-TEJ5UH35-BajpSizj.js → erDiagram-TEJ5UH35-h-b8M9my.js} +5 -5
- package/dist/component/{flowDiagram-I6XJVG4X-DYfoJvQB.js → flowDiagram-I6XJVG4X-Bs5-0VOV.js} +7 -7
- package/dist/component/{ganttDiagram-6RSMTGT7-DxWg1-cU.js → ganttDiagram-6RSMTGT7-BFOggcmT.js} +3 -3
- package/dist/component/{gitGraphDiagram-PVQCEYII-DPfijUuS.js → gitGraphDiagram-PVQCEYII-DqyxmsbF.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-BFpReqjo.js → highlighted-body-OFNGDK62-Bdj8cutJ.js} +2 -2
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-5YYISTIA-Cs3ZkSNq.js → infoDiagram-5YYISTIA-8md68U3E.js} +2 -2
- package/dist/component/{ishikawaDiagram-YF4QCWOH-wgyW2oOS.js → ishikawaDiagram-YF4QCWOH-C3xT9wjK.js} +2 -2
- package/dist/component/{journeyDiagram-JHISSGLW-qvEHDcP8.js → journeyDiagram-JHISSGLW-BbHXf52q.js} +5 -5
- package/dist/component/{kanban-definition-UN3LZRKU-CS8E5I3H.js → kanban-definition-UN3LZRKU-Xcxe9Aqi.js} +3 -3
- package/dist/component/{linear-DSEm-mVJ.js → linear-tnf14jhv.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-mE-t6fEG.js → mermaid-GHXKKRXX-DRKI1NOg.js} +26675 -26113
- package/dist/component/{mindmap-definition-RKZ34NQL-4eLujZip.js → mindmap-definition-RKZ34NQL-DT2YOYJT.js} +4 -4
- package/dist/component/{pieDiagram-4H26LBE5-Bv3aeU7h.js → pieDiagram-4H26LBE5-DnaT-EHy.js} +4 -4
- package/dist/component/{quadrantDiagram-W4KKPZXB-BlpxPqAT.js → quadrantDiagram-W4KKPZXB-Chj0SIr_.js} +3 -3
- package/dist/component/{requirementDiagram-4Y6WPE33-DGG1FxFS.js → requirementDiagram-4Y6WPE33-C8P86Vfk.js} +4 -4
- package/dist/component/{sankeyDiagram-5OEKKPKP-CQ-jfvW-.js → sankeyDiagram-5OEKKPKP-BTV3aQxb.js} +2 -2
- package/dist/component/{sequenceDiagram-3UESZ5HK-Ck-VbsGz.js → sequenceDiagram-3UESZ5HK-CszXtNuQ.js} +4 -4
- package/dist/component/{stateDiagram-AJRCARHV-KlZdFGFQ.js → stateDiagram-AJRCARHV-BPKVLcMj.js} +3 -3
- package/dist/component/{stateDiagram-v2-BHNVJYJU-Djoz6HMn.js → stateDiagram-v2-BHNVJYJU-CAAXRt1C.js} +3 -3
- package/dist/component/{timeline-definition-PNZ67QCA-C3x7MWUx.js → timeline-definition-PNZ67QCA-CqzXrhgH.js} +3 -3
- package/dist/component/{vennDiagram-CIIHVFJN-B4SXjWyu.js → vennDiagram-CIIHVFJN-Cvb9lpke.js} +2 -2
- package/dist/component/{wardleyDiagram-YWT4CUSO-B_0Q8QFc.js → wardleyDiagram-YWT4CUSO-BzPLaYx7.js} +3 -3
- package/dist/component/{xychartDiagram-2RQKCTM6-yIfLkIZO.js → xychartDiagram-2RQKCTM6-C50_ldFc.js} +3 -3
- package/dist/components/embed/AgentGrantCard.d.ts +6 -4
- package/dist/components/embed/ComposerMenu.d.ts +9 -1
- package/dist/components/embed/EmbedRail.d.ts +17 -1
- package/dist/components/embed/SlashCommandMenu.d.ts +10 -6
- package/dist/components/feedback/feedback-metadata.d.ts +4 -30
- package/dist/embed/approval-bus.d.ts +14 -0
- package/dist/embed/approval-decision.d.ts +10 -0
- package/dist/embed/closed-surface-voice-bus.d.ts +25 -0
- package/dist/embed/copy.d.ts +3 -0
- package/dist/embed/global.d.ts +4 -3
- package/dist/embed/plan-decision.d.ts +3 -1
- package/dist/embed/use-workspace-file-download.d.ts +2 -0
- package/dist/embed/voice-decision.d.ts +27 -0
- package/dist/embed/voice-phrase-match.d.ts +5 -0
- package/dist/embed/voice-prefs.d.ts +4 -0
- package/dist/embed/voice-send-intent.d.ts +12 -0
- package/dist/embed/workspace-scope.d.ts +44 -0
- package/dist/i18n/messages/en.d.ts +3 -0
- package/dist/i18n/messages/surfaces/embedMisc.d.ts +4 -0
- package/dist/stream/ai-sdk-part-renderers.d.ts +8 -1
- package/dist/stream/belong-chat-transport.d.ts +54 -1
- package/dist/stream/belong-data-parts.d.ts +6 -4
- package/dist/stream/message-metadata.d.ts +45 -0
- package/dist/stream/stream-state-store.d.ts +4 -4
- package/dist/types/public.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { ChatTransport, UIMessageChunk } from 'ai';
|
|
3
3
|
import { BelongUIMessage, WireStreamPart } from './belong-data-parts.ts';
|
|
4
|
+
declare const cancelRunResponseSchema: z.ZodObject<{
|
|
5
|
+
recalledMessages: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
6
|
+
messageId: z.ZodString;
|
|
7
|
+
clientMessageId: z.ZodNullable<z.ZodString>;
|
|
8
|
+
text: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
clientMessageId: string | null;
|
|
11
|
+
text: string;
|
|
12
|
+
messageId: string;
|
|
13
|
+
}, {
|
|
14
|
+
clientMessageId: string | null;
|
|
15
|
+
text: string;
|
|
16
|
+
messageId: string;
|
|
17
|
+
}>, "many">>;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
recalledMessages: {
|
|
20
|
+
clientMessageId: string | null;
|
|
21
|
+
text: string;
|
|
22
|
+
messageId: string;
|
|
23
|
+
}[];
|
|
24
|
+
}, {
|
|
25
|
+
recalledMessages?: {
|
|
26
|
+
clientMessageId: string | null;
|
|
27
|
+
text: string;
|
|
28
|
+
messageId: string;
|
|
29
|
+
}[] | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export type RecalledQueuedMessage = z.infer<typeof cancelRunResponseSchema>["recalledMessages"][number];
|
|
4
32
|
/**
|
|
5
33
|
* The wire/stored part union. Exported so the history loader (chat.tsx) can
|
|
6
34
|
* validate persisted assistant parts against the SAME shapes the live stream
|
|
@@ -652,6 +680,14 @@ export type BelongChatTransportOptions = {
|
|
|
652
680
|
* production uses `STALL_TIMEOUT_MS`.
|
|
653
681
|
*/
|
|
654
682
|
readonly stallTimeoutMs?: number;
|
|
683
|
+
/**
|
|
684
|
+
* Workspace isolation: the host workspace this transport's session belongs
|
|
685
|
+
* to. Defaults to the CURRENT scope at construction — captured once, so a
|
|
686
|
+
* workspace-A transport still streaming after the host switched to B keeps
|
|
687
|
+
* persisting its cursor under A's key and stamping A on its requests.
|
|
688
|
+
* Tests may pin it explicitly.
|
|
689
|
+
*/
|
|
690
|
+
readonly workspaceExternalId?: string | null;
|
|
655
691
|
};
|
|
656
692
|
export type StreamContext = {
|
|
657
693
|
/** Stable id we emit on every `text-delta`. Null when no text run is open. */
|
|
@@ -682,15 +718,32 @@ export type StreamContext = {
|
|
|
682
718
|
export declare class BelongChatTransport implements ChatTransport<BelongUIMessage> {
|
|
683
719
|
#private;
|
|
684
720
|
constructor(options: BelongChatTransportOptions);
|
|
721
|
+
/**
|
|
722
|
+
* The server session this transport is pinned to (adopted at construction
|
|
723
|
+
* or created on first send), or null before any exists. The queued-send
|
|
724
|
+
* path reads THIS — never the live workspace-keyed pointer — so a steering
|
|
725
|
+
* message posts to the conversation on screen even inside the scope
|
|
726
|
+
* store's poll window after a host workspace switch.
|
|
727
|
+
*/
|
|
728
|
+
get sessionId(): string | null;
|
|
729
|
+
/** The construction-captured workspace (see #workspaceExternalId). */
|
|
730
|
+
get workspaceExternalId(): string | null;
|
|
685
731
|
/** Drop the cached session so the next `sendMessages` creates a new one. */
|
|
686
732
|
reset(): void;
|
|
687
733
|
/**
|
|
688
734
|
* Best-effort server-side cancel of an in-flight run. `useChat`'s `stop()`
|
|
689
735
|
* only aborts the local stream (stops listening); this tells belong-cloud to
|
|
690
736
|
* actually halt the agent (POST /v1/runs/:runId/cancel → run-cancel pub/sub).
|
|
737
|
+
*
|
|
738
|
+
* BEL-144 — the backend also recalls the session's queued-but-unclaimed
|
|
739
|
+
* messages so they never execute; their text is returned here for the caller
|
|
740
|
+
* to restore into the composer. Any failure (network, non-2xx, old backend
|
|
741
|
+
* without the field) collapses to an empty list — the cancel stays
|
|
742
|
+
* best-effort.
|
|
691
743
|
*/
|
|
692
|
-
cancelRun: (runId: string) => Promise<
|
|
744
|
+
cancelRun: (runId: string) => Promise<readonly RecalledQueuedMessage[]>;
|
|
693
745
|
sendMessages: ChatTransport<BelongUIMessage>["sendMessages"];
|
|
694
746
|
reconnectToStream: ChatTransport<BelongUIMessage>["reconnectToStream"];
|
|
695
747
|
}
|
|
696
748
|
export declare const wireToUiChunks: (part: WireStreamPart, ctx: StreamContext) => readonly UIMessageChunk[];
|
|
749
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UIMessage } from 'ai';
|
|
2
|
+
import { BelongMessageMetadata } from './message-metadata.ts';
|
|
2
3
|
/**
|
|
3
4
|
* F2 — per-step execution status. Optional: absent means `pending`
|
|
4
5
|
* (back-compat with plans proposed before F2 and the initial propose). The
|
|
@@ -183,11 +184,12 @@ export type BelongDataParts = {
|
|
|
183
184
|
};
|
|
184
185
|
/**
|
|
185
186
|
* The concrete `UIMessage` shape the chat surface and transport speak.
|
|
186
|
-
* Metadata
|
|
187
|
-
*
|
|
188
|
-
*
|
|
187
|
+
* Metadata was `unknown` until the `fromHistory` gate needed to propagate
|
|
188
|
+
* reliably — now it's the `belongMessageMetadataSchema`-inferred type, parsed
|
|
189
|
+
* once at the wire perimeter (§4) so use sites read typed fields instead of
|
|
190
|
+
* re-narrowing.
|
|
189
191
|
*/
|
|
190
|
-
export type BelongUIMessage = UIMessage<
|
|
192
|
+
export type BelongUIMessage = UIMessage<BelongMessageMetadata, BelongDataParts>;
|
|
191
193
|
/**
|
|
192
194
|
* Wire shape emitted by belong-cloud's SSE adapter. This stays as a
|
|
193
195
|
* separate union because the server side has not migrated to AI-SDK
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const belongMessageMetadataSchema: z.ZodObject<{
|
|
3
|
+
/** Producing task of an assistant turn — the reload-stable feedback key. */
|
|
4
|
+
taskId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
/** The user's current 👍/👎 on that turn; `.nullish()` because the live
|
|
6
|
+
* `start` chunk stamps no vote yet while history returns `null` for
|
|
7
|
+
* "no vote" (requiring it would hide the thumbs on a fresh turn). */
|
|
8
|
+
feedback: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
9
|
+
sentiment: z.ZodEnum<["up", "down"]>;
|
|
10
|
+
reason: z.ZodNullable<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
reason: string | null;
|
|
13
|
+
sentiment: "up" | "down";
|
|
14
|
+
}, {
|
|
15
|
+
reason: string | null;
|
|
16
|
+
sentiment: "up" | "down";
|
|
17
|
+
}>>>;
|
|
18
|
+
/** Server row creation time (ISO) — per-bubble clock, history only (§41). */
|
|
19
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
20
|
+
/** Skill picked for this user message — renders the bubble's skill chip. */
|
|
21
|
+
skill: z.ZodOptional<z.ZodString>;
|
|
22
|
+
/** Set by `loadSessionHistory` on every restored message. Gates the
|
|
23
|
+
* dispatch renderers' auto-fire: absent (live/replayed turn) → fire once;
|
|
24
|
+
* true (restored history) → render settled, never re-dispatch. */
|
|
25
|
+
fromHistory: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
createdAt?: string | undefined;
|
|
28
|
+
taskId?: string | undefined;
|
|
29
|
+
skill?: string | undefined;
|
|
30
|
+
feedback?: {
|
|
31
|
+
reason: string | null;
|
|
32
|
+
sentiment: "up" | "down";
|
|
33
|
+
} | null | undefined;
|
|
34
|
+
fromHistory?: boolean | undefined;
|
|
35
|
+
}, {
|
|
36
|
+
createdAt?: string | undefined;
|
|
37
|
+
taskId?: string | undefined;
|
|
38
|
+
skill?: string | undefined;
|
|
39
|
+
feedback?: {
|
|
40
|
+
reason: string | null;
|
|
41
|
+
sentiment: "up" | "down";
|
|
42
|
+
} | null | undefined;
|
|
43
|
+
fromHistory?: boolean | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
export type BelongMessageMetadata = z.infer<typeof belongMessageMetadataSchema>;
|
|
@@ -30,9 +30,9 @@ declare const streamStateSchema: z.ZodObject<{
|
|
|
30
30
|
lastEventId: string | null;
|
|
31
31
|
}>;
|
|
32
32
|
export type PersistedStreamState = z.infer<typeof streamStateSchema>;
|
|
33
|
-
export declare const readStreamState: () => PersistedStreamState | null;
|
|
34
|
-
export declare const writeStreamState: (state: Omit<PersistedStreamState, "updatedAt"
|
|
35
|
-
export declare const clearStreamState: () => void;
|
|
33
|
+
export declare const readStreamState: (workspaceId?: string | null) => PersistedStreamState | null;
|
|
34
|
+
export declare const writeStreamState: (state: Omit<PersistedStreamState, "updatedAt">, workspaceId?: string | null) => void;
|
|
35
|
+
export declare const clearStreamState: (workspaceId?: string | null) => void;
|
|
36
36
|
/**
|
|
37
37
|
* Like {@link readStreamState}, but only returns state fresh enough that its
|
|
38
38
|
* run is worth reconnecting to. Returns null for stale state WITHOUT clearing
|
|
@@ -40,7 +40,7 @@ export declare const clearStreamState: () => void;
|
|
|
40
40
|
* and history restore on reload — only the *run* is too old to resume. A new
|
|
41
41
|
* message overwrites the cursor via {@link writeStreamState}.
|
|
42
42
|
*/
|
|
43
|
-
export declare const readResumableStreamState: () => PersistedStreamState | null;
|
|
43
|
+
export declare const readResumableStreamState: (workspaceId?: string | null) => PersistedStreamState | null;
|
|
44
44
|
/**
|
|
45
45
|
* Persist the chosen session as the active stream session (sessions menu
|
|
46
46
|
* switch / new). Passing a session id points the next ChatRoute mount at that
|
package/dist/types/public.d.ts
CHANGED
|
@@ -177,6 +177,17 @@ export type BelongGlobal = {
|
|
|
177
177
|
readonly setToken: (jwt: string) => void;
|
|
178
178
|
/** Switch the dock UI language at runtime (persisted; relabels live). */
|
|
179
179
|
readonly setLocale: (locale: BelongLocale) => void;
|
|
180
|
+
/**
|
|
181
|
+
* Switch the dock's workspace at runtime (workspace isolation). Re-scopes
|
|
182
|
+
* the whole dock synchronously — session list, Files tab, chat, and the
|
|
183
|
+
* agent's Simetrik CLI credential all follow the given workspace id (the
|
|
184
|
+
* same value `agentGrant.scopeExternalId` / the `scopeUrlParam` URL param
|
|
185
|
+
* carry). Wins over URL tracking until cleared with `null` (which falls
|
|
186
|
+
* back to the URL/static resolution). Invalid ids are ignored with a
|
|
187
|
+
* console warning. Hosts can use this standalone (no `scopeUrlParam`) or
|
|
188
|
+
* alongside URL tracking for instant switches.
|
|
189
|
+
*/
|
|
190
|
+
readonly setWorkspace: (id: string | null) => void;
|
|
180
191
|
readonly setTheme: (theme: PartialBelongTheme) => void;
|
|
181
192
|
readonly applyPreset: (name: PresetName) => void;
|
|
182
193
|
readonly open: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belonguniverseai/react-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
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",
|