@belonguniverseai/react-sdk 0.5.0 → 0.6.1
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 +93 -8
- package/dist/api/skills.d.ts +6 -1
- package/dist/component/{arc-CtyXH_sw.js → arc-BziuP1aB.js} +2 -2
- package/dist/component/{architectureDiagram-3BPJPVTR-C6NZifN6.js → architectureDiagram-3BPJPVTR-BVwa4QrX.js} +3 -3
- package/dist/component/{blockDiagram-GPEHLZMM-_-K66LP4.js → blockDiagram-GPEHLZMM-CKNImKL2.js} +4 -4
- package/dist/component/{c4Diagram-AAUBKEIU-DL-K-sZW.js → c4Diagram-AAUBKEIU-BcbjcMPA.js} +3 -3
- package/dist/component/{channel-scCA9sxi.js → channel-vtwXLQ1f.js} +2 -2
- package/dist/component/{chunk-2J33WTMH-Dkd9OyM1.js → chunk-2J33WTMH-C6wmoOIl.js} +2 -2
- package/dist/component/{chunk-4BX2VUAB-JbEXcQ3q.js → chunk-4BX2VUAB-DySNI9mv.js} +2 -2
- package/dist/component/{chunk-55IACEB6-Dg96dHvQ.js → chunk-55IACEB6-C4M2cG_c.js} +2 -2
- package/dist/component/{chunk-727SXJPM-Cu3-awqi.js → chunk-727SXJPM-BTqmmKKN.js} +6 -6
- package/dist/component/{chunk-AQP2D5EJ-DLX62MPh.js → chunk-AQP2D5EJ-DiS4043D.js} +4 -4
- package/dist/component/{chunk-FMBD7UC4-BxU0KQRK.js → chunk-FMBD7UC4-Bu05DXe4.js} +2 -2
- package/dist/component/{chunk-ND2GUHAM-CEQj3so6.js → chunk-ND2GUHAM-DfbE4oOG.js} +2 -2
- package/dist/component/{chunk-QZHKN3VN-BWgwT04-.js → chunk-QZHKN3VN-Y8mfHGtB.js} +2 -2
- package/dist/component/{classDiagram-4FO5ZUOK-Ton6m2pw.js → classDiagram-4FO5ZUOK-ChO_m1Vd.js} +3 -3
- package/dist/component/{classDiagram-v2-Q7XG4LA2-Ton6m2pw.js → classDiagram-v2-Q7XG4LA2-ChO_m1Vd.js} +3 -3
- package/dist/component/{cose-bilkent-S5V4N54A-Dja09hp6.js → cose-bilkent-S5V4N54A-B1DDE26M.js} +2 -2
- package/dist/component/{dagre-BM42HDAG-Ch6fODe-.js → dagre-BM42HDAG-BmujNepD.js} +2 -2
- package/dist/component/{diagram-2AECGRRQ-DdDr6tHi.js → diagram-2AECGRRQ-Cbck9DRQ.js} +3 -3
- package/dist/component/{diagram-5GNKFQAL-BT2qfjUH.js → diagram-5GNKFQAL-csRK5clZ.js} +4 -4
- package/dist/component/{diagram-KO2AKTUF-UcWrBVNK.js → diagram-KO2AKTUF-DD3KqnFb.js} +3 -3
- package/dist/component/{diagram-LMA3HP47-D-BCOeIt.js → diagram-LMA3HP47-D6-oakzD.js} +3 -3
- package/dist/component/{diagram-OG6HWLK6-CJDJgfQO.js → diagram-OG6HWLK6-DfxY1IE7.js} +4 -4
- package/dist/component/{erDiagram-TEJ5UH35-kY5sdKqg.js → erDiagram-TEJ5UH35-BDV1C23R.js} +5 -5
- package/dist/component/{flowDiagram-I6XJVG4X-9OddgRiE.js → flowDiagram-I6XJVG4X-mEwMtE2U.js} +7 -7
- package/dist/component/{ganttDiagram-6RSMTGT7-Dc9t8llA.js → ganttDiagram-6RSMTGT7-C_dcTMQX.js} +3 -3
- package/dist/component/{gitGraphDiagram-PVQCEYII-DYjn9Ff5.js → gitGraphDiagram-PVQCEYII-CIKPPQiC.js} +4 -4
- package/dist/component/{highlighted-body-OFNGDK62-D_TDzrFY.js → highlighted-body-OFNGDK62-DpP1DD9S.js} +2 -2
- package/dist/component/index.js +2 -2
- package/dist/component/{infoDiagram-5YYISTIA-CBPoKi7E.js → infoDiagram-5YYISTIA-DKTrvjCm.js} +2 -2
- package/dist/component/{ishikawaDiagram-YF4QCWOH-C3rChBg5.js → ishikawaDiagram-YF4QCWOH-BcuncMnU.js} +2 -2
- package/dist/component/{journeyDiagram-JHISSGLW-DVTybrGG.js → journeyDiagram-JHISSGLW-BTTgY3Of.js} +5 -5
- package/dist/component/{kanban-definition-UN3LZRKU-DNMLC4NQ.js → kanban-definition-UN3LZRKU-D9K5810E.js} +3 -3
- package/dist/component/{linear-B_oPUR6_.js → linear-DondfmT2.js} +2 -2
- package/dist/component/{mermaid-GHXKKRXX-CjZr9GWr.js → mermaid-GHXKKRXX-j_0KsvYs.js} +28535 -28932
- package/dist/component/{mindmap-definition-RKZ34NQL-CErhrdm3.js → mindmap-definition-RKZ34NQL-DMC3vCUq.js} +4 -4
- package/dist/component/{pieDiagram-4H26LBE5-Cno02n3_.js → pieDiagram-4H26LBE5-DmYi_D3l.js} +4 -4
- package/dist/component/{quadrantDiagram-W4KKPZXB-DQV7ytCz.js → quadrantDiagram-W4KKPZXB-DMos-d69.js} +3 -3
- package/dist/component/{requirementDiagram-4Y6WPE33-DBORDX5u.js → requirementDiagram-4Y6WPE33-BpgIfnhZ.js} +4 -4
- package/dist/component/{sankeyDiagram-5OEKKPKP-gNBaVNW1.js → sankeyDiagram-5OEKKPKP-xbJGp8Ms.js} +2 -2
- package/dist/component/{sequenceDiagram-3UESZ5HK-BlxJztMa.js → sequenceDiagram-3UESZ5HK-Bnlm4mVO.js} +4 -4
- package/dist/component/{stateDiagram-AJRCARHV-2ziF_Zes.js → stateDiagram-AJRCARHV-BIooqMYf.js} +3 -3
- package/dist/component/{stateDiagram-v2-BHNVJYJU-BWmzKTMS.js → stateDiagram-v2-BHNVJYJU-C6WAOCCe.js} +3 -3
- package/dist/component/{timeline-definition-PNZ67QCA-OcHhxXWM.js → timeline-definition-PNZ67QCA-lTe5jbcD.js} +3 -3
- package/dist/component/{vennDiagram-CIIHVFJN-Fl9VlPVe.js → vennDiagram-CIIHVFJN-5RYbksB1.js} +2 -2
- package/dist/component/{wardleyDiagram-YWT4CUSO-BNHUW0Ex.js → wardleyDiagram-YWT4CUSO-BSz_UDND.js} +3 -3
- package/dist/component/{xychartDiagram-2RQKCTM6-Bog3Ddue.js → xychartDiagram-2RQKCTM6-BmzhiB0a.js} +3 -3
- package/dist/components/embed/EmbedHeader.d.ts +11 -4
- package/dist/components/embed/rail-flags.d.ts +10 -0
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/embed/slash-commands.d.ts +24 -7
- package/dist/embed/voice/call-active-marker.d.ts +75 -19
- package/dist/embed/voice/line-dispatch.d.ts +22 -20
- package/dist/embed/voice/realtime-call.d.ts +12 -0
- package/dist/embed/voice/reconnect-offer.d.ts +14 -5
- package/dist/embed/voice-call-lines.d.ts +4 -25
- package/dist/embed/voice-call.d.ts +112 -73
- package/dist/i18n/messages/en.d.ts +27 -6
- package/dist/i18n/messages/surfaces/embedMisc.d.ts +0 -3
- package/dist/i18n/messages/surfaces/stream.d.ts +74 -0
- package/dist/stream/ai-sdk-part-renderers.d.ts +23 -6
- package/dist/stream/belong-chat-transport.d.ts +57 -0
- package/dist/stream/belong-data-parts.d.ts +44 -1
- package/dist/stream/run-line-progress.d.ts +6 -5
- package/dist/stream/tool-action-label.d.ts +16 -0
- package/package.json +1 -1
- package/dist/components/embed/PoweredByBelong.d.ts +0 -7
- package/dist/embed/voice/agent-queue.d.ts +0 -106
- package/dist/embed/voice/call-roster-store.d.ts +0 -110
|
@@ -145,16 +145,19 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
145
145
|
reason: z.ZodString;
|
|
146
146
|
state: z.ZodEnum<["pending", "approved", "rejected", "amend_requested", "expired"]>;
|
|
147
147
|
toolName: z.ZodOptional<z.ZodString>;
|
|
148
|
+
subagentId: z.ZodOptional<z.ZodString>;
|
|
148
149
|
}, "strip", z.ZodTypeAny, {
|
|
149
150
|
reason: string;
|
|
150
151
|
approvalId: string;
|
|
151
152
|
state: "pending" | "approved" | "rejected" | "amend_requested" | "expired";
|
|
152
153
|
toolName?: string | undefined;
|
|
154
|
+
subagentId?: string | undefined;
|
|
153
155
|
}, {
|
|
154
156
|
reason: string;
|
|
155
157
|
approvalId: string;
|
|
156
158
|
state: "pending" | "approved" | "rejected" | "amend_requested" | "expired";
|
|
157
159
|
toolName?: string | undefined;
|
|
160
|
+
subagentId?: string | undefined;
|
|
158
161
|
}>;
|
|
159
162
|
}, "strip", z.ZodTypeAny, {
|
|
160
163
|
id: string;
|
|
@@ -163,6 +166,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
163
166
|
approvalId: string;
|
|
164
167
|
state: "pending" | "approved" | "rejected" | "amend_requested" | "expired";
|
|
165
168
|
toolName?: string | undefined;
|
|
169
|
+
subagentId?: string | undefined;
|
|
166
170
|
};
|
|
167
171
|
type: "data-approval-request";
|
|
168
172
|
}, {
|
|
@@ -172,6 +176,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
172
176
|
approvalId: string;
|
|
173
177
|
state: "pending" | "approved" | "rejected" | "amend_requested" | "expired";
|
|
174
178
|
toolName?: string | undefined;
|
|
179
|
+
subagentId?: string | undefined;
|
|
175
180
|
};
|
|
176
181
|
type: "data-approval-request";
|
|
177
182
|
}>, z.ZodObject<{
|
|
@@ -195,6 +200,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
195
200
|
code: string;
|
|
196
201
|
severity?: "error" | "stop" | undefined;
|
|
197
202
|
}>>;
|
|
203
|
+
subagentId: z.ZodOptional<z.ZodString>;
|
|
198
204
|
}, "strip", z.ZodTypeAny, {
|
|
199
205
|
toolName: string;
|
|
200
206
|
state: "completed" | "failed" | "started";
|
|
@@ -205,6 +211,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
205
211
|
} | undefined;
|
|
206
212
|
input?: Record<string, unknown> | undefined;
|
|
207
213
|
output?: Record<string, unknown> | null | undefined;
|
|
214
|
+
subagentId?: string | undefined;
|
|
208
215
|
}, {
|
|
209
216
|
toolName: string;
|
|
210
217
|
state: "completed" | "failed" | "started";
|
|
@@ -215,6 +222,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
215
222
|
} | undefined;
|
|
216
223
|
input?: Record<string, unknown> | undefined;
|
|
217
224
|
output?: Record<string, unknown> | null | undefined;
|
|
225
|
+
subagentId?: string | undefined;
|
|
218
226
|
}>;
|
|
219
227
|
}, "strip", z.ZodTypeAny, {
|
|
220
228
|
id: string;
|
|
@@ -228,6 +236,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
228
236
|
} | undefined;
|
|
229
237
|
input?: Record<string, unknown> | undefined;
|
|
230
238
|
output?: Record<string, unknown> | null | undefined;
|
|
239
|
+
subagentId?: string | undefined;
|
|
231
240
|
};
|
|
232
241
|
type: "data-tool-call";
|
|
233
242
|
}, {
|
|
@@ -242,8 +251,56 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
|
|
|
242
251
|
} | undefined;
|
|
243
252
|
input?: Record<string, unknown> | undefined;
|
|
244
253
|
output?: Record<string, unknown> | null | undefined;
|
|
254
|
+
subagentId?: string | undefined;
|
|
245
255
|
};
|
|
246
256
|
type: "data-tool-call";
|
|
257
|
+
}>, z.ZodObject<{
|
|
258
|
+
type: z.ZodLiteral<"data-subagent">;
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
data: z.ZodObject<{
|
|
261
|
+
name: z.ZodString;
|
|
262
|
+
description: z.ZodString;
|
|
263
|
+
state: z.ZodEnum<["running", "finished", "failed"]>;
|
|
264
|
+
stepsUsed: z.ZodOptional<z.ZodNumber>;
|
|
265
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
266
|
+
timedOut: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
name: string;
|
|
269
|
+
state: "failed" | "running" | "finished";
|
|
270
|
+
description: string;
|
|
271
|
+
stepsUsed?: number | undefined;
|
|
272
|
+
summary?: string | undefined;
|
|
273
|
+
timedOut?: boolean | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
name: string;
|
|
276
|
+
state: "failed" | "running" | "finished";
|
|
277
|
+
description: string;
|
|
278
|
+
stepsUsed?: number | undefined;
|
|
279
|
+
summary?: string | undefined;
|
|
280
|
+
timedOut?: boolean | undefined;
|
|
281
|
+
}>;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
id: string;
|
|
284
|
+
data: {
|
|
285
|
+
name: string;
|
|
286
|
+
state: "failed" | "running" | "finished";
|
|
287
|
+
description: string;
|
|
288
|
+
stepsUsed?: number | undefined;
|
|
289
|
+
summary?: string | undefined;
|
|
290
|
+
timedOut?: boolean | undefined;
|
|
291
|
+
};
|
|
292
|
+
type: "data-subagent";
|
|
293
|
+
}, {
|
|
294
|
+
id: string;
|
|
295
|
+
data: {
|
|
296
|
+
name: string;
|
|
297
|
+
state: "failed" | "running" | "finished";
|
|
298
|
+
description: string;
|
|
299
|
+
stepsUsed?: number | undefined;
|
|
300
|
+
summary?: string | undefined;
|
|
301
|
+
timedOut?: boolean | undefined;
|
|
302
|
+
};
|
|
303
|
+
type: "data-subagent";
|
|
247
304
|
}>, z.ZodObject<{
|
|
248
305
|
type: z.ZodLiteral<"data-sandbox-command">;
|
|
249
306
|
id: z.ZodString;
|
|
@@ -40,6 +40,12 @@ export type ApprovalRequestData = {
|
|
|
40
40
|
* messages; render the generic label when undefined.
|
|
41
41
|
*/
|
|
42
42
|
readonly toolName?: string | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* BEL-199 attribution — the `data-subagent` part id whose gated call raised this
|
|
45
|
+
* card. The resolution event (`approval_state_changed`) carries no subagentId, so
|
|
46
|
+
* last-write-wins by part id drops it on resolve: pending-card-only by design.
|
|
47
|
+
*/
|
|
48
|
+
readonly subagentId?: string | undefined;
|
|
43
49
|
};
|
|
44
50
|
/**
|
|
45
51
|
* BEL-93 — a friendly question widget the agent emits instead of dumping a wall
|
|
@@ -105,6 +111,41 @@ export type ToolCallData = {
|
|
|
105
111
|
readonly message: string;
|
|
106
112
|
readonly severity?: ToolErrorSeverity | undefined;
|
|
107
113
|
} | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* BEL-199 — the `data-subagent` part id this call ran INSIDE. Absent on every
|
|
116
|
+
* main-loop call (and on every part emitted before BEL-199). The expanded
|
|
117
|
+
* activity group chips a matching item with a muted "via <name>" —
|
|
118
|
+
* attribution, not nesting.
|
|
119
|
+
*/
|
|
120
|
+
readonly subagentId?: string | undefined;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* BEL-199 — one delegated subagent. `running → finished | failed`, one part per
|
|
124
|
+
* subagent, reconciled by id like every other lifecycle part.
|
|
125
|
+
*
|
|
126
|
+
* It renders as an ACTIVITY ITEM: one thin line INSIDE the §42 collapsed
|
|
127
|
+
* activity line, never a card beside it. A failed subagent carries no
|
|
128
|
+
* `ToolErrorSeverity` — deliberately, so it can never reach the collapsed line:
|
|
129
|
+
* the parent agent reads the failure in its tool result and recovers, and
|
|
130
|
+
* surfacing it would read as breakage. Nothing about it is ever red.
|
|
131
|
+
*/
|
|
132
|
+
export type SubagentState = "running" | "finished" | "failed";
|
|
133
|
+
export type SubagentData = {
|
|
134
|
+
/** Registry name, e.g. "general-purpose" — the "via <name>" chip's text. */
|
|
135
|
+
readonly name: string;
|
|
136
|
+
/** The model's own task label; this is what the line shows. */
|
|
137
|
+
readonly description: string;
|
|
138
|
+
readonly state: SubagentState;
|
|
139
|
+
readonly stepsUsed?: number | undefined;
|
|
140
|
+
readonly summary?: string | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* The failure was the wall-clock budget, not an error — an optional EXTRA
|
|
143
|
+
* field rather than a fourth `state` (an unknown enum value would make an
|
|
144
|
+
* older dock drop the whole part; an unknown field it ignores). Lets the line
|
|
145
|
+
* say "ran out of time" in the reader's language instead of relaying English
|
|
146
|
+
* server prose.
|
|
147
|
+
*/
|
|
148
|
+
readonly timedOut?: boolean | undefined;
|
|
108
149
|
};
|
|
109
150
|
export type SandboxCommandData = {
|
|
110
151
|
readonly state: SandboxCommandState;
|
|
@@ -181,6 +222,8 @@ export type BelongDataParts = {
|
|
|
181
222
|
"approval-request": ApprovalRequestData;
|
|
182
223
|
"choice-request": ChoiceRequestData;
|
|
183
224
|
"tool-call": ToolCallData;
|
|
225
|
+
/** BEL-199 — a delegated subagent, folded into the §42 activity line. */
|
|
226
|
+
subagent: SubagentData;
|
|
184
227
|
"sandbox-command": SandboxCommandData;
|
|
185
228
|
"ui-action": UiActionData;
|
|
186
229
|
"cli-reconnect": CliReconnectData;
|
|
@@ -213,5 +256,5 @@ export type WireDataPart<NAME extends keyof BelongDataParts> = {
|
|
|
213
256
|
readonly id: string;
|
|
214
257
|
readonly data: BelongDataParts[NAME];
|
|
215
258
|
};
|
|
216
|
-
export type WireStreamPart = WireTextPart | WireDataPart<"reasoning"> | WireDataPart<"plan"> | WireDataPart<"approval-request"> | WireDataPart<"choice-request"> | WireDataPart<"tool-call"> | WireDataPart<"sandbox-command"> | WireDataPart<"ui-action"> | WireDataPart<"cli-reconnect"> | WireDataPart<"navigation"> | WireDataPart<"artifact"> | WireDataPart<"status"> | WireDataPart<"usage">;
|
|
259
|
+
export type WireStreamPart = WireTextPart | 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">;
|
|
217
260
|
export type WireStreamPartType = WireStreamPart["type"];
|
|
@@ -6,11 +6,12 @@ import { RunStatusKind } from './belong-data-parts.ts';
|
|
|
6
6
|
* turn that only writes text calls no tools, so `tool_started` never fires and
|
|
7
7
|
* the chip would otherwise sit at "idle" through the whole answer.
|
|
8
8
|
*
|
|
9
|
-
* There is deliberately NO `text` variant. An accumulator feeding
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* answer. Re-add
|
|
9
|
+
* There is deliberately NO `text` variant. An accumulator feeding a per-line
|
|
10
|
+
* "last result text" field was specified and dropped: nothing in the dock
|
|
11
|
+
* renders such a field (the registry no longer even carries one), and because
|
|
12
|
+
* this seam no-ops while the session is on screen the accumulator could only
|
|
13
|
+
* ever have collected the post-switch TAIL of an answer. Re-add both when
|
|
14
|
+
* something renders it.
|
|
14
15
|
*
|
|
15
16
|
* `terminal` carries the run's OWN id, and it is not decoration: the durable
|
|
16
17
|
* slot runId this seam clears is shared with the voice dispatch, and a line can
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
2
|
+
export type ToolActionLabel = {
|
|
3
|
+
readonly key: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* The neutral line for a tool this build has never heard of. Exported because
|
|
7
|
+
* `browserStepMeta` branches on it: an unrecognized `browser_*` suffix keeps
|
|
8
|
+
* the chat's own sentence-cased fallback instead of this.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GENERIC_ACTION_KEY = "stream.actionGeneric";
|
|
11
|
+
/**
|
|
12
|
+
* `t(...)` over a `ToolActionLabel` — the ONE way either surface renders one,
|
|
13
|
+
* so the two can't drift into two different names for the same action.
|
|
14
|
+
*/
|
|
15
|
+
export declare const translateAction: (t: TFunction, action: ToolActionLabel) => string;
|
|
16
|
+
export declare const toolActionLabel: (toolName: string) => ToolActionLabel | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@belonguniverseai/react-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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,7 +0,0 @@
|
|
|
1
|
-
/** Fixed footer height (px) so the terminal overlay can reserve exact space. */
|
|
2
|
-
export declare const POWERED_BY_BELONG_HEIGHT_PX = 28;
|
|
3
|
-
/**
|
|
4
|
-
* Persistent attribution strip pinned to the bottom of the dock panel when a
|
|
5
|
-
* tenant brand is active. Always the Belong mark (not the tenant BrandMark).
|
|
6
|
-
*/
|
|
7
|
-
export declare function PoweredByBelong(): import("react").JSX.Element;
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-line FIFO for work an operator asks an agent to do WHILE that agent is
|
|
3
|
-
* already busy — the structure behind "queue two things on Agent 2, then
|
|
4
|
-
* drop one" (Slice 3 of the voice-operator plan). File-scope-singleton
|
|
5
|
-
* idiom, same as `line-slots.ts` / `voice-call-lines.ts` beside it: one
|
|
6
|
-
* module-level `Map<number, QueuedRequest[]>`, no class, no React.
|
|
7
|
-
*
|
|
8
|
-
* WHAT THIS REPLACES: today, sending work to a busy agent POSTs it
|
|
9
|
-
* immediately — the message lands in Postgres and the server's own drain
|
|
10
|
-
* loop (SAD §5.1 / CLAUDE.md §37) gets to it whenever the agent frees up.
|
|
11
|
-
* That queue is invisible (no way to ask "what's waiting for Agent 2?"),
|
|
12
|
-
* unorderable (no way to promote the third ask over the second), and
|
|
13
|
-
* undroppable (no way to take one back). This module is the queue moved
|
|
14
|
-
* into the browser, so a caller can read it back, drop an entry, or reorder
|
|
15
|
-
* it before anything is sent. (Wiring `dispatchToLine`'s busy-line path
|
|
16
|
-
* through this queue, and adding the voice-facing `manage_queue` tool, are
|
|
17
|
-
* later tasks — see NOT WIRED IN YET below.)
|
|
18
|
-
*
|
|
19
|
-
* WHY CALL-SCOPED AND NOT DURABLE — the trade-off, spelled out:
|
|
20
|
-
*
|
|
21
|
-
* - A held `QueuedRequest` lives ONLY in this in-memory Map. Today's
|
|
22
|
-
* behavior is strictly more durable: a queued follow-up is already
|
|
23
|
-
* POSTed and sitting in Postgres the instant the operator says it, so it
|
|
24
|
-
* survives a tab crash, a network blip, anything short of the session
|
|
25
|
-
* itself being deleted. Moving the queue into the browser gives up that
|
|
26
|
-
* durability in exchange for the operator being able to see and steer
|
|
27
|
-
* it — that is the entire point, and the trade needs to be made with
|
|
28
|
-
* open eyes, not by accident.
|
|
29
|
-
* - `drainAllQueues()` is what keeps that loss narrow. It is the hang-up
|
|
30
|
-
* flush: called as part of ending a call normally, it empties every
|
|
31
|
-
* line's queue and hands back everything that was waiting so it can be
|
|
32
|
-
* POSTed to the server exactly as if this module had never sat in front
|
|
33
|
-
* of it. A normal end-of-call therefore loses nothing — the queue is
|
|
34
|
-
* just a staging area the operator got to look inside before the same
|
|
35
|
-
* dispatch that would have happened anyway.
|
|
36
|
-
* - The durability genuinely AT RISK is narrower still than it first
|
|
37
|
-
* sounds: a live voice call is not something a page reload survives
|
|
38
|
-
* regardless of this module — there is no reload-resume contract for
|
|
39
|
-
* the call itself (unlike the §41 guarantee for an already-dispatched
|
|
40
|
-
* agent turn, which is a Postgres/Redis-backed run, not the call). So
|
|
41
|
-
* "a reload loses the queue" is not a NEW failure this module
|
|
42
|
-
* introduces; the call was already gone. What is genuinely new is the
|
|
43
|
-
* sliver between "something got queued" and "the call ends" during
|
|
44
|
-
* which the tab could crash before `drainAllQueues()` ever runs — a
|
|
45
|
-
* real but narrow window, and the one honest cost of this design.
|
|
46
|
-
*
|
|
47
|
-
* NOT WIRED IN YET: this ships as a standalone module with its own tests
|
|
48
|
-
* and no production caller. A later task connects `enqueueForLine` /
|
|
49
|
-
* `dequeueForLine` to `dispatchToLine`'s busy-line path and `drainAllQueues`
|
|
50
|
-
* to the hang-up handler; another adds the voice-facing `manage_queue` tool
|
|
51
|
-
* on top of `peekQueue` / `dropQueuedAt` / `moveQueued`.
|
|
52
|
-
*/
|
|
53
|
-
export type QueuedRequest = {
|
|
54
|
-
readonly id: string;
|
|
55
|
-
readonly request: string;
|
|
56
|
-
};
|
|
57
|
-
/** Append `request` to the back of `line`'s queue, minting a fresh id
|
|
58
|
-
* (`nanoid()`, the same generator `line-dispatch.ts` uses for
|
|
59
|
-
* `clientMessageId`). Always succeeds — there is no bound on queue depth. */
|
|
60
|
-
export declare const enqueueForLine: (line: number, request: string) => QueuedRequest;
|
|
61
|
-
/** Pop and return the FRONT of `line`'s queue, or `null` when it's empty. */
|
|
62
|
-
export declare const dequeueForLine: (line: number) => QueuedRequest | null;
|
|
63
|
-
/** A read-only snapshot of `line`'s queue, front to back. Never mutates. */
|
|
64
|
-
export declare const peekQueue: (line: number) => readonly QueuedRequest[];
|
|
65
|
-
/** How many requests are waiting on `line`. */
|
|
66
|
-
export declare const queueDepth: (line: number) => number;
|
|
67
|
-
/** Remove and return the item at `index` in `line`'s queue, or `null` when
|
|
68
|
-
* `index` is out of range — an explicit `< 0 || >= length` bound (§10: never
|
|
69
|
-
* truthiness on a length or index), so a bad index is an honest miss rather
|
|
70
|
-
* than a silent no-op that could be mistaken for success. */
|
|
71
|
-
export declare const dropQueuedAt: (line: number, index: number) => QueuedRequest | null;
|
|
72
|
-
/** Move the item at `from` to position `to` in `line`'s queue (both bounds
|
|
73
|
-
* explicit, same discipline as `dropQueuedAt`). Returns `false` — leaving
|
|
74
|
-
* the queue completely untouched — when either index is out of range;
|
|
75
|
-
* `true` on success, including the no-op case `from === to` (a valid index
|
|
76
|
-
* moved to itself: nothing changes, but the request was satisfied, not
|
|
77
|
-
* refused). `to` is a position in the queue AFTER `from` is removed — the
|
|
78
|
-
* standard "move to position N" reading: moving the last item to `to: 0`
|
|
79
|
-
* makes it the new front. */
|
|
80
|
-
export declare const moveQueued: (line: number, from: number, to: number) => boolean;
|
|
81
|
-
/** The hang-up flush: empty EVERY line's queue and return everything that
|
|
82
|
-
* was waiting, in line-then-position order (line ascending, FIFO within a
|
|
83
|
-
* line) — the order a normal end-of-call should hand work to the server in.
|
|
84
|
-
* Exhaustive by construction: every line the map holds is visited and
|
|
85
|
-
* cleared, so nothing can be left behind. See the module doc for why this
|
|
86
|
-
* is what makes the queue's in-memory-only durability trade-off safe for a
|
|
87
|
-
* normal call end. */
|
|
88
|
-
export declare const drainAllQueues: () => readonly {
|
|
89
|
-
readonly line: number;
|
|
90
|
-
readonly request: string;
|
|
91
|
-
}[];
|
|
92
|
-
/** The call-teardown clear: drop every line's queue without returning
|
|
93
|
-
* anything. Unlike `drainAllQueues`, this is for the paths that must not
|
|
94
|
-
* re-POST stale work — e.g. resetting state at the START of a fresh call. */
|
|
95
|
-
export declare const resetQueues: () => void;
|
|
96
|
-
/** Drop `line`'s held queue and report how many items were discarded — the
|
|
97
|
-
* ONE-line counterpart to `resetQueues()` (every line). For the paths that
|
|
98
|
-
* must not re-POST or re-dispatch one line's stale work without touching any
|
|
99
|
-
* other line's: `stop_agent` (voice-call.ts) clearing exactly the queue it
|
|
100
|
-
* just told the user was dropped, and `closeAgentLine` (voice-call-lines.ts)
|
|
101
|
-
* releasing a line whose held work must not resurrect onto the next
|
|
102
|
-
* occupant of the same number. An explicit `=== 0` check rather than
|
|
103
|
-
* truthiness (§10), same discipline as `dropQueuedAt`/`moveQueued`: a
|
|
104
|
-
* nothing-to-drop line reports `0` honestly instead of writing an empty
|
|
105
|
-
* array through `setQueue` for no reason. */
|
|
106
|
-
export declare const clearQueueForLine: (line: number) => number;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The voice call's agent ROSTER — the browser-side twin of the tenant
|
|
3
|
-
* roster minted server-side (`buildCallRoster` in
|
|
4
|
-
* apps/belong-cloud/src/features/voice/call-roster.ts) and threaded through
|
|
5
|
-
* `POST /v1/voice/call-token`'s `agents` field (`callAgentSpecSchema`,
|
|
6
|
-
* voice.schemas.ts). This is what lets the dock's rail, the call screen's
|
|
7
|
-
* agent board, and every spoken announcement address an agent by ROLE
|
|
8
|
-
* ("cli", "consulting") instead of a bare line number — and do so from the
|
|
9
|
-
* moment the dock boots, before any call has ever been started: the rail
|
|
10
|
-
* renders dock-wide with no call active, so it needs the LAST-KNOWN roster,
|
|
11
|
-
* not only one handed to it live off a fresh mint.
|
|
12
|
-
*
|
|
13
|
-
* Persisted per workspace, exactly like `line-slots.ts` beside it
|
|
14
|
-
* (`belong:voice-call-roster`, suffixed `:ws:<id>` when a workspace is in
|
|
15
|
-
* effect via `peekWorkspaceId()`) — a host workspace switch must not hand
|
|
16
|
-
* tenant A's roster (its titles, its CLI agent) to a rail rendering for
|
|
17
|
-
* tenant B.
|
|
18
|
-
*
|
|
19
|
-
* localStorage is a perimeter: the persisted roster is zod-validated on read
|
|
20
|
-
* and any junk (corrupted JSON, wrong shape, storage disabled) degrades to
|
|
21
|
-
* an EMPTY roster — same as "no call minted yet". The schema below is a
|
|
22
|
-
* deliberately independent, by-hand copy of the server's
|
|
23
|
-
* `callAgentSpecSchema`: the two packages ship separately and share no type
|
|
24
|
-
* module, so this is what keeps them honest (mirrors the existing
|
|
25
|
-
* `CallAgentSpec`/`callAgentSpecSchema` split already living server-side in
|
|
26
|
-
* `call-roster.ts` / `voice.schemas.ts`).
|
|
27
|
-
*
|
|
28
|
-
* Two fallback rules, and they are NOT the same rule:
|
|
29
|
-
*
|
|
30
|
-
* - `lineForRole` / `roleForLine` on an EMPTY roster (nothing ever minted,
|
|
31
|
-
* or a mint whose body failed to parse) fall back to the POSITIONAL
|
|
32
|
-
* default that's been true since roles didn't exist: main=1, cli=2,
|
|
33
|
-
* consulting=3. This is what stops a parse failure from bricking role
|
|
34
|
-
* addressing mid-call — the switchboard still answers to
|
|
35
|
-
* main/cli/consulting by position.
|
|
36
|
-
* - On a NON-empty roster that simply doesn't have that role/line (a
|
|
37
|
-
* tenant with no CLI), the same lookups return `null` instead — the
|
|
38
|
-
* honest signal that THIS workspace has no such agent, which is what
|
|
39
|
-
* later produces an `unknown_role` tool response rather than silently
|
|
40
|
-
* addressing the wrong agent.
|
|
41
|
-
*
|
|
42
|
-
* `titleForRole` / `titleForLine` never return `null` — a title is always
|
|
43
|
-
* needed for display/announcement, so THEIR fallback is a string, applied
|
|
44
|
-
* uniformly regardless of whether the roster is empty or merely missing
|
|
45
|
-
* that entry. The two fallbacks are deliberately DIFFERENT shapes, not the
|
|
46
|
-
* same rule twice:
|
|
47
|
-
*
|
|
48
|
-
* - `titleForRole` falls back to a ROLE-derived phrase ("the main agent" /
|
|
49
|
-
* "the data agent" / "the analyst") — never a switchboard
|
|
50
|
-
* number. Every voice tool call carries a role (it is the operator's
|
|
51
|
-
* entire addressing vocabulary — see `voice-call.ts`'s
|
|
52
|
-
* `resolveRoleLine`), so this fallback is always reachable from a role
|
|
53
|
-
* the model already said out loud, and it feeds prose the model
|
|
54
|
-
* SPEAKS: an empty roster (nothing minted yet, or a pre-roster backend
|
|
55
|
-
* mid rolling deploy — `callTokenResponseSchema`'s `agents` field
|
|
56
|
-
* legitimately defaults to `[]`) must not leak a bare "Agent 2" into
|
|
57
|
-
* that prose.
|
|
58
|
-
* - `titleForLine` falls back to `"the main agent"` for line 1 and
|
|
59
|
-
* `` `Agent ${line}` `` otherwise — the "Agent N" convention the
|
|
60
|
-
* switchboard used before roles existed. This one serves the UI's
|
|
61
|
-
* numbered rail, which genuinely displays a switchboard slot number, so
|
|
62
|
-
* a line-derived fallback is correct there and stays as-is.
|
|
63
|
-
*/
|
|
64
|
-
export type CallAgentRole = "main" | "cli" | "consulting";
|
|
65
|
-
export type CallAgentSpec = {
|
|
66
|
-
readonly role: CallAgentRole;
|
|
67
|
-
/** The durable switchboard line underneath (`line-slots.ts`). */
|
|
68
|
-
readonly line: number;
|
|
69
|
-
/** What the voice calls this agent out loud. */
|
|
70
|
-
readonly title: string;
|
|
71
|
-
/** One sentence describing what this agent is for. */
|
|
72
|
-
readonly purpose: string;
|
|
73
|
-
};
|
|
74
|
-
/** Persist the roster minted for the current call. A whole-roster replace —
|
|
75
|
-
* never a per-entry patch — of whatever this workspace held before. */
|
|
76
|
-
export declare const setCallRoster: (roster: readonly CallAgentSpec[]) => void;
|
|
77
|
-
/** The current workspace's roster, or an empty array when nothing has been
|
|
78
|
-
* minted yet (or storage held junk). */
|
|
79
|
-
export declare const peekCallRoster: () => readonly CallAgentSpec[];
|
|
80
|
-
/** Persist the tenant's product name minted alongside the roster (U2) — a
|
|
81
|
-
* whole-value replace, same discipline as `setCallRoster`. */
|
|
82
|
-
export declare const setProductName: (productName: string | null) => void;
|
|
83
|
-
/** The current workspace's product name, or `null` when nothing has been
|
|
84
|
-
* minted yet, the tenant has none, or storage held junk. Used ONLY to
|
|
85
|
-
* localize the SDK's own UI copy (CallScreen's agent board, U2) — never fed
|
|
86
|
-
* into any string the model speaks or receives. */
|
|
87
|
-
export declare const peekProductName: () => string | null;
|
|
88
|
-
/** Resolve a role to its switchboard line. See the module doc: `null` only
|
|
89
|
-
* ever means "this NON-empty roster doesn't have that role" — an EMPTY
|
|
90
|
-
* roster falls back to the positional default instead. */
|
|
91
|
-
export declare const lineForRole: (role: CallAgentRole) => number | null;
|
|
92
|
-
/** Resolve a switchboard line to its role — the inverse of `lineForRole`,
|
|
93
|
-
* with the same two-rule fallback (EMPTY roster → positional; non-empty and
|
|
94
|
-
* missing → `null`). */
|
|
95
|
-
export declare const roleForLine: (line: number) => CallAgentRole | null;
|
|
96
|
-
/** What the voice calls this role out loud. Always a string — falls back to
|
|
97
|
-
* a ROLE-derived title (never a switchboard number, never `null`) when the
|
|
98
|
-
* roster has no entry for this role, whether the roster is empty or just
|
|
99
|
-
* missing it. */
|
|
100
|
-
export declare const titleForRole: (role: CallAgentRole) => string;
|
|
101
|
-
/** What the voice calls this line out loud. Always a string — falls back to
|
|
102
|
-
* `"the main agent"` (line 1) or `` `Agent ${line}` `` otherwise when the
|
|
103
|
-
* roster has no entry for this line, whether the roster is empty or just
|
|
104
|
-
* missing it. */
|
|
105
|
-
export declare const titleForLine: (line: number) => string;
|
|
106
|
-
/** Test-only: drop the persisted roster AND product name for the current
|
|
107
|
-
* workspace scope — they are minted together (the same call-token mint), so
|
|
108
|
-
* a test resetting one without the other would leak a stale product name
|
|
109
|
-
* (or roster) into the next case. */
|
|
110
|
-
export declare const __clearCallRosterForTest: () => void;
|