@belonguniverseai/react-sdk 0.6.32 → 0.6.33

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 (108) hide show
  1. package/dist/api/account-connectors.d.ts +2 -2
  2. package/dist/api/client.d.ts +1114 -78
  3. package/dist/api/goals.d.ts +4 -4
  4. package/dist/api/quota-refusal.d.ts +49 -0
  5. package/dist/api/secret-paste.d.ts +5 -0
  6. package/dist/api/suggestions.d.ts +18 -0
  7. package/dist/api/task-schedule-sharing.d.ts +13 -1
  8. package/dist/api/task-schedules.d.ts +33 -4
  9. package/dist/api/vault.d.ts +49 -0
  10. package/dist/app/dock-story-data.d.ts +6 -0
  11. package/dist/component/{abnfDiagram-N423BO3Z-Cs6vuzym.js → abnfDiagram-N423BO3Z-CK4wvzwz.js} +4 -4
  12. package/dist/component/{architectureDiagram-T3A2C74G-BdBpK2d_.js → architectureDiagram-T3A2C74G-DoljsqqO.js} +6 -6
  13. package/dist/component/{blockDiagram-VBNYF7ZC-Cf6dsn1j.js → blockDiagram-VBNYF7ZC-Ie7SErpH.js} +8 -8
  14. package/dist/component/{c4Diagram-5PPSVZJV-Cxt2hfnn.js → c4Diagram-5PPSVZJV-rfEof5mj.js} +4 -4
  15. package/dist/component/{channel-COtJQ6CP.js → channel-C5ABP6lE.js} +2 -2
  16. package/dist/component/{chunk-2GRJ4B5K-C14K2lKj.js → chunk-2GRJ4B5K-CWOCv67u.js} +2 -2
  17. package/dist/component/{chunk-3NCLNEKW-oHacP_OI.js → chunk-3NCLNEKW-BJYANBvv.js} +2 -2
  18. package/dist/component/{chunk-4I5QYGJK-CGOVqmKQ.js → chunk-4I5QYGJK-C29OfER5.js} +2 -2
  19. package/dist/component/{chunk-5RXB4S5H-CMJnmUzX.js → chunk-5RXB4S5H-D__NH4Op.js} +6 -6
  20. package/dist/component/{chunk-6Q2QTUOP-B5ACmZa2.js → chunk-6Q2QTUOP-BgSQgII8.js} +3 -3
  21. package/dist/component/{chunk-7Z6QIM7H-CSfSb_Xc.js → chunk-7Z6QIM7H-vNexNF_V.js} +8 -8
  22. package/dist/component/{chunk-GF5L2VYU-xi_oDTd2.js → chunk-GF5L2VYU-D3vxqomE.js} +6 -6
  23. package/dist/component/{chunk-I66GZJ75-DB1sFGc-.js → chunk-I66GZJ75-Dkw1ISGd.js} +2 -2
  24. package/dist/component/{chunk-J7OUQ5F2-DB9d7Gt_.js → chunk-J7OUQ5F2-dC67pJWg.js} +7 -7
  25. package/dist/component/{chunk-JQJVKLGR-De7zUJDv.js → chunk-JQJVKLGR-Djj9TdhH.js} +8 -8
  26. package/dist/component/{chunk-KBJHAD2P-CVoxmRa8.js → chunk-KBJHAD2P-dwIA6Vmi.js} +2 -2
  27. package/dist/component/{chunk-NSK5VX7P-ur_ZGcVX.js → chunk-NSK5VX7P-thQxjtNK.js} +2 -2
  28. package/dist/component/{chunk-QR6OTTB3-Bl3Z_jKC.js → chunk-QR6OTTB3-OMd-rgNj.js} +7 -7
  29. package/dist/component/{chunk-UBXNYLIW-CDKeQUnO.js → chunk-UBXNYLIW-D26S6zO6.js} +3 -3
  30. package/dist/component/{chunk-W5SLKNZC-Dq8uD14N.js → chunk-W5SLKNZC-DLV7M8by.js} +2 -2
  31. package/dist/component/{chunk-WRU74C26-BwQb4DnE.js → chunk-WRU74C26-13bvIAgD.js} +4 -4
  32. package/dist/component/{classDiagram-JCYQIIEL-yl7JabGO.js → classDiagram-JCYQIIEL-BFQ72AZA.js} +13 -13
  33. package/dist/component/{classDiagram-v2-OCEON4UE-ozBAEvyC.js → classDiagram-v2-OCEON4UE-UFfArXpP.js} +13 -13
  34. package/dist/component/{component-DnTvWVQQ.js → component-Bhs6PFPY.js} +22656 -21083
  35. package/dist/component/{cynefinDiagram-MW4NZA55-fdKo3DVx.js → cynefinDiagram-MW4NZA55-Bgfw8c41.js} +4 -4
  36. package/dist/component/{dagre-VZM6K2ZE-C7nAehQV.js → dagre-VZM6K2ZE-CQoUcF3S.js} +9 -9
  37. package/dist/component/{diagram-7IWD3JNH-DRM3Hv3P.js → diagram-7IWD3JNH-C8-mvAEv.js} +5 -5
  38. package/dist/component/{diagram-B4RE2ZJO-DXqATSZd.js → diagram-B4RE2ZJO-BATqCIx3.js} +3 -3
  39. package/dist/component/{diagram-LBJQPF4R-DJRJfBnF.js → diagram-LBJQPF4R-DwRMRXWz.js} +4 -4
  40. package/dist/component/{diagram-Q27KOJAE-B4cTzsYZ.js → diagram-Q27KOJAE-D6gO0LTm.js} +6 -6
  41. package/dist/component/{diagram-UB23O5K3-CyUjYCbX.js → diagram-UB23O5K3-4nOrWHql.js} +4 -4
  42. package/dist/component/{ebnfDiagram-BXEA7PRR-C6GS4eTe.js → ebnfDiagram-BXEA7PRR-DCO-Nj3k.js} +4 -4
  43. package/dist/component/{erDiagram-JOGREHBK-D8qt0_mW.js → erDiagram-JOGREHBK-hWtImhPN.js} +12 -12
  44. package/dist/component/flowDiagram-UKHOOZJN-8qLgX2Wv.js +19 -0
  45. package/dist/component/{ganttDiagram-PKOTCBZU-D6o-gloU.js → ganttDiagram-PKOTCBZU-BE8Mqoej.js} +3 -3
  46. package/dist/component/{gitGraphDiagram-DS77QQ5N-Cz3kf7xj.js → gitGraphDiagram-DS77QQ5N-DURS7rAN.js} +3 -3
  47. package/dist/component/index.js +2 -2
  48. package/dist/component/{infoDiagram-6WML65LV-sdz8qoTE.js → infoDiagram-6WML65LV-BqBxR6YB.js} +3 -3
  49. package/dist/component/{ishikawaDiagram-WSZJBQD7--tUiPVAr.js → ishikawaDiagram-WSZJBQD7-CnYZd1Dq.js} +4 -4
  50. package/dist/component/{journeyDiagram-NVQOT4AX-_-TjqBid.js → journeyDiagram-NVQOT4AX-Cgkpx4Qx.js} +3 -3
  51. package/dist/component/{kanban-definition-27J2QSJJ-BXBySx2U.js → kanban-definition-27J2QSJJ-CJSdhT0i.js} +9 -9
  52. package/dist/component/{line-C2WkjBlg.js → line-BBEHlpsV.js} +2 -2
  53. package/dist/component/{mindmap-definition-FAOFIHXS-CbpSDN_k.js → mindmap-definition-FAOFIHXS-DgHouLA-.js} +11 -11
  54. package/dist/component/{pegDiagram-VL7TDLO6-Cp_Wn0PS.js → pegDiagram-VL7TDLO6-B_iGQ6sI.js} +4 -4
  55. package/dist/component/{pieDiagram-7S7Q4E2Y-D6KGBWSF.js → pieDiagram-7S7Q4E2Y-g7GxM0JA.js} +4 -4
  56. package/dist/component/{quadrantDiagram-CIZ2JOQS-BWjdUg-z.js → quadrantDiagram-CIZ2JOQS-Bp7z4raq.js} +2 -2
  57. package/dist/component/{railroadDiagram-AXF67PYL-B5iYZXm-.js → railroadDiagram-AXF67PYL-CYx3PP5o.js} +4 -4
  58. package/dist/component/{requirementDiagram-LRYGKXZP-CewRkYfE.js → requirementDiagram-LRYGKXZP-BJNRJceo.js} +11 -11
  59. package/dist/component/{sankeyDiagram-W5VNT64P-D3Zb5dQ6.js → sankeyDiagram-W5VNT64P-Cf0tVHbW.js} +2 -2
  60. package/dist/component/{sequenceDiagram-SI44F4Z6-BfxhjyrN.js → sequenceDiagram-SI44F4Z6-BsAsKMRH.js} +4 -4
  61. package/dist/component/{stateDiagram-OKZ733FA-DLd9YI1A.js → stateDiagram-OKZ733FA-Bpk0vtTK.js} +14 -14
  62. package/dist/component/{stateDiagram-v2-UEYNNEHI-Dd_FaBaY.js → stateDiagram-v2-UEYNNEHI-CJFoUvD2.js} +13 -13
  63. package/dist/component/{swimlanes-SLNWSIFB-C56sHJuV.js → swimlanes-SLNWSIFB-Be5A0lwq.js} +9 -9
  64. package/dist/component/{swimlanesDiagram-ULZ7WXOC-nHtka4qn.js → swimlanesDiagram-ULZ7WXOC-J8VNaPhM.js} +13 -13
  65. package/dist/component/{timeline-definition-Z64GVDOM-JYR_6zGi.js → timeline-definition-Z64GVDOM-CU9PEkPY.js} +4 -4
  66. package/dist/component/{vennDiagram-T6HMQDX7-CEGGwXxv.js → vennDiagram-T6HMQDX7-Cno78tFK.js} +4 -4
  67. package/dist/component/{wardleyDiagram-T6FBY63Y-zZGm618Q.js → wardleyDiagram-T6FBY63Y-BEb1Rn5J.js} +4 -4
  68. package/dist/component/{xychartDiagram-ELKLHX3M-BYbnWmqD.js → xychartDiagram-ELKLHX3M-BwjMczCl.js} +7 -7
  69. package/dist/components/embed/EmbedRail.d.ts +8 -1
  70. package/dist/components/embed/NextStepCard.d.ts +6 -0
  71. package/dist/components/embed/QuotaNoticeCard.d.ts +4 -0
  72. package/dist/components/embed/SessionSwitcher.d.ts +6 -1
  73. package/dist/components/embed/quota-notice-copy.d.ts +3 -0
  74. package/dist/components/scheduled/schedule-dialog-model.d.ts +2 -1
  75. package/dist/components/scheduled/schedule-format.d.ts +4 -1
  76. package/dist/components/vault/SecretPasteFeedback.d.ts +6 -0
  77. package/dist/components/vault/SecretsPanel.d.ts +23 -0
  78. package/dist/components/vault/vault-open.d.ts +3 -0
  79. package/dist/embed/goal-edit-command.d.ts +6 -1
  80. package/dist/embed/quota-notice.d.ts +9 -0
  81. package/dist/embed/theme.d.ts +10 -0
  82. package/dist/embed/voice/agent-spawn.d.ts +12 -2
  83. package/dist/embed/voice-call.d.ts +4 -1
  84. package/dist/i18n/messages/en.d.ts +55 -0
  85. package/dist/i18n/messages/surfaces/quota.d.ts +69 -0
  86. package/dist/i18n/messages/surfaces/scheduled.d.ts +32 -0
  87. package/dist/i18n/messages/surfaces/settings.d.ts +8 -0
  88. package/dist/i18n/messages/surfaces/stream.d.ts +4 -0
  89. package/dist/i18n/messages/surfaces/vault.d.ts +120 -0
  90. package/dist/lib/use-tab-leadership.d.ts +1 -0
  91. package/dist/routes/chat/history-cache.d.ts +5 -0
  92. package/dist/routes/chat/question-parts.d.ts +26 -0
  93. package/dist/routes/chat/queued-delivery.d.ts +20 -0
  94. package/dist/routes/chat/queued-messages.d.ts +15 -0
  95. package/dist/routes/chat/session-api.d.ts +52 -0
  96. package/dist/routes/chat/session-history-api.d.ts +9 -0
  97. package/dist/routes/chat/transcript-update.d.ts +45 -0
  98. package/dist/routes/chat/use-catch-up-on-return.d.ts +7 -0
  99. package/dist/routes/chat/use-next-step-suggestion.d.ts +38 -0
  100. package/dist/routes/chat/use-quota-notice.d.ts +29 -0
  101. package/dist/routes/chat/use-quota-stop-refresh.d.ts +27 -0
  102. package/dist/routes/chat/use-session-goal.d.ts +6 -0
  103. package/dist/routes/chat.d.ts +9 -15
  104. package/dist/stream/belong-chat-transport.d.ts +17 -2
  105. package/dist/stream/belong-data-parts.d.ts +31 -1
  106. package/dist/stream/provider-blocked.d.ts +16 -0
  107. package/package.json +1 -1
  108. package/dist/component/flowDiagram-UKHOOZJN-U55NEBew.js +0 -19
