@belonguniverseai/react-sdk 0.3.6 → 0.4.0

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 (85) hide show
  1. package/dist/api/client.d.ts +1 -0
  2. package/dist/api/report-client-error.d.ts +1 -1
  3. package/dist/component/BelongWidget.d.ts +5 -3
  4. package/dist/component/{arc-6nY2VvBR.js → arc-BhIvhaIH.js} +2 -2
  5. package/dist/component/{architectureDiagram-3BPJPVTR-8NzFzSu-.js → architectureDiagram-3BPJPVTR-BWNCirdr.js} +3 -3
  6. package/dist/component/{blockDiagram-GPEHLZMM-DUEwMafH.js → blockDiagram-GPEHLZMM-BnslF4z5.js} +4 -4
  7. package/dist/component/{c4Diagram-AAUBKEIU-CDD_6To7.js → c4Diagram-AAUBKEIU-ByIoAzxn.js} +3 -3
  8. package/dist/component/{channel-B4iaYdVF.js → channel-BSkI2ZMQ.js} +2 -2
  9. package/dist/component/{chunk-2J33WTMH-DyOrhFxY.js → chunk-2J33WTMH-DdP5frJt.js} +2 -2
  10. package/dist/component/{chunk-4BX2VUAB-Bc66-Fjy.js → chunk-4BX2VUAB-DlsylVfZ.js} +2 -2
  11. package/dist/component/{chunk-55IACEB6-CIN0g3JH.js → chunk-55IACEB6-CcJHjxtI.js} +2 -2
  12. package/dist/component/{chunk-727SXJPM-BGs-m5or.js → chunk-727SXJPM-IzRNu9Aj.js} +6 -6
  13. package/dist/component/{chunk-AQP2D5EJ-CPlwnVcL.js → chunk-AQP2D5EJ-DmcGMHHV.js} +4 -4
  14. package/dist/component/{chunk-FMBD7UC4-09viRWEH.js → chunk-FMBD7UC4-T7thtdBK.js} +2 -2
  15. package/dist/component/{chunk-ND2GUHAM-BJo4K53f.js → chunk-ND2GUHAM-Dm_d0Ags.js} +2 -2
  16. package/dist/component/{chunk-QZHKN3VN-DufugBok.js → chunk-QZHKN3VN-D2PGEfVN.js} +2 -2
  17. package/dist/component/{classDiagram-4FO5ZUOK-DfAygW-7.js → classDiagram-4FO5ZUOK-Bn7KwDp9.js} +3 -3
  18. package/dist/component/{classDiagram-v2-Q7XG4LA2-DfAygW-7.js → classDiagram-v2-Q7XG4LA2-Bn7KwDp9.js} +3 -3
  19. package/dist/component/{cose-bilkent-S5V4N54A-CUKOuMcm.js → cose-bilkent-S5V4N54A-BtDuNpUN.js} +2 -2
  20. package/dist/component/{dagre-BM42HDAG-BPRObW6r.js → dagre-BM42HDAG-BknZdIOQ.js} +2 -2
  21. package/dist/component/{diagram-2AECGRRQ-Cxsg-pXz.js → diagram-2AECGRRQ-ISHN0dHe.js} +3 -3
  22. package/dist/component/{diagram-5GNKFQAL-U6L8NDef.js → diagram-5GNKFQAL-7gWbpLCQ.js} +4 -4
  23. package/dist/component/{diagram-KO2AKTUF-BxN_e8Dk.js → diagram-KO2AKTUF-B63ZLzkh.js} +3 -3
  24. package/dist/component/{diagram-LMA3HP47-Dbkb79LU.js → diagram-LMA3HP47-hhw0MjoS.js} +3 -3
  25. package/dist/component/{diagram-OG6HWLK6-SASqlYMy.js → diagram-OG6HWLK6-D_L9Gvuh.js} +4 -4
  26. package/dist/component/{erDiagram-TEJ5UH35-CDTBM9wY.js → erDiagram-TEJ5UH35-BAg27ZHd.js} +5 -5
  27. package/dist/component/{flowDiagram-I6XJVG4X-DugkNxCw.js → flowDiagram-I6XJVG4X-DDYjK7xG.js} +7 -7
  28. package/dist/component/{ganttDiagram-6RSMTGT7-D3FuGu21.js → ganttDiagram-6RSMTGT7-CDNAiKQG.js} +3 -3
  29. package/dist/component/{gitGraphDiagram-PVQCEYII-DMKggb_e.js → gitGraphDiagram-PVQCEYII-CY1N7jOJ.js} +4 -4
  30. package/dist/component/{highlighted-body-OFNGDK62-Bnl71RgK.js → highlighted-body-OFNGDK62-DHwLnkF_.js} +2 -2
  31. package/dist/component/index.js +2 -2
  32. package/dist/component/{infoDiagram-5YYISTIA-BaUo1fFU.js → infoDiagram-5YYISTIA-Cbgk6g6j.js} +2 -2
  33. package/dist/component/{ishikawaDiagram-YF4QCWOH-DofOP6uV.js → ishikawaDiagram-YF4QCWOH-BUfiorJj.js} +2 -2
  34. package/dist/component/{journeyDiagram-JHISSGLW-D-xl9LqQ.js → journeyDiagram-JHISSGLW-Bh4IizEm.js} +5 -5
  35. package/dist/component/{kanban-definition-UN3LZRKU-Lfcidbpn.js → kanban-definition-UN3LZRKU-CgWqLfFM.js} +3 -3
  36. package/dist/component/{linear-CtCl_nrs.js → linear-D1rJivs3.js} +2 -2
  37. package/dist/component/{mermaid-GHXKKRXX-CnzRBGo3.js → mermaid-GHXKKRXX-iO2IZZUN.js} +31474 -30252
  38. package/dist/component/{mindmap-definition-RKZ34NQL-RZVaz4dV.js → mindmap-definition-RKZ34NQL-DeQED-9b.js} +4 -4
  39. package/dist/component/{pieDiagram-4H26LBE5-CEwcfNwI.js → pieDiagram-4H26LBE5-CZ5Zt_mz.js} +4 -4
  40. package/dist/component/{quadrantDiagram-W4KKPZXB-BJBEiTgK.js → quadrantDiagram-W4KKPZXB-Dib1AukJ.js} +3 -3
  41. package/dist/component/{requirementDiagram-4Y6WPE33-CVHog8O-.js → requirementDiagram-4Y6WPE33-DubjTJYS.js} +4 -4
  42. package/dist/component/{sankeyDiagram-5OEKKPKP-Cn1N0qrl.js → sankeyDiagram-5OEKKPKP-Cq2S3XKs.js} +2 -2
  43. package/dist/component/{sequenceDiagram-3UESZ5HK-CRaBqdL0.js → sequenceDiagram-3UESZ5HK-BUo5k0zn.js} +4 -4
  44. package/dist/component/{stateDiagram-AJRCARHV-9q4hv0ii.js → stateDiagram-AJRCARHV-DJwQp0D7.js} +3 -3
  45. package/dist/component/{stateDiagram-v2-BHNVJYJU-By7O-5eN.js → stateDiagram-v2-BHNVJYJU-BX77P5aq.js} +3 -3
  46. package/dist/component/{timeline-definition-PNZ67QCA-BWfxZI7f.js → timeline-definition-PNZ67QCA-DnQ481VI.js} +3 -3
  47. package/dist/component/{vennDiagram-CIIHVFJN-B_PQ6bU6.js → vennDiagram-CIIHVFJN-BQ0X92lQ.js} +2 -2
  48. package/dist/component/{wardleyDiagram-YWT4CUSO-P7tCzeA0.js → wardleyDiagram-YWT4CUSO-CMTnjVTA.js} +3 -3
  49. package/dist/component/{xychartDiagram-2RQKCTM6-B4Z_Zrko.js → xychartDiagram-2RQKCTM6-BLSiRWug.js} +3 -3
  50. package/dist/components/embed/AgentChatIcon.d.ts +16 -0
  51. package/dist/components/embed/AgentPhaseIcon.d.ts +17 -0
  52. package/dist/components/embed/EmbedAvatar.d.ts +14 -2
  53. package/dist/components/embed/EmbedRail.d.ts +12 -1
  54. package/dist/components/embed/EmbedSessions.d.ts +22 -8
  55. package/dist/embed/adoption-notice.d.ts +22 -0
  56. package/dist/embed/auth0-cache.d.ts +32 -0
  57. package/dist/embed/auth0-refresh.d.ts +8 -5
  58. package/dist/embed/copy.d.ts +2 -0
  59. package/dist/embed/dock-state.d.ts +16 -0
  60. package/dist/embed/global.d.ts +6 -0
  61. package/dist/embed/host-layout-vars.d.ts +24 -0
  62. package/dist/embed/host-push-controller.d.ts +67 -0
  63. package/dist/embed/host-surface.d.ts +57 -0
  64. package/dist/embed/voice/agent-spawn.d.ts +38 -0
  65. package/dist/embed/voice/audio-utils.d.ts +6 -0
  66. package/dist/embed/voice/call-active-marker.d.ts +67 -0
  67. package/dist/embed/voice/line-dispatch.d.ts +13 -4
  68. package/dist/embed/voice/line-run-reader.d.ts +13 -0
  69. package/dist/embed/voice/line-slots.d.ts +61 -0
  70. package/dist/embed/voice/reconnect-offer.d.ts +29 -0
  71. package/dist/embed/voice/session-create.d.ts +26 -0
  72. package/dist/embed/voice/voice-http.d.ts +12 -0
  73. package/dist/embed/voice-bus.d.ts +2 -0
  74. package/dist/embed/voice-call-lines.d.ts +211 -14
  75. package/dist/embed/voice-call.d.ts +34 -6
  76. package/dist/i18n/messages/en.d.ts +11 -0
  77. package/dist/i18n/messages/surfaces/header.d.ts +6 -0
  78. package/dist/i18n/messages/surfaces/sessions.d.ts +3 -0
  79. package/dist/i18n/messages/surfaces/stream.d.ts +3 -0
  80. package/dist/stream/belong-chat-transport.d.ts +26 -0
  81. package/dist/stream/belong-data-parts.d.ts +8 -0
  82. package/dist/stream/route-dispatch.d.ts +17 -0
  83. package/dist/stream/stream-state-store.d.ts +7 -6
  84. package/dist/types/public.d.ts +3 -1
  85. package/package.json +1 -1
