@belonguniverseai/react-sdk 0.6.17 → 0.6.19
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/README.md +70 -8
- package/dist/api/account-connectors.d.ts +19 -10
- package/dist/api/client.d.ts +573 -44
- package/dist/api/connectors.d.ts +1 -0
- package/dist/api/queries.d.ts +1 -0
- package/dist/api/task-schedules.d.ts +8 -8
- package/dist/app/BelongDock.d.ts +2 -2
- package/dist/component/BelongWidget.d.ts +22 -1
- package/dist/component/{abnfDiagram-N423BO3Z-DQQzuYZD.js → abnfDiagram-N423BO3Z-p8pf1oUu.js} +4 -4
- package/dist/component/{arc-DyP79PGf.js → arc-CDN3jDNB.js} +2 -2
- package/dist/component/{architectureDiagram-T3A2C74G-D_elSQ1O.js → architectureDiagram-T3A2C74G-Dd8FlfDW.js} +3 -3
- package/dist/component/{blockDiagram-VBNYF7ZC-LCbtrdey.js → blockDiagram-VBNYF7ZC-CUgNh_GL.js} +4 -4
- package/dist/component/{c4Diagram-5PPSVZJV-BavpcOfZ.js → c4Diagram-5PPSVZJV-CSjftNi_.js} +3 -3
- package/dist/component/{channel-BZqwTbw2.js → channel-RXp4rUai.js} +2 -2
- package/dist/component/{chunk-2GRJ4B5K-CUnqSIZ_.js → chunk-2GRJ4B5K-Conm-Udw.js} +2 -2
- package/dist/component/{chunk-2Q5K7J3B-BXbvDQmH.js → chunk-2Q5K7J3B-BJVcNqca.js} +2 -2
- package/dist/component/{chunk-5RXB4S5H-9sfSr0mD.js → chunk-5RXB4S5H-ClnvuSUP.js} +5 -5
- package/dist/component/{chunk-5VM5RSS4-VnYY-ckg.js → chunk-5VM5RSS4-CZSg676A.js} +2 -2
- package/dist/component/{chunk-6Q2QTUOP-cjY3qI3C.js → chunk-6Q2QTUOP-d6e2hDQ3.js} +2 -2
- package/dist/component/{chunk-GF5L2VYU-B4uiGrvB.js → chunk-GF5L2VYU-DMNXiX_5.js} +6 -6
- package/dist/component/{chunk-JWPE2WC7-C_FwRGti.js → chunk-JWPE2WC7-Be-HKBKg.js} +2 -2
- package/dist/component/{chunk-KBJHAD2P-BThvKHPK.js → chunk-KBJHAD2P-CSs5ejAq.js} +2 -2
- package/dist/component/{chunk-RYQCIY6F-CNf0rdtW.js → chunk-RYQCIY6F-BM0CmhLz.js} +2 -2
- package/dist/component/{chunk-XXDRQBXY-BDEUQoWy.js → chunk-XXDRQBXY-Xj8K5wzT.js} +2 -2
- package/dist/component/{classDiagram-JCYQIIEL-Dp0ahzb0.js → classDiagram-JCYQIIEL-DTZI6cPh.js} +3 -3
- package/dist/component/{classDiagram-v2-OCEON4UE-Dp0ahzb0.js → classDiagram-v2-OCEON4UE-DTZI6cPh.js} +3 -3
- package/dist/component/{cose-bilkent-JH36ORCC-Dc-CE5JY.js → cose-bilkent-JH36ORCC-DaY5o18F.js} +2 -2
- package/dist/component/{cynefinDiagram-MW4NZA55-BA2fEkMD.js → cynefinDiagram-MW4NZA55-DoTeA4Ye.js} +3 -3
- package/dist/component/{dagre-VZM6K2ZE-B4d8ixBl.js → dagre-VZM6K2ZE-CF3eWDN_.js} +3 -3
- package/dist/component/{diagram-7IWD3JNH-DKOeWl-_.js → diagram-7IWD3JNH-D4CVwoPP.js} +4 -4
- package/dist/component/{diagram-B4RE2ZJO-DvvRtQm3.js → diagram-B4RE2ZJO-DTk-yH1g.js} +3 -3
- package/dist/component/{diagram-LBJQPF4R-DXFi21rR.js → diagram-LBJQPF4R-C82NaEDn.js} +3 -3
- package/dist/component/{diagram-Q27KOJAE-BkZNFrtu.js → diagram-Q27KOJAE-DVbW2GPm.js} +4 -4
- package/dist/component/{diagram-UB23O5K3-D_IJQzxk.js → diagram-UB23O5K3-fLwqL8Hl.js} +3 -3
- package/dist/component/{ebnfDiagram-BXEA7PRR-DD6VLDvv.js → ebnfDiagram-BXEA7PRR-BLEKzcRB.js} +4 -4
- package/dist/component/{erDiagram-JOGREHBK-D2GUhORW.js → erDiagram-JOGREHBK-D9srj1qV.js} +5 -5
- package/dist/component/{flowDiagram-UKHOOZJN-BO76VMQu.js → flowDiagram-UKHOOZJN-CeyLyzYo.js} +7 -7
- package/dist/component/{ganttDiagram-PKOTCBZU-DiZEbOvk.js → ganttDiagram-PKOTCBZU-D_wnN-8z.js} +3 -3
- package/dist/component/{gitGraphDiagram-DS77QQ5N-3JU_fIgh.js → gitGraphDiagram-DS77QQ5N-PeHi2KIR.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-DyUfTvlp.js → highlighted-body-OFNGDK62-CuSKYiPW.js} +2 -2
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-6WML65LV-wQDDhFdJ.js → infoDiagram-6WML65LV-CGnUeTPG.js} +2 -2
- package/dist/component/{ishikawaDiagram-WSZJBQD7-ByqLAAAH.js → ishikawaDiagram-WSZJBQD7-DhbZTdB_.js} +2 -2
- package/dist/component/{journeyDiagram-NVQOT4AX-CJrAO9iO.js → journeyDiagram-NVQOT4AX-DbAZyk3F.js} +5 -5
- package/dist/component/{kanban-definition-27J2QSJJ-BK-6EIGy.js → kanban-definition-27J2QSJJ-CPIUg4vz.js} +3 -3
- package/dist/component/{linear-5HARV3Z1.js → linear-CpcRfWUV.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-BYmG2b26.js → mermaid-GHXKKRXX-CnsSyJhK.js} +94531 -93143
- package/dist/component/{mindmap-definition-FAOFIHXS-CWZ3W_zW.js → mindmap-definition-FAOFIHXS-RIm66-oB.js} +4 -4
- package/dist/component/{pegDiagram-VL7TDLO6-DHCzlDWN.js → pegDiagram-VL7TDLO6-C6uB8Ash.js} +4 -4
- package/dist/component/{pieDiagram-7S7Q4E2Y-BbgPCeI4.js → pieDiagram-7S7Q4E2Y-6m7QqfK3.js} +4 -4
- package/dist/component/{quadrantDiagram-CIZ2JOQS-CVNb4Dn0.js → quadrantDiagram-CIZ2JOQS-Dge2oJ5y.js} +3 -3
- package/dist/component/{railroadDiagram-AXF67PYL-BZtclau2.js → railroadDiagram-AXF67PYL-DWfg1byS.js} +4 -4
- package/dist/component/{requirementDiagram-LRYGKXZP-DJeluZaM.js → requirementDiagram-LRYGKXZP-C_mrqai9.js} +4 -4
- package/dist/component/{sankeyDiagram-W5VNT64P-CxVyzRB-.js → sankeyDiagram-W5VNT64P-D1MhEv2a.js} +2 -2
- package/dist/component/{sequenceDiagram-SI44F4Z6-DrkHqtHC.js → sequenceDiagram-SI44F4Z6-mn9it5es.js} +4 -4
- package/dist/component/{sizeCapture-X5ZJPWSS-Ctgo1XlA.js → sizeCapture-X5ZJPWSS-Do_vnkJp.js} +2 -2
- package/dist/component/{stateDiagram-OKZ733FA-DhCABcA4.js → stateDiagram-OKZ733FA-Pru5Vhsh.js} +3 -3
- package/dist/component/{stateDiagram-v2-UEYNNEHI-D_zLh09v.js → stateDiagram-v2-UEYNNEHI-BvRl8AHY.js} +3 -3
- package/dist/component/{swimlanes-SLNWSIFB-C40PaZQK.js → swimlanes-SLNWSIFB-CfaY_lmO.js} +4 -4
- package/dist/component/{swimlanesDiagram-ULZ7WXOC-BIpHviIl.js → swimlanesDiagram-ULZ7WXOC-BFIfCk31.js} +3 -3
- package/dist/component/{timeline-definition-Z64GVDOM-Byx2AKIE.js → timeline-definition-Z64GVDOM-BFU8eZDJ.js} +3 -3
- package/dist/component/{vennDiagram-T6HMQDX7-CqLQjKUJ.js → vennDiagram-T6HMQDX7-C475K8TJ.js} +2 -2
- package/dist/component/{wardleyDiagram-T6FBY63Y-S9fJVDcY.js → wardleyDiagram-T6FBY63Y-DZEN3DyJ.js} +3 -3
- package/dist/component/{xychartDiagram-ELKLHX3M-B3t1Zyyn.js → xychartDiagram-ELKLHX3M-B6MDNNoT.js} +3 -3
- package/dist/components/connectors/ConnectorDetailsDialog.d.ts +5 -1
- package/dist/components/connectors/ConnectorSetupCard.d.ts +6 -0
- package/dist/components/connectors/NewConnectorDialog.d.ts +4 -1
- package/dist/components/connectors/authorization-popup.d.ts +3 -0
- package/dist/components/connectors/catalog-installation.d.ts +3 -0
- package/dist/components/connectors/connector-public-draft.d.ts +4 -0
- package/dist/components/connectors/use-connector-oauth.d.ts +1 -1
- package/dist/components/embed/AtMentionMenu.d.ts +1 -1
- package/dist/components/embed/ComposerMenu.d.ts +4 -1
- package/dist/components/embed/EmbedConversation.d.ts +3 -3
- package/dist/components/embed/EmbedRail.d.ts +4 -2
- package/dist/components/embed/MentionInput.d.ts +2 -1
- package/dist/components/embed/SlackConnection.d.ts +6 -0
- package/dist/components/embed/SlashCommandMenu.d.ts +1 -1
- package/dist/components/embed/WelcomeHero.d.ts +16 -0
- package/dist/components/embed/WelcomeIntro.d.ts +18 -7
- package/dist/components/embed/WelcomeSkills.d.ts +7 -1
- package/dist/components/embed/WorkspacePane.d.ts +16 -0
- package/dist/components/embed/onboarding-story-dock.d.ts +3 -2
- package/dist/components/embed/use-preview-content-props.d.ts +7 -0
- package/dist/components/embed/use-prompt-invocations.d.ts +40 -0
- package/dist/components/scheduled/SchedulePrompt.d.ts +10 -0
- package/dist/components/scheduled/schedule-prompt-message.d.ts +4 -0
- package/dist/embed/copy.d.ts +13 -18
- package/dist/embed/dev-mode.d.ts +1 -1
- package/dist/embed/dock-layout.d.ts +14 -16
- package/dist/embed/dock-size-store.d.ts +7 -0
- package/dist/embed/dock-state.d.ts +2 -2
- package/dist/embed/hover-capability.d.ts +14 -0
- package/dist/embed/page-context.d.ts +11 -0
- package/dist/embed/show-target.d.ts +6 -0
- package/dist/embed/slash-commands.d.ts +9 -0
- package/dist/embed/user-context.d.ts +14 -0
- package/dist/embed/voice-call.d.ts +7 -6
- package/dist/i18n/messages/en.d.ts +31 -3
- package/dist/i18n/messages/surfaces/connectors.d.ts +60 -0
- package/dist/i18n/messages/surfaces/embedMisc.d.ts +0 -6
- package/dist/i18n/messages/surfaces/header.d.ts +6 -0
- package/dist/i18n/messages/surfaces/stream.d.ts +3 -0
- package/dist/i18n/messages/surfaces/workspace.d.ts +32 -0
- package/dist/stream/ai-sdk-part-renderers.d.ts +2 -1
- package/dist/stream/belong-chat-transport.d.ts +9 -9
- package/dist/stream/use-agent-workspace-focus.d.ts +5 -0
- package/dist/stream/workspace-focus-observer.d.ts +7 -0
- package/dist/stream/workspace-focus-store.d.ts +26 -0
- package/dist/types/public.d.ts +39 -0
- package/package.json +1 -1
- package/dist/components/embed/CapabilityHints.d.ts +0 -4
package/README.md
CHANGED
|
@@ -34,18 +34,80 @@ export function App() {
|
|
|
34
34
|
|
|
35
35
|
### Props
|
|
36
36
|
|
|
37
|
-
| Prop | Type
|
|
38
|
-
| ---------------- |
|
|
39
|
-
| `getToken` | `() => Promise<string>`
|
|
40
|
-
| `backend` | `string`
|
|
41
|
-
| `universeOrigin` | `string`
|
|
42
|
-
| `agentId` | `string`
|
|
43
|
-
| `locale` | `BelongLocale`
|
|
44
|
-
| `panelEnabled` | `boolean`
|
|
37
|
+
| Prop | Type | Required | Description |
|
|
38
|
+
| ---------------- | ------------------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
39
|
+
| `getToken` | `() => Promise<string>` | yes | Resolves a bearer token per request (DI auth; never cached). |
|
|
40
|
+
| `backend` | `string` | yes | Belong backend base URL. |
|
|
41
|
+
| `universeOrigin` | `string` | no | **Deprecated, ignored.** Cross-origin navigation keys off `window.location`; safe to remove. |
|
|
42
|
+
| `agentId` | `string` | no | Sent as `X-Belong-Agent-Id` on every request. |
|
|
43
|
+
| `locale` | `BelongLocale` | no | Host/tenant default language (user choice still wins). |
|
|
44
|
+
| `panelEnabled` | `boolean` | no | Whether the active workspace shows the assistant panel. |
|
|
45
|
+
| `agentGrant` | `{ provider?: string; scopeExternalId?: string; scopeUrlParam?: string }` | no | Optional CLI agent-grant overrides. Most hosts need none of this — a scoped `workspace` already offers the default grant. |
|
|
46
|
+
| `workspace` | `string \| null` | no | Active workspace id — re-scopes sessions, files, chat, and the CLI grant on switch. `null` disables scoped surfaces while resolving; omit if unused. |
|
|
45
47
|
|
|
46
48
|
The dock renders into its own shadow root, so its styles never leak into (or
|
|
47
49
|
inherit from) your app.
|
|
48
50
|
|
|
51
|
+
### Host context (`window.belong.init`)
|
|
52
|
+
|
|
53
|
+
The script-tag embed's `init` takes two optional host-context props that
|
|
54
|
+
personalise what the dock shows before the first message:
|
|
55
|
+
|
|
56
|
+
| Prop | Type | Required | Description |
|
|
57
|
+
| ------------- | ------------------------------------------------- | -------- | ------------------------------------------------------------------- |
|
|
58
|
+
| `user` | `{ displayName?: string }` | no | Signed-in user; personalises the first message and the avatar menu. |
|
|
59
|
+
| `pageContext` | `{ label?: string; fromDocumentTitle?: boolean }` | no | Page label for the first message; defaults to the tab title. |
|
|
60
|
+
|
|
61
|
+
Both have runtime setters on `window.belong`, alongside `setLocale` and
|
|
62
|
+
`setWorkspace`:
|
|
63
|
+
|
|
64
|
+
- `belong.setUser({ displayName })` — wins over `init({ user })`. `setUser(null)`
|
|
65
|
+
drops the override back to the init value; `setUser({ displayName: null })`
|
|
66
|
+
means "no name for this user" and shows none even when `init` seeded one.
|
|
67
|
+
- `belong.setPageContext(label)` — wins over `init({ pageContext })` and the tab
|
|
68
|
+
title; `setPageContext(null)` drops the override. With no label anywhere, the
|
|
69
|
+
dock reads `document.title` live (SPA navigation updates it), unless the host
|
|
70
|
+
passed `pageContext: { fromDocumentTitle: false }`.
|
|
71
|
+
|
|
72
|
+
A re-`init` states the host's context in full: omitting `user` or
|
|
73
|
+
`pageContext` CLEARS what a previous `init` seeded (the config is replaced
|
|
74
|
+
wholesale, not merged). A live `setUser` / `setPageContext` override outranks
|
|
75
|
+
`init` and survives a later one — clear it with `null` to hand control back to
|
|
76
|
+
the init values.
|
|
77
|
+
|
|
78
|
+
Neither value is persisted — a reload re-derives both from the host's next
|
|
79
|
+
`init`.
|
|
80
|
+
|
|
81
|
+
## Account authorization and Content Security Policy
|
|
82
|
+
|
|
83
|
+
Browser-bound account authorization opens an `about:blank` popup, clears its
|
|
84
|
+
`opener`, and submits a form POST to the configured API's `browserBindingUrl`.
|
|
85
|
+
The popup inherits the embedding document's CSP even after its opener is cleared.
|
|
86
|
+
If that document restricts `form-action`, allow both the API bootstrap origin and
|
|
87
|
+
the authorization provider's origin in every enforced policy. Chromium also checks
|
|
88
|
+
the bootstrap's 303 redirect against this policy; allowing only the API is not enough.
|
|
89
|
+
|
|
90
|
+
For example, a deployment using the public Microsoft login service could use:
|
|
91
|
+
|
|
92
|
+
```http
|
|
93
|
+
Content-Security-Policy: form-action 'self' https://your-belong-backend.example.com https://login.microsoftonline.com
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Merge those hosts into your existing policy, using your actual API and configured
|
|
97
|
+
provider origins (including any required redirect destinations). A same-origin API
|
|
98
|
+
proxy is covered by `'self'`; the external provider still needs permission. Existing
|
|
99
|
+
`connect-src` and API allowed-origin requirements continue to apply independently.
|
|
100
|
+
|
|
101
|
+
An enforced `form-action` violation closes the popup and shows the existing
|
|
102
|
+
authorization failure UI. Users can retry with the Connect/Reconnect action after
|
|
103
|
+
the host policy is fixed. The SDK does not bypass CSP or offer direct provider
|
|
104
|
+
navigation for bound responses. Proofs travel only in the POST body, never in URLs.
|
|
105
|
+
The popup uses referrer policy `origin` so bootstrap POSTs retain a trustworthy
|
|
106
|
+
`Origin` header; the backend redirect should send `Referrer-Policy: no-referrer`.
|
|
107
|
+
|
|
108
|
+
Run the SDK's real Chromium checks (including cross-origin CSP and manual fallback)
|
|
109
|
+
from this package with `node --test tests/browser/authorization-popup.mjs`.
|
|
110
|
+
|
|
49
111
|
## Voice calls (new in 0.2.0)
|
|
50
112
|
|
|
51
113
|
The dock's rail now carries a phone button: a real two-way **voice call** with a
|
|
@@ -30,9 +30,9 @@ declare const accountConnectorSchema: z.ZodObject<{
|
|
|
30
30
|
disconnect: "disconnect";
|
|
31
31
|
}>;
|
|
32
32
|
label: z.ZodEnum<{
|
|
33
|
+
reconnect: "reconnect";
|
|
33
34
|
disconnect: "disconnect";
|
|
34
35
|
connect: "connect";
|
|
35
|
-
reconnect: "reconnect";
|
|
36
36
|
grant_admin_consent: "grant_admin_consent";
|
|
37
37
|
}>;
|
|
38
38
|
tone: z.ZodEnum<{
|
|
@@ -43,15 +43,21 @@ declare const accountConnectorSchema: z.ZodObject<{
|
|
|
43
43
|
requiresConfirmation: z.ZodBoolean;
|
|
44
44
|
}, z.core.$strip>>;
|
|
45
45
|
}, z.core.$strip>;
|
|
46
|
-
declare const accountConnectorActionResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
47
|
-
kind: z.ZodLiteral<"authorization">;
|
|
48
|
-
authorizationUrl: z.ZodURL;
|
|
49
|
-
completion: z.ZodLiteral<"action_unavailable">;
|
|
50
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
51
|
-
kind: z.ZodLiteral<"completed">;
|
|
52
|
-
}, z.core.$strip>], "kind">;
|
|
53
46
|
export type AccountConnector = z.infer<typeof accountConnectorSchema>;
|
|
54
|
-
export type
|
|
47
|
+
export type AccountConnectorAuthorization = {
|
|
48
|
+
readonly kind: "authorization";
|
|
49
|
+
readonly authorizationUrl: string;
|
|
50
|
+
readonly completion: "action_unavailable";
|
|
51
|
+
} & ({
|
|
52
|
+
readonly browserBindingUrl: string;
|
|
53
|
+
readonly browserProof: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly browserBindingUrl?: never;
|
|
56
|
+
readonly browserProof?: never;
|
|
57
|
+
});
|
|
58
|
+
export type AccountConnectorActionResult = AccountConnectorAuthorization | {
|
|
59
|
+
readonly kind: "completed";
|
|
60
|
+
};
|
|
55
61
|
export type AccountConnectorListResult = {
|
|
56
62
|
readonly status: "ready";
|
|
57
63
|
readonly connectors: readonly AccountConnector[];
|
|
@@ -82,5 +88,8 @@ export type RunAccountConnectorActionResult = AccountConnectorActionResult | Acc
|
|
|
82
88
|
export declare const listAccountConnectorsRequest: (api: ApiClient, signal?: AbortSignal) => Promise<AccountConnectorListResult>;
|
|
83
89
|
export declare const runAccountConnectorActionRequest: (api: ApiClient, input: RunAccountConnectorActionInput) => Promise<RunAccountConnectorActionResult>;
|
|
84
90
|
export declare const useAccountConnectors: () => import('@tanstack/react-query').UseQueryResult<NoInfer<AccountConnectorListResult>, Error>;
|
|
85
|
-
export declare const useRunAccountConnectorAction: () =>
|
|
91
|
+
export declare const useRunAccountConnectorAction: () => {
|
|
92
|
+
mutateAsync: (input: RunAccountConnectorActionInput) => Promise<RunAccountConnectorActionResult>;
|
|
93
|
+
isPending: boolean;
|
|
94
|
+
};
|
|
86
95
|
export {};
|