@@ -0,0 +1,120 @@
1
+ export declare const vaultEn: {
2
+ readonly vault: {
3
+ readonly title: "Secrets";
4
+ readonly description: "Save credentials for your own use across workspaces. Only their names and references are shown to the agent.";
5
+ readonly add: "Add secret";
6
+ readonly empty: "No secrets saved.";
7
+ readonly loading: "Loading secrets…";
8
+ readonly unavailable: "Secrets are unavailable here. Remove credentials from your message before sending.";
9
+ readonly name: "Name";
10
+ readonly nameHint: "Use lowercase letters, numbers and hyphens. Names cannot be changed.";
11
+ readonly kind: "Kind";
12
+ readonly apiKey: "API key";
13
+ readonly pem: "PEM private key";
14
+ readonly value: "Secret value";
15
+ readonly save: "Save";
16
+ readonly saveSecret: "Save secret";
17
+ readonly captureHint: "Secret detected. Save it securely; only its reference will be included in your message.";
18
+ readonly saving: "Saving…";
19
+ readonly cancel: "Cancel";
20
+ readonly replace: "Replace value";
21
+ readonly delete: "Delete";
22
+ readonly deleteConfirm: "Delete {{name}}? Commands using this reference will no longer work.";
23
+ readonly nameTaken: "That name is already in use.";
24
+ readonly notFound: "This secret no longer exists. Refresh and try again.";
25
+ readonly invalidInput: "Check the name and secret value.";
26
+ readonly requestFailed: "Could not update secrets. Try again.";
27
+ readonly forbidden: "You do not have access to secrets.";
28
+ readonly pasteBlocked: "This text looks like a credential. Remove it from your message and save it as a secret.";
29
+ };
30
+ };
31
+ export declare const vaultEs: {
32
+ vault: {
33
+ title: string;
34
+ description: string;
35
+ add: string;
36
+ empty: string;
37
+ loading: string;
38
+ unavailable: string;
39
+ name: string;
40
+ nameHint: string;
41
+ kind: string;
42
+ apiKey: string;
43
+ pem: string;
44
+ value: string;
45
+ save: string;
46
+ saveSecret: string;
47
+ captureHint: string;
48
+ saving: string;
49
+ cancel: string;
50
+ replace: string;
51
+ delete: string;
52
+ deleteConfirm: string;
53
+ nameTaken: string;
54
+ notFound: string;
55
+ invalidInput: string;
56
+ requestFailed: string;
57
+ forbidden: string;
58
+ pasteBlocked: string;
59
+ };
60
+ };
61
+ export declare const vaultPt: {
62
+ vault: {
63
+ title: string;
64
+ description: string;
65
+ add: string;
66
+ empty: string;
67
+ loading: string;
68
+ unavailable: string;
69
+ name: string;
70
+ nameHint: string;
71
+ kind: string;
72
+ apiKey: string;
73
+ pem: string;
74
+ value: string;
75
+ save: string;
76
+ saveSecret: string;
77
+ captureHint: string;
78
+ saving: string;
79
+ cancel: string;
80
+ replace: string;
81
+ delete: string;
82
+ deleteConfirm: string;
83
+ nameTaken: string;
84
+ notFound: string;
85
+ invalidInput: string;
86
+ requestFailed: string;
87
+ forbidden: string;
88
+ pasteBlocked: string;
89
+ };
90
+ };
91
+ export declare const vaultIt: {
92
+ vault: {
93
+ title: string;
94
+ description: string;
95
+ add: string;
96
+ empty: string;
97
+ loading: string;
98
+ unavailable: string;
99
+ name: string;
100
+ nameHint: string;
101
+ kind: string;
102
+ apiKey: string;
103
+ pem: string;
104
+ value: string;
105
+ save: string;
106
+ saveSecret: string;
107
+ captureHint: string;
108
+ saving: string;
109
+ cancel: string;
110
+ replace: string;
111
+ delete: string;
112
+ deleteConfirm: string;
113
+ nameTaken: string;
114
+ notFound: string;
115
+ invalidInput: string;
116
+ requestFailed: string;
117
+ forbidden: string;
118
+ pasteBlocked: string;
119
+ };
120
+ };
@@ -2,5 +2,6 @@ import { TabRole } from './tab-leadership.ts';
2
2
  /** The persisted server id replaces a new Session's per-tab placeholder. */