@@ -57,6 +57,7 @@ export declare const en: {
57
57
  readonly executingTasks: "Working on it…";
58
58
  readonly workedSteps_one: "Worked · {{count}} step";
59
59
  readonly workedSteps_other: "Worked · {{count}} steps";
60
+ readonly resumingAfterPause: "Taking longer than expected — picking it back up…";
60
61
  readonly open: "Open";
61
62
  readonly reconnectNeeded: "The {{provider}} session needs reconnecting to continue.";
62
63
  readonly reconnect: "Reconnect";
@@ -82,6 +83,7 @@ export declare const en: {
82
83
  readonly noSessionsYet: "No sessions yet.";
83
84
  readonly untitledSession: "Untitled session";
84
85
  readonly updated: "updated";
86
+ readonly loadedIntoAgent: "Loaded into Agent {{line}}";
85
87
  };
86
88
  readonly scheduled: {
87
89
  readonly viewTitle: "Scheduled";
@@ -211,6 +213,8 @@ export declare const en: {
211
213
  readonly hotkeyHint: "Hold {{key}} to talk — chat can stay closed";
212
214
  readonly expand: "Expand";
213
215
  readonly collapse: "Collapse";
216
+ readonly spawnAgent: "New agent";
217
+ readonly closeAgent: "Close {{label}}";
214
218
  };
215
219
  readonly files: {
216
220
  readonly refreshFiles: "Refresh files";
@@ -434,6 +438,7 @@ export declare const en: {
434
438
  readonly endCall: "End call";
435
439
  readonly dismiss: "Dismiss";
436
440
  readonly startCall: "Start voice call";
441
+ readonly reconnectCall: "Reconnect voice call";
437
442
  };
438
443
  readonly callScreen: {
439
444
  readonly title: "Voice call";
@@ -475,6 +480,12 @@ export declare const en: {
475
480
  readonly lineWorking: "working";
476
481
  readonly lineReady: "ready";
477
482
  readonly lineFailed: "failed";
483
+ readonly lineIdle: "idle";
484
+ readonly lineNotStarted: "not started";
485
+ readonly lineNoChat: "no chat yet";
486
+ readonly activity: "Activity";
487
+ readonly showConversationLog: "Show conversation log";
488
+ readonly hideConversationLog: "Hide conversation log";
478
489
  readonly ambientTypingCode: "Typing code…";
479
490
  readonly ambientReviewingDiff: "Reviewing the diff…";
480
491
  readonly ambientRunningChecks: "Running checks…";
@@ -15,6 +15,8 @@ export declare const headerEn: {
15
15
  readonly hotkeyHint: "Hold {{key}} to talk — chat can stay closed";
16
16
  readonly expand: "Expand";
17
17
  readonly collapse: "Collapse";
18
+ readonly spawnAgent: "New agent";
19
+ readonly closeAgent: "Close {{label}}";
18
20
  };
19
21
  };
20
22
  export declare const headerEs: {
@@ -33,6 +35,8 @@ export declare const headerEs: {
33
35
  hotkeyHint: string;
34
36
  expand: string;
35
37
  collapse: string;
38
+ spawnAgent: string;
39
+ closeAgent: string;
36
40
  };
37
41
  };
38
42
  export declare const headerPt: {
@@ -51,5 +55,7 @@ export declare const headerPt: {
51
55
  hotkeyHint: string;
52
56
  expand: string;
53
57
  collapse: string;
58
+ spawnAgent: string;
59
+ closeAgent: string;
54
60
  };
55
61
  };
@@ -18,6 +18,7 @@ export declare const sessionsEn: {
18
18
  readonly noSessionsYet: "No sessions yet.";
19
19
  readonly untitledSession: "Untitled session";
20
20
  readonly updated: "updated";
21
+ readonly loadedIntoAgent: "Loaded into Agent {{line}}";
21
22
  };
22
23
  };
23
24
  export declare const sessionsEs: {
@@ -39,6 +40,7 @@ export declare const sessionsEs: {
39
40
  noSessionsYet: string;
40
41
  untitledSession: string;
41
42
  updated: string;
43
+ loadedIntoAgent: string;
42
44
  };
43
45
  };
44
46
  export declare const sessionsPt: {
@@ -60,5 +62,6 @@ export declare const sessionsPt: {
60
62
  noSessionsYet: string;
61
63
  untitledSession: string;
62
64
  updated: string;
65
+ loadedIntoAgent: string;
63
66
  };
64
67
  };
@@ -57,6 +57,7 @@ export declare const streamEn: {
57
57
  readonly executingTasks: "Working on it…";
58
58
  readonly workedSteps_one: "Worked · {{count}} step";
59
59
  readonly workedSteps_other: "Worked · {{count}} steps";
60
+ readonly resumingAfterPause: "Taking longer than expected — picking it back up…";
60
61
  readonly open: "Open";
61
62
  readonly reconnectNeeded: "The {{provider}} session needs reconnecting to continue.";
62
63
  readonly reconnect: "Reconnect";
@@ -116,6 +117,7 @@ export declare const streamEs: {
116
117
  executingTasks: string;
117
118
  workedSteps_one: string;
118
119
  workedSteps_other: string;
120
+ resumingAfterPause: string;
119
121
  open: string;
120
122
  reconnectNeeded: string;
121
123
  reconnect: string;
@@ -175,6 +177,7 @@ export declare const streamPt: {
175
177
  executingTasks: string;
176
178
  workedSteps_one: string;
177
179
  workedSteps_other: string;
180
+ resumingAfterPause: string;
178
181
  open: string;
179
182
  reconnectNeeded: string;
180
183
  reconnect: string;
@@ -410,18 +410,22 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
410
410
  data: z.ZodObject<{
411
411
  status: z.ZodEnum<["continuing", "completed", "cancelled", "failed", "throttled"]>;
412
412
  message: z.ZodOptional<z.ZodString>;
413
+ retryable: z.ZodOptional<z.ZodBoolean>;
413
414
  }, "strip", z.ZodTypeAny, {
414
415
  status: "completed" | "failed" | "cancelled" | "continuing" | "throttled";
415
416
  message?: string | undefined;
417
+ retryable?: boolean | undefined;
416
418
  }, {
417
419
  status: "completed" | "failed" | "cancelled" | "continuing" | "throttled";
418
420
  message?: string | undefined;
421
+ retryable?: boolean | undefined;
419
422
  }>;
420
423
  }, "strip", z.ZodTypeAny, {
421
424
  id: string;
422
425
  data: {
423
426
  status: "completed" | "failed" | "cancelled" | "continuing" | "throttled";
424
427
  message?: string | undefined;
428
+ retryable?: boolean | undefined;
425
429
  };
426
430
  type: "data-status";
427
431
  }, {
@@ -429,6 +433,7 @@ export declare const wireStreamPartSchema: z.ZodDiscriminatedUnion<"type", [z.Zo
429
433
  data: {
430
434
  status: "completed" | "failed" | "cancelled" | "continuing" | "throttled";
431
435
  message?: string | undefined;
436
+ retryable?: boolean | undefined;
432
437
  };
433
438
  type: "data-status";
434
439
  }>, z.ZodObject<{
@@ -667,6 +672,22 @@ export declare const RECONNECT_MAX_CONSECUTIVE_FAILURES = 10;
667
672
  * instead — the same discipline browser/control-channel.ts already applies.
668
673
  */
669
674
  export declare const STALL_TIMEOUT_MS = 30000;
675
+ /**
676
+ * How long a retryable terminal (`data-status {status:"failed",
677
+ * retryable:true}` — a turn-deadline abort whose task WILL be reactivated on
678
+ * the same run/stream) may sit with no subsequent delivered event before the
679
+ * transport stops waiting and promotes it to a real failure. Reactivation is
680
+ * normally near-instant (the post-drain outbox recheck fires as the aborted
681
+ * drain settles) but the resumed turn can take a while to emit its first
682
+ * event (sandbox boot, transcript hydrate); the fleet-wide outbox sweep is
683
+ * the slowest legitimate path (≤60s period + ~30s first event). Without this
684
+ * bound a run that never resumes would hold the connection open forever —
685
+ * the server's 15s keepalives feed the stall watchdog, so no drop ever
686
+ * occurs and the composer stays wedged. Kept ≤ the persisted-cursor
687
+ * freshness window (stream-state-store RESUME_MAX_AGE_MS, 120s) so a reload
688
+ * anywhere inside an armed grace can still resume the run cursor.
689
+ */
690
+ export declare const RESUME_GRACE_MS = 120000;
670
691
  export type BelongChatTransportOptions = {
671
692
  /** Belong cloud base URL, e.g. `http://localhost:8787`. */
672
693
  readonly apiBaseUrl: string;
@@ -680,6 +701,11 @@ export type BelongChatTransportOptions = {
680
701
  * production uses `STALL_TIMEOUT_MS`.
681
702
  */
682
703
  readonly stallTimeoutMs?: number;
704
+ /**
705
+ * Retryable-terminal grace override (§25). Tests shrink it to tens of ms;
706
+ * production uses `RESUME_GRACE_MS`.
707
+ */
708
+ readonly resumeGraceMs?: number;
683
709
  /**
684
710
  * Workspace isolation: the host workspace this transport's session belongs
685
711
  * to. Defaults to the CURRENT scope at construction — captured once, so a
@@ -147,6 +147,14 @@ export type ArtifactData = {
147
147
  export type StatusData = {
148
148
  readonly status: RunStatusKind;
149
149
  readonly message?: string | undefined;
150
+ /**
151
+ * Resume promise on a "failed" status: the backend verified the session
152
+ * still has pending work, so outbox recovery will reactivate the task and
153
+ * keep streaming into the SAME run/stream. The transport keeps its cursor
154
+ * open on it (no finalize) and the renderer shows a quiet "picking it back
155
+ * up" pill instead of a scary failure badge.
156
+ */
157
+ readonly retryable?: boolean | undefined;
150
158
  };
151
159
  /**
152
160
  * F3 — per-turn token usage + compaction context. Emitted once per turn at
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The ONE seam that turns a `data-navigation` part into a host route-handler
3
+ * call — shared by the foreground renderer (`ai-sdk-part-renderers.tsx`'s
4
+ * `NavigationRenderer`) and a BACKGROUND line's run reader
5
+ * (`voice/line-run-reader.ts`), so a navigation the model dispatches on a
6
+ * background agent actually reaches the host instead of being silently
7
+ * dropped (a background line has no renderer to pick it up).
8
+ *
9
+ * Every failure mode (no handler registered, the handler throwing, the
10
+ * handler resolving `{ ok: false }`) collapses to one of three outcomes —
11
+ * never a throw — so both call sites can treat this as a plain result.
12
+ */
13
+ export type RouteDispatchOutcome = "ok" | "failed" | "no_handler";
14
+ export declare const dispatchRouteNavigation: (data: {
15
+ readonly routeName: string;
16
+ readonly params: Readonly<Record<string, string>>;
17
+ }) => Promise<RouteDispatchOutcome>;
@@ -45,7 +45,8 @@ export type PersistedStreamState = z.infer<typeof streamStateSchema>;
45
45
  * is demoted off the live run cursor.
46
46
  */
47
47
  export declare const readStreamState: (workspaceId?: string | null) => PersistedStreamState | null;
48
- export declare const writeStreamState: (state: Omit<PersistedStreamState, "updatedAt">, workspaceId?: string | null) => void;
48
+ export type StreamStateWriteMode = "select" | "select_if_empty" | "preserve_selection";
49
+ export declare const writeStreamState: (state: Omit<PersistedStreamState, "updatedAt">, workspaceId?: string | null, mode?: StreamStateWriteMode) => void;
49
50
  /**
50
51
  * Clear THIS TAB's pointer (New chat). Removes only the per-tab sessionStorage
51
52
  * record and marks the tab "seeded" so a reload stays blank instead of
@@ -63,11 +64,11 @@ export declare const clearStreamState: (workspaceId?: string | null) => void;
63
64
  */
64
65
  export declare const readResumableStreamState: (workspaceId?: string | null) => PersistedStreamState | null;
65
66
  /**
66
- * Persist the chosen session as the active stream session (sessions menu
67
- * switch / new). Passing a session id points the next ChatRoute mount at that
68
- * conversation with NO live run cursor (`runId`/`lastEventId` null) so it
69
- * restores from history rather than resuming a stale run. Passing null clears
70
- * the pointer entirely, so a fresh `belong-chat-<id>` is generated (New chat).
67
+ * Select one Session (sessions menu switch / new). A Session with a live cursor
68
+ * parked by this tab restores that cursor so the next ChatRoute mount resumes
69
+ * its working run. Historical/terminal Sessions restore from history with no
70
+ * run cursor. Passing null clears only the selected pointer; parked live runs
71
+ * remain available when the user comes back to them.
71
72
  */
72
73
  export declare const setActiveSessionId: (sessionId: string | null) => void;
73
74
  /**
@@ -259,8 +259,10 @@ export type BelongGlobal = {
259
259
  readonly __forceAgentLines?: (lines: readonly {
260
260
  line: number;
261
261
  label: string;
262
- status: "working" | "ready" | "failed" | "needs_approval";
262
+ status: "idle" | "working" | "ready" | "failed" | "needs_approval";
263
263
  sessionId?: string;
264
+ currentStepLabel?: string;
265
+ currentPhase?: "coding" | "files" | "actions";
264
266
  }[]) => void;
265
267
  };
266
268
  declare global {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belonguniverseai/react-sdk",
3
- "version": "v0.3.6",
3
+ "version": "0.4.0",
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",