3
3
  export declare const useTabLeadership: (chatId: string) => {
4
4
  readonly role: TabRole;
5
+ readonly ownedElsewhere: boolean;
5
6
  readonly requestControl: () => void;
6
7
  };
@@ -39,6 +39,11 @@ export declare const refreshNewestHistoryPage: (client: QueryClient, scope: Hist
39
39
  * and not marked stale by a turn that finished since.
40
40
  */
41
41
  export declare const peekNewestHistoryPage: (client: QueryClient, scope: HistoryScope) => LoadedHistoryPage | null;
42
+ /**
43
+ * A session this dock just created has no turns, so its newest page is known
44
+ * without asking. Opening it paints at once, with no spinner and no read.
45
+ */
46
+ export declare const seedEmptyNewestHistoryPage: (client: QueryClient, scope: HistoryScope) => void;
42
47
  /** A turn finished: the cached newest page no longer holds the chat's end. */
43
48
  export declare const markNewestHistoryPageStale: (client: QueryClient, scope: HistoryScope) => void;
44
49
  /** Drop every cached page of one chat (deleted), in any workspace. */
@@ -0,0 +1,26 @@
1
+ import { AnswerQuestionResult } from '../../api/questions.ts';
2
+ import { BelongUIMessage, ChoiceRequestData } from '../../stream/belong-data-parts.ts';
3
+ /**
4
+ * Plan 013 — rewrite the transcript's `data-choice-request` part for one
5
+ * question with its resolved shape, so the record reads exactly as it will
6
+ * after a reload (the history patch) without waiting for the wire; the live
7
+ * same-id part that follows overwrites it with the identical state. Every
8
+ * other message keeps its identity (no churn for the renderers).
9
+ */
10
+ export declare const patchChoicePart: (messages: readonly BelongUIMessage[], resolved: ChoiceRequestData) => BelongUIMessage[];
11
+ /**
12
+ * Plan 013 — Stop's local un-arm: the newest `pending` question flips to
13
+ * `cancelled`, exactly as the server's abort path flips its row. Walks the
14
+ * transcript itself rather than the derived card: X only HIDES a card in
15
+ * this tab, and a question hidden here is still cancelled by Stop — the
16
+ * record must read the same as it will after a reload (§41).
17
+ */
18
+ export declare const cancelPendingQuestion: (messages: readonly BelongUIMessage[]) => BelongUIMessage[];
19
+ /**
20
+ * Plan 013 — the part as the server's 409 says it settled: the row of record
21
+ * (another tab's answer / reply, a Stop's `cancelled`, a dismissal), which is
22
+ * what a reload would show — never an `answered` synthesised from nothing.
23
+ */
24
+ export declare const rowOfRecord: (question: ChoiceRequestData, settled: Extract<AnswerQuestionResult, {
25
+ reason: "already_resolved";
26
+ }>) => ChoiceRequestData;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { BelongChatTransport } from '../../stream/belong-chat-transport.ts';
3
+ import { QuotaNoticeData } from '../../stream/belong-data-parts.ts';
4
+ import { QueuedMessageOutboxEntry } from '../../stream/queued-message-outbox.ts';
5
+ declare const postMessageResponseSchema: z.ZodObject<{
6
+ messageId: z.ZodString;
7
+ taskId: z.ZodString;
8
+ runId: z.ZodString;
9
+ idempotent: z.ZodBoolean;
10
+ }, z.core.$strip>;
11
+ type QueuedMessageAccepted = z.infer<typeof postMessageResponseSchema> & {
12
+ readonly kind: "accepted";
13
+ };
14
+ export type QueuedMessagePostOwner = {
15
+ readonly kind: "queued-message-post-owner";
16
+ };
17
+ export declare const releaseQueuedMessagePostOwner: (owner: QueuedMessagePostOwner) => void;
18
+ export declare const persistAndPostQueuedMessage: (apiBaseUrl: string, entry: QueuedMessageOutboxEntry, owner: QueuedMessagePostOwner, onFailure: () => void, onAccepted?: (result: QueuedMessageAccepted) => void, onQuotaRefused?: (notice: QuotaNoticeData) => void) => void;
19
+ export declare const persistNewQueuedMessage: (apiBaseUrl: string, entry: QueuedMessageOutboxEntry, owner: QueuedMessagePostOwner, replayedIds: Set<string>, onFailure: () => void, onQuotaRefused: (notice: QuotaNoticeData) => void, timingTransport?: BelongChatTransport) => void;
20
+ export {};
@@ -0,0 +1,15 @@
1
+ import { BelongUIMessage, QuotaNoticeData } from '../../stream/belong-data-parts.ts';
2
+ export type QueuedMessage = {
3
+ readonly clientId: string;
4
+ readonly text: string;
5
+ readonly submittedAt: number;
6
+ } & ({
7
+ readonly state: "queued" | "failed";
8
+ } | {
9
+ readonly state: "quota_refused";
10
+ readonly notice: QuotaNoticeData;
11
+ });
12
+ export declare const queuedTurnHasReply: (history: readonly BelongUIMessage[], text: string) => boolean;
13
+ export declare const dropQueuedLandedIn: (history: readonly BelongUIMessage[]) => (prev: readonly QueuedMessage[]) => readonly QueuedMessage[];
14
+ export declare const markQueuedFailed: (clientId: string) => (prev: readonly QueuedMessage[]) => readonly QueuedMessage[];
15
+ export declare const markQueuedQuotaRefused: (clientId: string, notice: QuotaNoticeData) => (prev: readonly QueuedMessage[]) => readonly QueuedMessage[];
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ import { ActiveRunLookup } from './use-catch-up-on-return.ts';
3
+ import { BelongChatTransport, RecalledQueuedMessage } from '../../stream/belong-chat-transport.ts';
4
+ type SessionApiResult = {
5
+ readonly ok: true;
6
+ readonly body: unknown;
7
+ } | {
8
+ readonly ok: false;
9
+ readonly status: number | null;
10
+ readonly body: unknown;
11
+ };
12
+ export declare const sessionApiFetch: (apiBaseUrl: string, sessionId: string, path: "messages" | "compact" | "clear" | "active-run", init?: RequestInit, query?: URLSearchParams) => Promise<SessionApiResult>;
13
+ declare const activeRunResponseSchema: z.ZodUnion<readonly [z.ZodNull, z.ZodObject<{
14
+ runId: z.ZodString;
15
+ status: z.ZodEnum<{
16
+ queued: "queued";
17
+ waiting_for_approval: "waiting_for_approval";
18
+ running: "running";
19
+ waiting_for_user: "waiting_for_user";
20
+ waiting_for_ui_action: "waiting_for_ui_action";
21
+ recovering: "recovering";
22
+ cancelling: "cancelling";
23
+ }>;
24
+ }, z.core.$strip>]>;
25
+ type ActiveRunInfo = z.infer<typeof activeRunResponseSchema>;
26
+ export declare const loadActiveRun: (apiBaseUrl: string, sessionId: string) => Promise<ActiveRunInfo>;
27
+ export declare const lookUpActiveRun: (apiBaseUrl: string, sessionId: string) => Promise<ActiveRunLookup>;
28
+ export declare const cancelRunForStop: (input: {
29
+ readonly apiBaseUrl: string;
30
+ readonly transport: BelongChatTransport;
31
+ readonly runId: string | null;
32
+ readonly sessionId: string | null;
33
+ }) => Promise<readonly RecalledQueuedMessage[]>;
34
+ type CompactOutcome = {
35
+ readonly status: "compacted";
36
+ readonly messagesCompacted: number;
37
+ } | {
38
+ readonly status: "noop";
39
+ } | {
40
+ readonly status: "busy";
41
+ } | {
42
+ readonly status: "error";
43
+ };
44
+ export declare const compactSession: (apiBaseUrl: string, sessionId: string) => Promise<CompactOutcome>;
45
+ export declare const compactNoticeText: (outcome: CompactOutcome) => string;
46
+ type ClearOutcome = {
47
+ readonly status: "cleared";
48
+ } | {
49
+ readonly status: "error";
50
+ };
51
+ export declare const clearSession: (apiBaseUrl: string, sessionId: string) => Promise<ClearOutcome>;
52
+ export {};
@@ -0,0 +1,9 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { HistoryPageResult, HistoryScope } from './history-cache.ts';
3
+ export declare const loadSessionHistory: (apiBaseUrl: string, sessionId: string, before?: string) => Promise<HistoryPageResult>;
4
+ /**
5
+ * Read a chat's newest page ahead of opening it (the Chats list's
6
+ * `SessionIntentContext`), so it opens painted from the cache. A chat kept
7
+ * live needs no read; a page read in the last 30 s is not read again.
8
+ */
9
+ export declare const prefetchChatHistory: (queryClient: QueryClient, apiBaseUrl: string, scope: HistoryScope) => void;
@@ -0,0 +1,45 @@
1
+ import { BelongUIMessage } from '../../stream/belong-data-parts.ts';
2
+ import { LoadedHistoryPage } from './history-cache.ts';
3
+ import { HistoryPaging } from './history-paging.ts';
4
+ export type TranscriptEvent = {
5
+ readonly kind: "history_restored";
6
+ readonly page: LoadedHistoryPage;
7
+ readonly onScreen: readonly BelongUIMessage[];
8
+ } | {
9
+ readonly kind: "caught_up";
10
+ readonly page: LoadedHistoryPage;
11
+ readonly caughtUp: BelongUIMessage[];
12
+ } | {
13
+ readonly kind: "compacted";
14
+ readonly page: LoadedHistoryPage;
15
+ } | {
16
+ readonly kind: "quota_stopped";
17
+ readonly page: LoadedHistoryPage;
18
+ } | {
19
+ readonly kind: "queued_reply_landed";
20
+ readonly history: readonly BelongUIMessage[];
21
+ /** Asked when React applies the update: a Clear or a new turn may come first. */
22
+ readonly canApply: () => boolean;
23
+ } | {
24
+ readonly kind: "older_page_loaded";
25
+ readonly page: LoadedHistoryPage;
26
+ readonly expectedFirstId: string;
27
+ } | {
28
+ readonly kind: "cleared";
29
+ } | {
30
+ readonly kind: "unsaved_chat_cleared";
31
+ };
32
+ type CursorUpdate = {
33
+ readonly kind: "keep";
34
+ } | {
35
+ readonly kind: "set";
36
+ readonly id: string | null;
37
+ };
38
+ export type TranscriptUpdate = {
39
+ readonly messages: BelongUIMessage[] | ((current: BelongUIMessage[]) => BelongUIMessage[]);
40
+ readonly paging: HistoryPaging | ((paging: HistoryPaging) => HistoryPaging) | null;
41
+ readonly historyThrough: CursorUpdate;
42
+ readonly spokenThrough: CursorUpdate;
43
+ };
44
+ export declare const transcriptUpdateFor: (event: TranscriptEvent) => TranscriptUpdate;
45
+ export {};
@@ -66,5 +66,12 @@ export declare const useCatchUpOnReturn: (input: {
66
66
  readonly controlRequestId?: number;
67
67
  readonly prepareControl?: (sessionId: string) => Promise<void>;
68
68
  readonly onControlReady?: (ready: boolean) => void;
69
+ /**
70
+ * This mount shows a session this tab created a moment ago. Its first
71
+ * promotion has nothing to catch up on, so writing is not held for the reads.
72
+ * Only the first: if control ever moves to another tab and back, this tab
73
+ * catches up like any other.
74
+ */
75
+ readonly justCreated?: boolean;
69
76
  readonly returnOptions?: Parameters<typeof useReturnToPage>[1];
70
77
  }) => void;
@@ -0,0 +1,38 @@
1
+ import { UseChatHelpers } from '@ai-sdk/react';
2
+ import { NextStepSuggestion } from '../../api/suggestions.ts';
3
+ import { GoalStatus } from '../../api/goals.ts';
4
+ import { BelongUIMessage } from '../../stream/belong-data-parts.ts';
5
+ type ChatStatus = UseChatHelpers<BelongUIMessage>["status"];
6
+ export type UseNextStepSuggestionInput = {
7
+ readonly apiBaseUrl: string;
8
+ readonly sessionId: string | null;
9
+ readonly locale: string;
10
+ readonly status: ChatStatus;
11
+ readonly lastMessage: {
12
+ readonly role: string;
13
+ } | null;
14
+ readonly draftEmpty: boolean;
15
+ /** False when this tab cannot act on the session (follower tab, read-only run). */
16
+ readonly enabled: boolean;
17
+ };
18
+ export type UseNextStepSuggestion = {
19
+ readonly suggestion: NextStepSuggestion | null;
20
+ readonly dismiss: () => void;
21
+ /** Call before Stop: the turn about to end was cut short, so nothing is suggested for it. */
22
+ readonly suppressNextFinish: () => void;
23
+ };
24
+ export declare const useNextStepSuggestion: (input: UseNextStepSuggestionInput) => UseNextStepSuggestion;
25
+ /**
26
+ * The suggestion as the screen shows it: the card and the composer ghost read
27
+ * this one value, so they always agree. It yields to the two rows that already
28
+ * sit above the composer — an open question card is the agent's own ask, and a
29
+ * live goal's row is where the hand already is. A finished or cleared goal has
30
+ * no row, so it hides nothing.
31
+ */
32
+ export declare const nextStepOnScreen: (suggestion: NextStepSuggestion | null, context: {
33
+ readonly questionOpen: boolean;
34
+ readonly goalStatus: GoalStatus | null;
35
+ }) => NextStepSuggestion | null;
36
+ /** The composer's ghost: the welcome question on a new chat, else the recommended reply. */
37
+ export declare const composerGhost: (welcome: string | null, nextStep: NextStepSuggestion | null) => string | null;
38
+ export {};
@@ -0,0 +1,29 @@
1
+ import { TFunction } from 'i18next';
2
+ import { QuotaRefusal } from '../../api/quota-refusal.ts';
3
+ import { BelongUIMessage } from '../../stream/belong-data-parts.ts';
4
+ /**
5
+ * Re-key the refused message's optimistic bubble to the server's id and
6
+ * append the notice. Pure and idempotent: a second application (a duplicate
7
+ * `onError`, a replayed refusal) changes nothing further.
8
+ */
9
+ export declare const applyQuotaRefusal: (messages: readonly BelongUIMessage[], refusal: QuotaRefusal) => BelongUIMessage[];
10
+ /**
11
+ * What a finished assistant message says out loud (the live call and the
12
+ * speaker's batch TTS). A quota notice says the card's words: live it has no
13
+ * text part, and its history row's fallback text is never shown, so both
14
+ * renders speak the same sentence under the same id — spoken once, on time.
15
+ */
16
+ export declare const assistantSpokenText: (message: BelongUIMessage, t: TFunction, locale: string) => string;
17
+ /**
18
+ * `handleQuotaError(error)` answers a quota refusal and reports `true`, or
19
+ * reports `false` and leaves the error to the caller's other paths. The
20
+ * chat's error state is cleared on a microtask: `useChat` calls `onError`
21
+ * BEFORE it parks `status: "error"`, and `clearError` is a no-op until then
22
+ * (the same deferral the goal refusal uses).
23
+ */
24
+ export declare const useQuotaNotice: ({ setMessages, clearError, }: {
25
+ readonly setMessages: (update: (messages: BelongUIMessage[]) => BelongUIMessage[]) => void;
26
+ readonly clearError: () => void;
27
+ }) => {
28
+ readonly handleQuotaError: (error: unknown) => boolean;
29
+ };
@@ -0,0 +1,27 @@
1
+ import { BelongUIMessage } from '../../stream/belong-data-parts.ts';
2
+ import { HistoryPageResult } from './history-cache.ts';
3
+ export declare const signalQuotaStop: (sessionId: string) => void;
4
+ /**
5
+ * The newest quota-stop signal of the turn on screen, as a stable key, or
6
+ * `null`. Restored history is never a signal (it already carries its card),
7
+ * and the scan stops at the turn's user message.
8
+ */
9
+ export declare const quotaStopSignalKey: (messages: readonly BelongUIMessage[]) => string | null;
10
+ export declare const useQuotaStopRefresh: ({ messages, idle, isBusy, resolveSessionId, refreshNewestHistory, applyHistoryPage, sleepMs, }: {
11
+ readonly messages: readonly BelongUIMessage[];
12
+ /** No turn is streaming into the chat right now (reactive; re-runs the hook). */
13
+ readonly idle: boolean;
14
+ /** Read at apply time: a turn is in flight or the transport holds a live stream. */
15
+ readonly isBusy: () => boolean;
16
+ /** The chat's session, read when a refresh starts and between attempts. */
17
+ readonly resolveSessionId: () => string | null;
18
+ readonly refreshNewestHistory: (sessionId: string) => Promise<HistoryPageResult>;
19
+ /** Merge the page into the conversation (the `/compact` merge). */
20
+ readonly applyHistoryPage: (page: Extract<HistoryPageResult, {
21
+ ok: true;
22
+ }>) => void;
23
+ /** Injectable delay (§25). */
24
+ readonly sleepMs?: (ms: number) => Promise<void>;
25
+ }) => {
26
+ readonly refreshForQuotaStop: () => void;
27
+ };
@@ -227,6 +227,12 @@ export type SessionGoalInput = {
227
227
  * objective back to the composer through the SAME door
228
228
  * `useGoalReceipt`'s follow-ups already use. */
229
229
  readonly setDraft: (value: string) => void;
230
+ /**
231
+ * Console P1 — a resume or edit answered `budget_limited`: the monthly
232
+ * token quota may have stopped it, and the cell persisted an orange notice
233
+ * the chat reads from history (`use-quota-stop-refresh.ts`).
234
+ */
235
+ readonly onGoalQuotaStop?: (() => void) | undefined;
230
236
  };
231
237
  export declare const useSessionGoal: (input: SessionGoalInput) => SessionGoalApi;
232
238
  export {};
@@ -1,21 +1,15 @@
1
- import { QueryClient } from '@tanstack/react-query';
2
- import { HistoryScope } from './chat/history-cache.ts';
3
- export type QueuedMessage = {
4
- readonly clientId: string;
5
- readonly text: string;
6
- readonly submittedAt: number;
7
- readonly state: "queued" | "failed";
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;
15
- export declare const ChatRoute: ({ sessionId, draftId, reconcileBackgroundRun, onOpenGoalView, onOpenFilesView, projectRunReadOnly, }?: {
1
+ export declare const ChatRoute: ({ sessionId, draftId, reconcileBackgroundRun, sessionPending, justCreated, onOpenGoalView, onOpenFilesView, projectRunReadOnly, }?: {
16
2
  readonly sessionId?: string;
17
3
  readonly draftId?: string;
18
4
  readonly reconcileBackgroundRun?: boolean;
5
+ /**
6
+ * The rail's "+" shows this new chat while its session is still being created
7
+ * (BelongDock remounts onto that session when it exists). Nothing may be
8
+ * written here until then: it would land outside the new agent.
9
+ */
10
+ readonly sessionPending?: boolean;
11
+ /** This tab created the session a moment ago: it opens with nothing to catch up on. */
12
+ readonly justCreated?: boolean;
19
13
  /** Put the Goal view on screen (the dock owns navigation — same path the
20
14
  * header pill takes). Omitted in tests and stories, where the row's
21
15
  * Details simply does nothing. */
@@ -239,6 +239,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
239
239
  outcome: z.ZodOptional<z.ZodString>;
240
240
  terminationReason: z.ZodOptional<z.ZodString>;
241
241
  retryable: z.ZodOptional<z.ZodBoolean>;
242
+ code: z.ZodOptional<z.ZodString>;
242
243
  }, z.core.$strip>;
243
244
  }, z.core.$strip>, z.ZodObject<{
244
245
  type: z.ZodLiteral<"data-usage">;
@@ -309,12 +310,12 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
309
310
  waiting_for_approval: "waiting_for_approval";
310
311
  active: "active";
311
312
  paused: "paused";
313
+ blocked: "blocked";
312
314
  clarifying: "clarifying";
313
315
  completion_claimed: "completion_claimed";
314
316
  deferred: "deferred";
315
317
  waiting_for_user: "waiting_for_user";
316
318
  waiting_for_ui_action: "waiting_for_ui_action";
317
- blocked: "blocked";
318
319
  budget_limited: "budget_limited";
319
320
  complete: "complete";
320
321
  cleared: "cleared";
@@ -354,12 +355,12 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
354
355
  waiting_for_approval: "waiting_for_approval";
355
356
  active: "active";
356
357
  paused: "paused";
358
+ blocked: "blocked";
357
359
  clarifying: "clarifying";
358
360
  completion_claimed: "completion_claimed";
359
361
  deferred: "deferred";
360
362
  waiting_for_user: "waiting_for_user";
361
363
  waiting_for_ui_action: "waiting_for_ui_action";
362
- blocked: "blocked";
363
364
  budget_limited: "budget_limited";
364
365
  complete: "complete";
365
366
  cleared: "cleared";
@@ -386,6 +387,20 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<
386
387
  normal: "normal";
387
388
  }>>;
388
389
  }, z.core.$strip>;
390
+ }, z.core.$strip>, z.ZodObject<{
391
+ type: z.ZodLiteral<"data-quota-notice">;
392
+ id: z.ZodString;
393
+ data: z.ZodObject<{
394
+ kind: z.ZodLiteral<"quota_exceeded">;
395
+ reason: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
396
+ exhausted: "exhausted";
397
+ blocked: "blocked";
398
+ }>>>;
399
+ productName: z.ZodCatch<z.ZodOptional<z.ZodString>>;
400
+ resetsAt: z.ZodCatch<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
401
+ limitWeightedTokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
402
+ usedWeightedTokens: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
403
+ }, z.core.$loose>;
389
404
  }, z.core.$strip>], "type">;
390
405
  /** A request was 401'd twice (once with a freshly re-read token), or no usable
391
406
  * token could be had at all (`BelongAuthUnavailableError`): the host session is
@@ -268,6 +268,12 @@ export type StatusData = {
268
268
  * up" pill instead of a scary failure badge.
269
269
  */
270
270
  readonly retryable?: boolean | undefined;
271
+ /**
272
+ * #974 — a failed run's cause: the server's `run_error` code (e.g.
273
+ * `provider_content_filter`). The dock picks its copy by this, never by the
274
+ * English `message`. Absent from an older cloud and from other statuses.
275
+ */
276
+ readonly code?: string | undefined;
271
277
  };
272
278
  /**
273
279
  * One slice of the context-window breakdown. `key` is an open string on the
@@ -334,6 +340,28 @@ export type GoalProposalData = {
334
340
  readonly criteria?: readonly string[] | undefined;
335
341
  readonly runway?: GoalRunwayPreset | undefined;
336
342
  };
343
+ /**
344
+ * Console P1 (TS-DOCK-02, DE-QTA-09) — a persisted monthly-quota refusal.
345
+ * The cell writes it as the assistant row answering a refused message; the
346
+ * history route returns it beside a fallback `text` part, which a dock that
347
+ * renders this card suppresses (SAD §9). The live 429 builds the same part
348
+ * from the response body (`routes/chat/use-quota-notice.ts`), so a reload
349
+ * renders what the user saw (§41).
350
+ *
351
+ * Every field but `kind` is optional on the wire (SAD §9): a newer dock must
352
+ * render a notice an older or partial writer left fields out of. The two
353
+ * figures are carried, never shown (the card has no number in it).
354
+ */
355
+ export type QuotaRefusalReason = "exhausted" | "blocked";
356
+ export type QuotaNoticeData = {
357
+ readonly kind: "quota_exceeded";
358
+ readonly reason?: QuotaRefusalReason | undefined;
359
+ readonly productName?: string | undefined;
360
+ /** ISO instant the month's tokens reset; `null` when there is none (blocked). */
361
+ readonly resetsAt?: string | null | undefined;
362
+ readonly limitWeightedTokens?: number | undefined;
363
+ readonly usedWeightedTokens?: number | undefined;
364
+ };
337
365
  /**
338
366
  * Single source of truth for Belong's custom data parts. The record
339
367
  * keys (`reasoning`, `plan`, …) become the part-type suffix:
@@ -361,6 +389,8 @@ export type BelongDataParts = {
361
389
  goal: GoalView;
362
390
  /** Goal Mode M6 — a goal the agent offered via `propose_goal`. */
363
391
  "goal-proposal": GoalProposalData;
392
+ /** Console P1 — a persisted monthly-quota refusal (TS-DOCK-02). */
393
+ "quota-notice": QuotaNoticeData;
364
394
  };
365
395
  /**
366
396
  * The concrete `UIMessage` shape the chat surface and transport speak.
@@ -390,5 +420,5 @@ export type WireDataPart<NAME extends keyof BelongDataParts> = {
390
420
  readonly id: string;
391
421
  readonly data: BelongDataParts[NAME];
392
422
  };
393
- 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">;
423
+ 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"> | WireDataPart<"quota-notice">;
394
424
  export type WireStreamPartType = WireStreamPart["type"];
@@ -0,0 +1,16 @@
1
+ import { BelongUIMessage, StatusData } from './belong-data-parts.ts';
2
+ /**
3
+ * A run the provider refused to finish. It ends on one localized notice in
4
+ * the turn (`stream.answerBlocked`), not on a stream error: nothing was lost
5
+ * in transit. Keyed on the run's cause code, never on the server's English
6
+ * prose.
7
+ */
8
+ export declare const isProviderBlockedStatus: (data: StatusData) => boolean;
9
+ /**
10
+ * Whether an assistant turn ended on a provider refusal. Such a run settles
11
+ * `ready` like a finished one (no stream error), so whatever reports a run's
12
+ * outcome reads this to tell the two apart. Only the turn's LAST status
13
+ * counts: a resumed run streams into the same message, so an earlier run's
14
+ * refusal can sit in front of a later run's answer.
15
+ */
16
+ export declare const endedProviderBlocked: (message: BelongUIMessage) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "0.6.32",
3
+ "version": "0.6.33",
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",
@@ -1,19 +0,0 @@
1
- globalThis.process = globalThis.process || { env: {} }, globalThis.global = globalThis.global || globalThis;
2
- import "./chunk-Y2CYZVJY-CiUSrfaV.js";
3
- import "./src-CKo8cHWB.js";
4
- import "./chunk-I66GZJ75-DB1sFGc-.js";
5
- import "./chunk-NSK5VX7P-ur_ZGcVX.js";
6
- import "./chunk-ZIRB5QZD-DmX0SXRC.js";
7
- import "./chunk-W5SLKNZC-Dq8uD14N.js";
8
- import "./chunk-UBXNYLIW-CDKeQUnO.js";
9
- import "./chunk-4I5QYGJK-CGOVqmKQ.js";
10
- import "./chunk-WRU74C26-BwQb4DnE.js";
11
- import "./chunk-QR6OTTB3-Bl3Z_jKC.js";
12
- import "./chunk-7BUUIJ7U-DJJ8ycYS.js";
13
- import "./chunk-7Z6QIM7H-CSfSb_Xc.js";
14
- import "./chunk-J7OUQ5F2-DB9d7Gt_.js";
15
- import "./chunk-5VM5RSS4-BuOiQaWo.js";
16
- import "./chunk-2GRJ4B5K-C14K2lKj.js";
17
- import "./chunk-XXDRQBXY-BP7ld7ls.js";
18
- import "./chunk-KBJHAD2P-CVoxmRa8.js";
19
- export { n as diagram } from "./chunk-JQJVKLGR-De7zUJDv.js";