@opengeni/react 0.28.2 → 0.32.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.
Files changed (208) hide show
  1. package/dist/approvals.d.ts +14 -0
  2. package/dist/{chunk-M7X4JZOD.js → chunk-4QOQ2DSR.js} +8 -1
  3. package/dist/chunk-4QOQ2DSR.js.map +1 -0
  4. package/dist/{chunk-HQFPO7VX.js → chunk-7CJOAW3V.js} +24 -3
  5. package/dist/{chunk-HQFPO7VX.js.map → chunk-7CJOAW3V.js.map} +1 -1
  6. package/dist/{chunk-PMSGE233.js → chunk-A2WITZTI.js} +377 -113
  7. package/dist/chunk-A2WITZTI.js.map +1 -0
  8. package/dist/{chunk-BC6RKIHS.js → chunk-GZ4KR67U.js} +11 -11
  9. package/dist/{chunk-4F2YLLHP.js → chunk-KZRUYCL4.js} +14 -17
  10. package/dist/chunk-KZRUYCL4.js.map +1 -0
  11. package/dist/{chunk-OCHBZ2X7.js → chunk-TCCE5ZU5.js} +192 -28
  12. package/dist/chunk-TCCE5ZU5.js.map +1 -0
  13. package/dist/chunk-U255M5EZ.js +178 -0
  14. package/dist/chunk-U255M5EZ.js.map +1 -0
  15. package/dist/{chunk-XVVQP7A4.js → chunk-WY2QN2CX.js} +2539 -2174
  16. package/dist/chunk-WY2QN2CX.js.map +1 -0
  17. package/dist/chunk-ZNNE2VES.js +6413 -0
  18. package/dist/chunk-ZNNE2VES.js.map +1 -0
  19. package/dist/client.d.ts +33 -0
  20. package/dist/commands/index.d.ts +3 -0
  21. package/dist/commands/registry.d.ts +41 -0
  22. package/dist/commands/types.d.ts +85 -0
  23. package/dist/components/approval-surface.d.ts +28 -0
  24. package/dist/components/chat-composer.d.ts +51 -0
  25. package/dist/components/code-editor.d.ts +43 -0
  26. package/dist/components/command-palette.d.ts +25 -0
  27. package/dist/components/composer-transcription-control.d.ts +36 -0
  28. package/dist/components/composer.d.ts +277 -0
  29. package/dist/components/copy-button.d.ts +26 -0
  30. package/dist/components/desktop-viewer.d.ts +85 -0
  31. package/dist/components/diff-view.d.ts +38 -0
  32. package/dist/components/enrollment-consent.d.ts +33 -0
  33. package/dist/components/enrollment-device-flow.d.ts +27 -0
  34. package/dist/components/file-browser.d.ts +47 -0
  35. package/dist/components/fleet-tile.d.ts +18 -0
  36. package/dist/components/human-input-form.d.ts +47 -0
  37. package/dist/components/machine-card.d.ts +21 -0
  38. package/dist/components/machine-dock-bar.d.ts +31 -0
  39. package/dist/components/machine-health-pill.d.ts +9 -0
  40. package/dist/components/machine-metrics.d.ts +15 -0
  41. package/dist/components/machine-status-pill.d.ts +54 -0
  42. package/dist/components/machines/health.d.ts +25 -0
  43. package/dist/components/machines/machine-detail.d.ts +14 -0
  44. package/dist/components/machines/metric-history-chart.d.ts +24 -0
  45. package/dist/components/machines/metric-sparkline.d.ts +9 -0
  46. package/dist/components/machines/series.d.ts +24 -0
  47. package/dist/components/machines-dashboard.d.ts +30 -0
  48. package/dist/components/markdown.d.ts +31 -0
  49. package/dist/components/message-timeline.d.ts +98 -0
  50. package/dist/components/model-picker.d.ts +19 -0
  51. package/dist/components/pierre-diff.d.ts +34 -0
  52. package/dist/components/pierre-file.d.ts +27 -0
  53. package/dist/components/queue-draft-policy.d.ts +7 -0
  54. package/dist/components/queue-surface-implementation.d.ts +20 -0
  55. package/dist/components/queue-surface-state.d.ts +12 -0
  56. package/dist/components/queue-surface.d.ts +12 -0
  57. package/dist/components/sandbox-files.d.ts +49 -0
  58. package/dist/components/sandbox-terminal.d.ts +123 -0
  59. package/dist/components/sandbox-workspace.d.ts +128 -0
  60. package/dist/components/session-chrome.d.ts +70 -0
  61. package/dist/components/session-status.d.ts +25 -0
  62. package/dist/components/soften-streaming-markdown.d.ts +13 -0
  63. package/dist/components/stream-reveal.d.ts +37 -0
  64. package/dist/components/tip-follow.d.ts +139 -0
  65. package/dist/components/tooltip.d.ts +16 -0
  66. package/dist/components/workbench-changes.d.ts +34 -0
  67. package/dist/components/workspace-dock.d.ts +35 -0
  68. package/dist/composer.d.ts +11 -7
  69. package/dist/composer.js +9 -6
  70. package/dist/hooks/internal.d.ts +46 -0
  71. package/dist/hooks/use-available-models.d.ts +37 -0
  72. package/dist/hooks/use-billing-usage.d.ts +26 -0
  73. package/dist/hooks/use-codex-accounts.d.ts +69 -0
  74. package/dist/{use-composer-ClHy1rkL.d.ts → hooks/use-composer.d.ts} +16 -24
  75. package/dist/hooks/use-desktop-stream.d.ts +43 -0
  76. package/dist/hooks/use-environments.d.ts +35 -0
  77. package/dist/{use-file-attachments-BmT8WtqO.d.ts → hooks/use-file-attachments.d.ts} +6 -9
  78. package/dist/hooks/use-goal.d.ts +46 -0
  79. package/dist/hooks/use-human-input.d.ts +26 -0
  80. package/dist/hooks/use-last-started-turn-policy.d.ts +27 -0
  81. package/dist/hooks/use-machine-chip.d.ts +54 -0
  82. package/dist/hooks/use-machines.d.ts +81 -0
  83. package/dist/hooks/use-packs.d.ts +27 -0
  84. package/dist/hooks/use-relay-frame-stream.d.ts +53 -0
  85. package/dist/hooks/use-rigs.d.ts +87 -0
  86. package/dist/hooks/use-sandbox-files.d.ts +108 -0
  87. package/dist/hooks/use-sandbox-git.d.ts +58 -0
  88. package/dist/hooks/use-sandbox-terminal.d.ts +62 -0
  89. package/dist/hooks/use-scheduled-tasks.d.ts +15 -0
  90. package/dist/hooks/use-session-capabilities.d.ts +83 -0
  91. package/dist/hooks/use-session-control.d.ts +22 -0
  92. package/dist/hooks/use-session-events.d.ts +92 -0
  93. package/dist/hooks/use-session-lineage.d.ts +17 -0
  94. package/dist/hooks/use-session-mcp-approval-policy.d.ts +23 -0
  95. package/dist/hooks/use-session.d.ts +23 -0
  96. package/dist/hooks/use-slash-commands.d.ts +66 -0
  97. package/dist/hooks/use-terminal-stream.d.ts +46 -0
  98. package/dist/hooks/use-transcription.d.ts +73 -0
  99. package/dist/hooks/use-turn-queue.d.ts +44 -0
  100. package/dist/hooks/use-voice-input.d.ts +25 -0
  101. package/dist/hooks/use-windowed-sections.d.ts +42 -0
  102. package/dist/hooks/use-workspace-capture.d.ts +49 -0
  103. package/dist/hooks/use-workspace-edit.d.ts +73 -0
  104. package/dist/hooks/use-workspace-sessions.d.ts +30 -0
  105. package/dist/hooks/use-workspaces.d.ts +22 -0
  106. package/dist/human-input.d.ts +18 -0
  107. package/dist/index.d.ts +144 -2119
  108. package/dist/index.js +421 -324
  109. package/dist/index.js.map +1 -1
  110. package/dist/lib/clipboard.d.ts +7 -0
  111. package/dist/lib/cn.d.ts +3 -0
  112. package/dist/lib/format.d.ts +48 -0
  113. package/dist/lib/git-patch.d.ts +8 -0
  114. package/dist/lib/motion-inspect.d.ts +5 -0
  115. package/dist/lib/motion.d.ts +14 -0
  116. package/dist/lib/noto-sans-arabic-loader.d.ts +1 -0
  117. package/dist/lib/noto-sans-jp-loader.generated.d.ts +1 -0
  118. package/dist/lib/relay-wire.d.ts +30 -0
  119. package/dist/lib/use-portal-token-style.d.ts +9 -0
  120. package/dist/lib/use-theme-type.d.ts +5 -0
  121. package/dist/lib/use-unicode-fonts.d.ts +12 -0
  122. package/dist/lib/xterm-renderer.d.ts +19 -0
  123. package/dist/lib/xterm-theme.d.ts +75 -0
  124. package/dist/machines.d.ts +30 -413
  125. package/dist/machines.js +3 -3
  126. package/dist/model-policy.d.ts +32 -0
  127. package/dist/model-policy.js +33 -0
  128. package/dist/model-policy.js.map +1 -0
  129. package/dist/provider.d.ts +16 -0
  130. package/dist/{queue-surface-implementation-UQ535OKQ.js → queue-surface-implementation-THPAKGMD.js} +2 -2
  131. package/dist/{queue-surface-implementation-UQ535OKQ.js.map → queue-surface-implementation-THPAKGMD.js.map} +1 -1
  132. package/dist/session-context.d.ts +82 -0
  133. package/dist/session-ui.d.ts +10 -7
  134. package/dist/session-ui.js +9 -5
  135. package/dist/session.d.ts +28 -6
  136. package/dist/session.js +11 -11
  137. package/dist/timeline/activity-rail.d.ts +19 -0
  138. package/dist/timeline/disclosure-context.d.ts +14 -0
  139. package/dist/timeline/entrance.d.ts +14 -0
  140. package/dist/timeline/fleet-decision-projection.d.ts +9 -0
  141. package/dist/timeline/fleet-decision-row.d.ts +11 -0
  142. package/dist/timeline/fold-memory.d.ts +15 -0
  143. package/dist/timeline/index.d.ts +18 -0
  144. package/dist/timeline/parsers.d.ts +96 -0
  145. package/dist/timeline/projection.d.ts +38 -0
  146. package/dist/timeline/registry.d.ts +40 -0
  147. package/dist/timeline/screenshot-lightbox.d.ts +26 -0
  148. package/dist/timeline/seen-activity-ids.d.ts +2 -0
  149. package/dist/timeline/shared.d.ts +125 -0
  150. package/dist/timeline/tool-diff.d.ts +8 -0
  151. package/dist/timeline/tool-display-name.d.ts +10 -0
  152. package/dist/timeline/tool-renderers.d.ts +5 -0
  153. package/dist/timeline/turn-summary.d.ts +116 -0
  154. package/dist/{use-turn-queue-Drm_ypue.d.ts → timeline/types.d.ts} +57 -67
  155. package/dist/types/machines.d.ts +11 -0
  156. package/package.json +8 -4
  157. package/src/client.ts +1 -0
  158. package/src/components/composer-transcription-control.tsx +278 -130
  159. package/src/components/composer.tsx +20 -15
  160. package/src/components/copy-button.tsx +127 -0
  161. package/src/components/markdown.tsx +231 -32
  162. package/src/components/message-timeline.tsx +1382 -378
  163. package/src/components/model-picker.tsx +83 -43
  164. package/src/components/queue-surface-implementation.tsx +1 -1
  165. package/src/components/session-chrome.tsx +942 -0
  166. package/src/components/soften-streaming-markdown.ts +205 -0
  167. package/src/components/stream-reveal.ts +195 -0
  168. package/src/components/tip-follow.ts +459 -0
  169. package/src/components/tooltip.tsx +103 -0
  170. package/src/composer.ts +6 -0
  171. package/src/hooks/internal.ts +30 -4
  172. package/src/hooks/use-available-models.ts +51 -4
  173. package/src/hooks/use-composer.ts +24 -18
  174. package/src/hooks/use-last-started-turn-policy.ts +95 -0
  175. package/src/hooks/use-session-events.ts +359 -5
  176. package/src/hooks/use-voice-input.ts +232 -0
  177. package/src/index.ts +49 -1
  178. package/src/lib/clipboard.ts +58 -0
  179. package/src/lib/format.ts +18 -0
  180. package/src/lib/motion-inspect.ts +5 -0
  181. package/src/lib/motion.ts +80 -0
  182. package/src/model-policy.ts +210 -0
  183. package/src/session-ui.ts +7 -0
  184. package/src/session.ts +2 -0
  185. package/src/timeline/activity-rail.tsx +46 -7
  186. package/src/timeline/entrance.tsx +10 -0
  187. package/src/timeline/fold-memory.ts +52 -0
  188. package/src/timeline/index.ts +11 -1
  189. package/src/timeline/projection.ts +252 -47
  190. package/src/timeline/seen-activity-ids.ts +19 -0
  191. package/src/timeline/shared.tsx +1 -1
  192. package/src/timeline/tool-renderers.tsx +75 -6
  193. package/src/timeline/turn-summary.tsx +387 -97
  194. package/src/timeline/types.ts +47 -0
  195. package/styles/index.css +99 -7
  196. package/styles/tokens.css +44 -3
  197. package/dist/chunk-4F2YLLHP.js.map +0 -1
  198. package/dist/chunk-M7X4JZOD.js.map +0 -1
  199. package/dist/chunk-OCHBZ2X7.js.map +0 -1
  200. package/dist/chunk-PMSGE233.js.map +0 -1
  201. package/dist/chunk-WAA247AB.js +0 -3858
  202. package/dist/chunk-WAA247AB.js.map +0 -1
  203. package/dist/chunk-XVVQP7A4.js.map +0 -1
  204. package/dist/composer-BMzimGTO.d.ts +0 -528
  205. package/dist/session-C3tIXLim.d.ts +0 -264
  206. package/dist/session-context-CAjlaeZb.d.ts +0 -84
  207. package/dist/session-ui-B_7cfN5u.d.ts +0 -259
  208. /package/dist/{chunk-BC6RKIHS.js.map → chunk-GZ4KR67U.js.map} +0 -0
@@ -0,0 +1,37 @@
1
+ /** Keep in sync with `--og-duration-stream` / `.og-stream-ink` in styles. */
2
+ export declare const INK_FADE_MS: number;
3
+ /** @deprecated Use {@link INK_FADE_MS}. */
4
+ export declare const WORD_ANIMATION_MS: number;
5
+ export type StreamReveal = {
6
+ /** Register the full current source text; new suffix becomes an ink batch. */
7
+ observe(text: string, now: number): void;
8
+ /**
9
+ * CSS animation-delay (ms) for the run covering `offset`, or null when that
10
+ * ink has settled and should render as plain text. Negative = resume mid-fade.
11
+ */
12
+ delayFor(offset: number, now: number): number | null;
13
+ /** True while any batch is still inside its fade window. */
14
+ hasActive(now: number): boolean;
15
+ };
16
+ export declare function createStreamReveal(): StreamReveal;
17
+ type HastText = {
18
+ type: "text";
19
+ value: string;
20
+ position?: {
21
+ start?: {
22
+ offset?: number | undefined;
23
+ } | undefined;
24
+ } | undefined;
25
+ };
26
+ type HastParent = {
27
+ type: string;
28
+ tagName?: string;
29
+ value?: string;
30
+ children?: HastChild[];
31
+ };
32
+ type HastChild = (HastText | HastParent) & Record<string, unknown>;
33
+ export declare function rehypeStreamReveal(options: {
34
+ reveal: StreamReveal;
35
+ now: number;
36
+ }): (tree: HastParent) => void;
37
+ export {};
@@ -0,0 +1,139 @@
1
+ /** Calm ease while live: remaining debt shrinks ~63% every τ_max ms. */
2
+ export declare const TIP_FOLLOW_TAU_MAX_MS: number;
3
+ /** Catch-up ease under large tip-debt (reader far behind / big paste). */
4
+ export declare const TIP_FOLLOW_TAU_MIN_MS: number;
5
+ /**
6
+ * Idle settle τ — stream quiet, soft landing into the tip. Longer than live
7
+ * calm so the last pixels decelerate instead of linear-crawling then stopping.
8
+ */
9
+ export declare const TIP_FOLLOW_SETTLE_TAU_MS: number;
10
+ /** Debt that saturates urgency toward τ_min. */
11
+ export declare const TIP_FOLLOW_CATCHUP_DEBT_PX = 240;
12
+ /** Keep the rAF alive this long after the last height growth. */
13
+ export declare const TIP_FOLLOW_HOT_IDLE_MS: number;
14
+ /** Cold oversized debt snaps (session switch / huge fold), not eases. */
15
+ export declare const TIP_FOLLOW_SNAP_PX = 480;
16
+ /** Soft speed floor while live with tiny debt (px/s). */
17
+ export declare const TIP_FOLLOW_CALM_MAX_PX_S: number;
18
+ /** Soft speed ceiling while catching a fast stream / modest tip-debt (px/s). */
19
+ export declare const TIP_FOLLOW_BURST_MAX_PX_S: number;
20
+ /** Ceiling for huge tip-debt / large single-frame walls (px/s). */
21
+ export declare const TIP_FOLLOW_SURGE_MAX_PX_S: number;
22
+ /**
23
+ * @deprecated Position growth-track removed — camera is velocity-smoothed.
24
+ * Kept so older tests/imports do not break.
25
+ */
26
+ export declare const TIP_FOLLOW_GROWTH_TRACK = 0;
27
+ /** @deprecated */
28
+ export declare const TIP_FOLLOW_LINE_TRACK = 0;
29
+ /** @deprecated Sub-line special-case removed with growth-track. */
30
+ export declare const TIP_FOLLOW_TOKEN_GROWTH_PX = 10;
31
+ /** Hot line-sized tip-debt uses the short {@link TIP_FOLLOW_LINE_TAU_MS}. */
32
+ export declare const TIP_FOLLOW_LINE_GROWTH_PX = 48;
33
+ /** Hot τ ceiling while closing a line-sized tip-debt (ms). */
34
+ export declare const TIP_FOLLOW_LINE_TAU_MS: number;
35
+ /**
36
+ * Velocity ease-in/out: scrollVel approaches desiredVel with this fraction of τ.
37
+ * Lower → snappier accel; higher → softer start (and slower reaction).
38
+ */
39
+ export declare const TIP_FOLLOW_ACCEL_TAU_FRAC = 0.45;
40
+ /** @deprecated Soft-rise FLIP removed — line glue was the bug. */
41
+ export declare const TIP_FOLLOW_SOFT_RISE_MS = 0;
42
+ /** @deprecated */
43
+ export declare const TIP_FOLLOW_SOFT_RISE_MAX_PX = 96;
44
+ /** @deprecated */
45
+ export declare const TIP_FOLLOW_SOFT_RISE_EASING = "cubic-bezier(0.22, 1, 0.36, 1)";
46
+ /** Ignore sub-pixel / reflow height noise for shrink compensate. */
47
+ export declare const TIP_FOLLOW_SHRINK_EPS_PX = 4;
48
+ /** Growth speed (px/s) that saturates velocity urgency. */
49
+ export declare const TIP_FOLLOW_VELOCITY_REF_PX_S: number;
50
+ /**
51
+ * Tip-debt below which growth velocity must not tighten τ.
52
+ * Sparse tokens are high-velocity by nature; only arm once actually behind.
53
+ */
54
+ export declare const TIP_FOLLOW_VELOCITY_ARM_DEBT_PX = 72;
55
+ /** EMA decay τ for growthVelocity when height is flat (ms). */
56
+ export declare const TIP_FOLLOW_VELOCITY_DECAY_MS: number;
57
+ /** Reader-up pixels above clamp budget that count as leaving the tip. */
58
+ export declare const TIP_FOLLOW_READER_UP_EPS_PX = 2;
59
+ /** @deprecated Shrink lock removed; kept so old imports do not break. */
60
+ export declare const TIP_FOLLOW_SHRINK_LOCK_MS = 0;
61
+ /** @deprecated Absorb thresholds removed — growth track is continuous. */
62
+ export declare const TIP_FOLLOW_GROWTH_ABSORB_PX = 96;
63
+ /**
64
+ * ScrollTop decrease not explained by a maxScroll clamp (fold / composer
65
+ * shrink). Fold clamp: top falls by ≈ maxScroll fall → 0. Real scroll-up:
66
+ * top falls while maxScroll holds → positive. No timers.
67
+ */
68
+ export declare function readerScrollUpPx(prevTop: number, nextTop: number, prevMaxScroll: number, nextMaxScroll: number): number;
69
+ export type TipFollowState = {
70
+ running: boolean;
71
+ hotUntil: number;
72
+ lastTs: number;
73
+ lastHeight: number;
74
+ lastGrowthAt: number;
75
+ /** EMA of recent height growth (px/s); nudges τ / ceiling under bursts. */
76
+ growthVelocity: number;
77
+ /** Camera velocity toward tip (px/s). Smoothed — never jumps with debt. */
78
+ scrollVelocity: number;
79
+ };
80
+ export type TipFollowStepInput = {
81
+ scrollTop: number;
82
+ scrollHeight: number;
83
+ clientHeight: number;
84
+ now: number;
85
+ pinned: boolean;
86
+ reducedMotion: boolean;
87
+ revealed: boolean;
88
+ };
89
+ export type TipFollowStepResult = {
90
+ scrollTop: number;
91
+ state: TipFollowState;
92
+ };
93
+ export declare function createTipFollowState(): TipFollowState;
94
+ export declare function tipFollowCancel(state: TipFollowState): TipFollowState;
95
+ /**
96
+ * Record content height. Positive growth extends the hot window so sparse
97
+ * lines do not tear down the follow loop between appends.
98
+ */
99
+ export declare function tipFollowNoteGrowth(state: TipFollowState, height: number, now: number): TipFollowState;
100
+ /**
101
+ * Adaptive τ: small debt → calm; large debt / armed velocity → catch-up.
102
+ * While hot, floor urgency so live streams are not stuck on calm τ.
103
+ * Idle settle uses the longer settle τ.
104
+ */
105
+ export declare function tipFollowTauMs(debtPx: number, growthVelocityPxPerSec?: number, settling?: boolean, hot?: boolean): number;
106
+ /**
107
+ * Soft speed ceiling from continuous signals (debt, velocity EMA, this-frame
108
+ * growth). No mode switches — larger inputs raise the ceiling smoothly.
109
+ */
110
+ export declare function tipFollowMaxStepPx(debtPx: number, growthVelocityPxPerSec: number, dtMs: number, frameGrowthPx?: number, hot?: boolean): number;
111
+ /**
112
+ * Counter-offset for soft-rise after tip-glue: start from the mid-flight
113
+ * translateY (if any) plus this frame's glued scroll delta, capped.
114
+ * Shell applies translateY(from) → 0 over {@link TIP_FOLLOW_SOFT_RISE_MS}.
115
+ */
116
+ export declare function tipFollowSoftRiseFrom(currentTranslateY: number, gluedScrollDelta: number, maxPx?: number): number;
117
+ /** Read live translateY from a transformed content column (mid soft-rise). */
118
+ export declare function readTranslateY(el: HTMLElement): number;
119
+ /**
120
+ * Cancel the tip-glue pop: start at translateY(+δ) and ease to 0.
121
+ * Uses WAAPI — a same-frame CSS transition never paints the counter-offset,
122
+ * so the scroll jump stays an instant one-line pop.
123
+ */
124
+ export declare function tipFollowPlaySoftRise(el: HTMLElement, gluedScrollDelta: number, opts?: {
125
+ durationMs?: number;
126
+ maxPx?: number;
127
+ easing?: string;
128
+ }): void;
129
+ /** Stop soft-rise and clear any CSS transform residue. */
130
+ export declare function tipFollowClearSoftRise(el: HTMLElement): void;
131
+ /**
132
+ * Height left the document (settle collapse / composer). Keep the same pixels
133
+ * on screen: scrollTop -= Δh, clamped to the new max.
134
+ */
135
+ export declare function tipFollowCompensateShrink(scrollTop: number, previousHeight: number, nextHeight: number, clientHeight: number, epsPx?: number): number;
136
+ /**
137
+ * One camera step. Shell schedules the next rAF while `result.state.running`.
138
+ */
139
+ export declare function tipFollowStep(state: TipFollowState, input: TipFollowStepInput): TipFollowStepResult;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Token-styled Radix tooltip — SDK counterpart to apps/web `components/ui/tooltip`.
3
+ * Portals copy `--og-*` tokens so embeds keep the host theme outside `.og-root`.
4
+ *
5
+ * Background/foreground are applied as inline styles (not only Tailwind
6
+ * utilities): `.og-root` sets `color: var(--og-color-fg)` after utilities in the
7
+ * consumer CSS cascade, which would otherwise paint light-on-light inverted
8
+ * tips and look like a blank white bubble.
9
+ */
10
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
11
+ import { type ComponentProps } from "react";
12
+ declare function TooltipProvider({ delayDuration, ...props }: ComponentProps<typeof TooltipPrimitive.Provider>): import("react/jsx-runtime").JSX.Element;
13
+ declare function Tooltip({ children, ...props }: ComponentProps<typeof TooltipPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
14
+ declare function TooltipTrigger({ asChild, ...props }: ComponentProps<typeof TooltipPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
15
+ declare function TooltipContent({ className, sideOffset, children, style, ...props }: ComponentProps<typeof TooltipPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
16
+ export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
@@ -0,0 +1,34 @@
1
+ import type { SandboxGitFileDiff } from "../hooks/use-sandbox-git";
2
+ export type WorkbenchChangesProps = {
3
+ /** The changed files (`useSandboxGit().diff`). Assumed non-empty by the caller. */
4
+ diff: SandboxGitFileDiff[];
5
+ /** Which source the diff came from — drives the "live" vs "as of turn" badge. */
6
+ source: "live" | "capture" | null;
7
+ /** When the served capture was taken (ISO), when `source === "capture"`. */
8
+ capturedAt: string | null;
9
+ /** The capture's turn revision, for the "as of turn N" badge. */
10
+ captureRevision?: number | null | undefined;
11
+ themeType?: "dark" | "light" | undefined;
12
+ /** Route a guarded binary/oversize file into the live Files surface. */
13
+ onOpenFile?: ((path: string) => void) | undefined;
14
+ className?: string | undefined;
15
+ };
16
+ type RailRow = {
17
+ kind: "group";
18
+ label: string;
19
+ count: number;
20
+ } | {
21
+ kind: "file";
22
+ file: SandboxGitFileDiff;
23
+ index: number;
24
+ };
25
+ /** Order the files and build the rail rows (grouped past the threshold). The
26
+ * returned `orderedFiles` drives BOTH the rail and the diff pane so a rail row's
27
+ * `index` addresses the matching pane section. Exported for tests. */
28
+ export declare function buildRail(files: SandboxGitFileDiff[]): {
29
+ orderedFiles: SandboxGitFileDiff[];
30
+ rows: RailRow[];
31
+ grouped: boolean;
32
+ };
33
+ export declare function WorkbenchChanges({ diff, source, capturedAt, captureRevision, themeType, onOpenFile, className, }: WorkbenchChangesProps): import("react/jsx-runtime").JSX.Element;
34
+ export {};
@@ -0,0 +1,35 @@
1
+ import { type ReactNode } from "react";
2
+ export type WorkspaceTab = {
3
+ id: string;
4
+ label: ReactNode;
5
+ /** Rendered as the active surface. */
6
+ content: ReactNode;
7
+ /** A small badge after the label (e.g. dirty count, live pill). */
8
+ badge?: ReactNode | undefined;
9
+ };
10
+ export type WorkspaceDockProps = {
11
+ /** The chat / primary pane shown beside the dock. */
12
+ primary: ReactNode;
13
+ tabs: WorkspaceTab[];
14
+ /** Controlled active tab. Falls back to the first tab. */
15
+ activeTab?: string | undefined;
16
+ onActiveTabChange?: ((id: string) => void) | undefined;
17
+ /** Controlled collapsed state for hosts that expose their own dock toggle. */
18
+ collapsed?: boolean | undefined;
19
+ onCollapsedChange?: ((collapsed: boolean) => void) | undefined;
20
+ /** A status accessory pinned to the right of the tab strip, left of the
21
+ * maximize/collapse controls (e.g. the machine-state chip). Renders in both
22
+ * the docked header and the full-screen overlay header. */
23
+ headerAccessory?: ReactNode | undefined;
24
+ /** Optional host navigation shown at the start of the phone overlay header.
25
+ * It is intentionally absent from desktop dock chrome. */
26
+ mobileLeadingControl?: ReactNode | undefined;
27
+ /** Persisted layout id (localStorage key) for react-resizable-panels. */
28
+ autoSaveId?: string | undefined;
29
+ /** Default dock width as a percent of the session area. */
30
+ defaultSize?: number | undefined;
31
+ minSize?: number | undefined;
32
+ maxSize?: number | undefined;
33
+ className?: string | undefined;
34
+ };
35
+ export declare function WorkspaceDock({ primary, tabs, activeTab, onActiveTabChange, collapsed: collapsedProp, onCollapsedChange, headerAccessory, mobileLeadingControl, autoSaveId, defaultSize, minSize, maxSize, className, }: WorkspaceDockProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,11 @@
1
- export { A as Actions, s as AttachButton, v as Attachments, w as ChatComposerContextValue, x as ChatComposerController, c as ChatComposerMessages, y as CommandPalette, z as ComposerActionsProps, B as ComposerAttachButtonProps, D as ComposerCommandPaletteProps, C as ComposerControlLinks, E as ComposerControlState, F as ComposerControlsProps, G as ComposerDelivery, H as ComposerDraftState, J as ComposerFooterProps, K as ComposerFrameProps, L as ComposerHintProps, M as ComposerInputProps, P as ComposerModelPickerProps, Q as ComposerPauseButtonProps, R as ComposerRootProps, V as ComposerSendButtonProps, W as ComposerSubmitBlocker, X as ComposerSubmitMode, Y as ComposerSurfaceProps, g as ComposerTranscriptionControl, a as ComposerTranscriptionControlProps, h as ComposerTranscriptionMessages, Z as Confirmation, _ as Controls, $ as Footer, a0 as Frame, a1 as Help, a2 as Hint, a3 as Input, a4 as ModelPicker, O as OPEN_WORKSTREAM_CONTROL_EVENT, a5 as PauseButton, a6 as PausedState, a7 as RestoredResources, a8 as Root, a9 as SendButton, aa as Status, ab as Surface, ac as UseChatComposerControllerOptions, q as defaultChatComposerMessages, ad as useChatComposer, ae as useChatComposerController } from './composer-BMzimGTO.js';
2
- import 'react/jsx-runtime';
3
- import 'react';
4
- import '@opengeni/sdk';
5
- import './session-context-CAjlaeZb.js';
6
- import './use-composer-ClHy1rkL.js';
7
- import './use-file-attachments-BmT8WtqO.js';
1
+ /**
2
+ * Advanced chat-composer framework. Import this subpath as a namespace:
3
+ *
4
+ * `import * as Composer from "@opengeni/react/composer"`.
5
+ */
6
+ export { Actions, AttachButton, Attachments, CommandPalette, Confirmation, Controls, Footer, Frame, Help, Hint, Input, ModelPicker, OPEN_WORKSTREAM_CONTROL_EVENT, PauseButton, PausedState, RestoredResources, Root, SendButton, Status, Surface, defaultChatComposerMessages, useChatComposer, useChatComposerController, } from "./components/composer";
7
+ export type { ChatComposerController, ChatComposerContextValue, ChatComposerMessages, ComposerActionsProps, ComposerAttachButtonProps, ComposerCommandPaletteProps, ComposerControlLinks, ComposerControlState, ComposerControlsProps, ComposerDelivery, ComposerDraftState, ComposerFooterProps, ComposerFrameProps, ComposerHintProps, ComposerInputProps, ComposerModelPickerProps, ComposerPauseButtonProps, ComposerRootProps, ComposerSendButtonProps, ComposerSubmitBlocker, ComposerSubmitMode, ComposerSurfaceProps, UseChatComposerControllerOptions, } from "./components/composer";
8
+ export { ComposerTranscriptionControl } from "./components/composer-transcription-control";
9
+ export type { ComposerTranscriptionControlProps, ComposerTranscriptionMessages, } from "./components/composer-transcription-control";
10
+ export { useVoiceInput } from "./hooks/use-voice-input";
11
+ export type { UseVoiceInputOptions, UseVoiceInputResult, VoiceInputStatus, } from "./hooks/use-voice-input";
package/dist/composer.js CHANGED
@@ -22,12 +22,14 @@ import {
22
22
  Surface,
23
23
  defaultChatComposerMessages,
24
24
  useChatComposer,
25
- useChatComposerController
26
- } from "./chunk-XVVQP7A4.js";
25
+ useChatComposerController,
26
+ useVoiceInput
27
+ } from "./chunk-WY2QN2CX.js";
28
+ import "./chunk-KZRUYCL4.js";
29
+ import "./chunk-7CJOAW3V.js";
30
+ import "./chunk-U255M5EZ.js";
27
31
  import "./chunk-TK7G6XLT.js";
28
- import "./chunk-4F2YLLHP.js";
29
- import "./chunk-HQFPO7VX.js";
30
- import "./chunk-M7X4JZOD.js";
32
+ import "./chunk-4QOQ2DSR.js";
31
33
  export {
32
34
  Actions,
33
35
  AttachButton,
@@ -52,6 +54,7 @@ export {
52
54
  Surface,
53
55
  defaultChatComposerMessages,
54
56
  useChatComposer,
55
- useChatComposerController
57
+ useChatComposerController,
58
+ useVoiceInput
56
59
  };
57
60
  //# sourceMappingURL=composer.js.map
@@ -0,0 +1,46 @@
1
+ import type { SessionEvent } from "@opengeni/sdk";
2
+ import type { EmbeddedSessionEventClientLike } from "../client";
3
+ export type AsyncListState<T> = {
4
+ data: T | null;
5
+ loading: boolean;
6
+ error: Error | null;
7
+ refresh: () => Promise<void>;
8
+ };
9
+ /**
10
+ * Shared fetch + optional polling loop for the list/read hooks. Stale
11
+ * responses (superseded by a newer load or an unmount) are dropped.
12
+ */
13
+ export declare function usePolledValue<T>(load: (signal?: AbortSignal) => Promise<T>, options?: {
14
+ pollIntervalMs?: number | undefined;
15
+ enabled?: boolean | undefined;
16
+ }): AsyncListState<T>;
17
+ export type MutationState = {
18
+ mutating: boolean;
19
+ mutationError: Error | null;
20
+ clearMutationError: () => void;
21
+ };
22
+ /**
23
+ * Shared async mutation runner for the write hooks. `run` resolves with the
24
+ * operation's value, or `null` after capturing the error in `mutationError`
25
+ * (callers then roll back optimistic state).
26
+ */
27
+ export declare function useMutationRunner(identity?: unknown): MutationState & {
28
+ run: <T>(operation: () => Promise<T>) => Promise<T | null>;
29
+ };
30
+ export type SessionEventFeedOptions = {
31
+ /**
32
+ * Share an existing event log (from `useSessionEvents`) instead of opening
33
+ * a second stream. When omitted the hook tails the session's event stream
34
+ * itself, starting at the current `lastSequence`.
35
+ */
36
+ events?: SessionEvent[] | undefined;
37
+ enabled?: boolean | undefined;
38
+ };
39
+ /**
40
+ * Invoke `onEvent` for every session event matching `match` — the live-update
41
+ * primitive behind `useTurnQueue` and `useGoal`. Either watches a shared
42
+ * `events` log or tails the stream directly (reconnect handled by the SDK).
43
+ */
44
+ export declare function useSessionEventTrigger(client: EmbeddedSessionEventClientLike, workspaceId: string, sessionId: string | null | undefined, match: (event: SessionEvent) => boolean, onEvent: (event: SessionEvent) => void, options?: SessionEventFeedOptions, reconcileBeforeLive?: (() => void | Promise<void>) | undefined): void;
45
+ /** Debounce rapid event bursts into one trailing call (default 150ms). */
46
+ export declare function useDebouncedCallback(callback: () => void, delayMs?: number): () => void;
@@ -0,0 +1,37 @@
1
+ import type { WorkspaceModelCatalogModel } from "@opengeni/sdk";
2
+ import { type PickerModelRow } from "../model-policy";
3
+ import { type ClientOverride } from "../provider";
4
+ export type UseAvailableModelsOptions = Pick<ClientOverride, "client"> & {
5
+ /** Refresh interval (ms). Off by default — the host model list rarely moves. */
6
+ pollIntervalMs?: number | undefined;
7
+ enabled?: boolean | undefined;
8
+ };
9
+ export type UseAvailableModelsResult = {
10
+ models: import("@opengeni/sdk").ClientModel[];
11
+ defaultModel: string | null;
12
+ loading: boolean;
13
+ error: Error | null;
14
+ refresh: () => Promise<void>;
15
+ };
16
+ export type UseWorkspaceModelCatalogOptions = Pick<ClientOverride, "client"> & {
17
+ workspaceId: string | null;
18
+ pollIntervalMs?: number | undefined;
19
+ enabled?: boolean | undefined;
20
+ };
21
+ export type UseWorkspaceModelCatalogResult = {
22
+ models: WorkspaceModelCatalogModel[];
23
+ rows: PickerModelRow[];
24
+ defaultModel: string | null;
25
+ loading: boolean;
26
+ error: Error | null;
27
+ refresh: () => Promise<void>;
28
+ };
29
+ /**
30
+ * The host-exposed model list for a <ModelPicker>: fetches the deployment's
31
+ * public client config (`GET /v1/config/client`) and surfaces the richer
32
+ * provider-grouped `models` plus the `defaultModel` the picker should preselect.
33
+ * Deployment-scoped, so it only needs the client (no workspace).
34
+ */
35
+ export declare function useAvailableModels(options?: UseAvailableModelsOptions): UseAvailableModelsResult;
36
+ /** Workspace-scoped catalog with selectability and billing-class picker rows. */
37
+ export declare function useWorkspaceModelCatalog(options: UseWorkspaceModelCatalogOptions): UseWorkspaceModelCatalogResult;
@@ -0,0 +1,26 @@
1
+ import type { BillingBalance, UsageEvent } from "@opengeni/sdk";
2
+ import { type ClientOverride } from "../provider";
3
+ export type UseBillingUsageOptions = Pick<ClientOverride, "client"> & {
4
+ /** Account to read. Defaults to the caller's default account server-side. */
5
+ accountId?: string | undefined;
6
+ /** Filter usage to one workspace. */
7
+ workspaceId?: string | undefined;
8
+ /** Refresh interval (ms) for live billing meters. Off by default. */
9
+ pollIntervalMs?: number | undefined;
10
+ enabled?: boolean | undefined;
11
+ };
12
+ export type UseBillingUsageResult = {
13
+ /** Prepaid credit balance (micro-USD), null until loaded. */
14
+ balance: BillingBalance | null;
15
+ /** Recent usage events (runs, tokens, cost, uploads, ...). */
16
+ usage: UsageEvent[];
17
+ loading: boolean;
18
+ error: Error | null;
19
+ refresh: () => Promise<void>;
20
+ };
21
+ /**
22
+ * Account billing usage: credit balance + recent usage events — the data
23
+ * behind per-call billing meters. Account-scoped, so it only needs the
24
+ * client; pass `workspaceId` to narrow usage to one workspace.
25
+ */
26
+ export declare function useBillingUsage(options?: UseBillingUsageOptions): UseBillingUsageResult;
@@ -0,0 +1,69 @@
1
+ import type { CodexAccount, CodexAccountsResponse, CodexRotationSettings, SessionEvent } from "@opengeni/sdk";
2
+ import { type ClientOverride } from "../provider";
3
+ import { type SessionEventFeedOptions } from "./internal";
4
+ /** Events that change which Codex account a session runs on (or just ran). */
5
+ export declare function isCodexAccountEvent(event: Pick<SessionEvent, "type">): boolean;
6
+ /**
7
+ * The structural slice of the SDK client the Codex-accounts surface needs. Method
8
+ * NAMES + SIGNATURES match `OpenGeniClient` so the real client satisfies it
9
+ * directly; declared structurally (not a hard Pick) so a test/Geni client can
10
+ * stand in. `getSession` reads the session's pin/last; `pinSessionCodexAccount`
11
+ * is the optional mutation (absent ⇒ the indicator hides the switch affordance).
12
+ */
13
+ export type CodexAccountsClientLike = {
14
+ listCodexAccounts: (workspaceId: string) => Promise<CodexAccountsResponse>;
15
+ getSession?: (workspaceId: string, sessionId: string) => Promise<{
16
+ codexPinnedCredentialId?: string | null;
17
+ codexLastCredentialId?: string | null;
18
+ }>;
19
+ pinSessionCodexAccount?: (workspaceId: string, sessionId: string, target: string) => Promise<{
20
+ pinned: string;
21
+ }>;
22
+ /** Optional (absent ⇒ the card hides live refresh): batched live /wham/usage refresh. */
23
+ refreshCodexUsage?: (workspaceId: string) => Promise<{
24
+ usage: Record<string, unknown>;
25
+ }>;
26
+ };
27
+ export type UseCodexAccountsOptions = ClientOverride & SessionEventFeedOptions & {
28
+ pollIntervalMs?: number | undefined;
29
+ /** Scope to a session so the hook resolves the pin + the effective account. */
30
+ sessionId?: string | undefined;
31
+ /** Override the client with one implementing `CodexAccountsClientLike`. */
32
+ codexClient?: CodexAccountsClientLike | undefined;
33
+ };
34
+ export type UseCodexAccountsResult = {
35
+ accounts: CodexAccount[];
36
+ /** The workspace ACTIVE account (used when a session is unpinned). */
37
+ activeAccountId: string | null;
38
+ /** The session's PINNED account (null ⇒ following workspace active). */
39
+ pinnedAccountId: string | null;
40
+ /** The account the next turn will run on: pin > workspace active. */
41
+ effectiveAccountId: string | null;
42
+ /** The account the session's last turn ACTUALLY ran on (the "Running on:" source). */
43
+ lastAccountId: string | null;
44
+ settings: CodexRotationSettings;
45
+ loading: boolean;
46
+ refresh: () => Promise<void>;
47
+ /**
48
+ * Trigger a LIVE batched /wham/usage refresh across all accounts, then re-read
49
+ * the cached metadata so the new windows land on `accounts`. Modeled on `pin`.
50
+ * No-op (resolves false) when the client can't refresh usage.
51
+ */
52
+ refreshUsage: () => Promise<boolean>;
53
+ /** True while a live usage refresh is in flight (drives the bar skeleton). */
54
+ refreshingUsage: boolean;
55
+ /** Pin (or unpin via "auto") the session's account; returns true on success. */
56
+ pin: (target: string) => Promise<boolean>;
57
+ pinning: boolean;
58
+ /** The target of the in-flight pin (for per-row spinner gating). */
59
+ pinningTarget: string | null;
60
+ mutationError: Error | null;
61
+ };
62
+ /**
63
+ * The workspace's Codex accounts + the per-workspace active pointer + (when
64
+ * session-scoped) the session pin and last-ran-on account. Composed like
65
+ * `useMachines`: slow polling (the realtime work is done by the
66
+ * `codex.account.switched` / `turn.started` event trigger) + a `pin` mutation.
67
+ * Dual-consumer safe via the structural `CodexAccountsClientLike` surface.
68
+ */
69
+ export declare function useCodexAccounts(options?: UseCodexAccountsOptions): UseCodexAccountsResult;
@@ -1,22 +1,12 @@
1
- import { SessionEvent, EffectiveControlResumeOption, ComposerDraft, ResourceRef, SendMessageInput, EffectiveSessionControl } from '@opengeni/sdk';
2
- import { a as EmbeddedSessionClientOverride } from './session-context-CAjlaeZb.js';
3
-
4
- type SessionEventFeedOptions = {
5
- /**
6
- * Share an existing event log (from `useSessionEvents`) instead of opening
7
- * a second stream. When omitted the hook tails the session's event stream
8
- * itself, starting at the current `lastSequence`.
9
- */
10
- events?: SessionEvent[] | undefined;
11
- enabled?: boolean | undefined;
12
- };
13
-
14
- type ComposerSendExtras = Omit<SendMessageInput, "text" | "clientEventId">;
15
- type UseComposerOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & {
1
+ import type { ComposerDraft, EffectiveControlResumeOption, EffectiveSessionControl, ResourceRef, SendMessageInput, SessionEvent } from "@opengeni/sdk";
2
+ import { type EmbeddedSessionClientOverride } from "../session-context";
3
+ import { type SessionEventFeedOptions } from "./internal";
4
+ export type ComposerSendExtras = Omit<SendMessageInput, "text" | "clientEventId">;
5
+ export type UseComposerOptions = EmbeddedSessionClientOverride & SessionEventFeedOptions & {
16
6
  /** Called with the exact accepted wire input after a successful send. */
17
7
  onSent?: ((text: string, input: SendMessageInput) => void) | undefined;
18
8
  /**
19
- * Extra message fields (resources, tools, model, reasoningEffort) merged
9
+ * Extra message fields (resources, tools, model, reasoningEffort, latencyMode) merged
20
10
  * into every send. A function is evaluated at send time so it can read the
21
11
  * surrounding UI state (attachment pickers, model selectors, ...).
22
12
  */
@@ -34,7 +24,7 @@ type UseComposerOptions = EmbeddedSessionClientOverride & SessionEventFeedOption
34
24
  /** Disable remote composer-draft reads and writes for embedded hosts. */
35
25
  draftPersistence?: "durable" | "disabled" | undefined;
36
26
  };
37
- type ComposerState = {
27
+ export type ComposerState = {
38
28
  value: string;
39
29
  setValue: (value: string) => void;
40
30
  /** Read the current draft synchronously before a destructive replacement. */
@@ -73,21 +63,25 @@ type ComposerState = {
73
63
  * more hostile than losing a typed message); each send carries a generated
74
64
  * `clientEventId` so retries stay idempotent server-side.
75
65
  */
76
- declare function useComposer(sessionId: string | null | undefined, options?: UseComposerOptions): ComposerState;
66
+ export declare function useComposer(sessionId: string | null | undefined, options?: UseComposerOptions): ComposerState;
67
+ /** Events that can atomically replace or clear this subject's durable draft. */
68
+ export declare function isComposerDraftEvent(event: Pick<SessionEvent, "type">): boolean;
77
69
  /**
78
70
  * Default text for a file-only message (attachment(s) present, no typed draft).
79
71
  * Kept non-empty so the wire contract (`text: z.string().min(1)`) and the
80
72
  * worker's non-whitespace guard accept it; the attached files still ride in
81
73
  * `resources`. Exported for tests.
82
74
  */
83
- declare const FILE_ONLY_MESSAGE_TEXT = "(see attached files)";
75
+ export declare const FILE_ONLY_MESSAGE_TEXT = "(see attached files)";
76
+ /** Resolve possibly-deferred extras to a concrete bag (function evaluated now). */
77
+ export declare function resolveSendExtras(extras: ComposerSendExtras | (() => ComposerSendExtras) | undefined): ComposerSendExtras;
84
78
  /**
85
79
  * Merge the draft text + idempotency key with caller-provided extras. The
86
80
  * text and clientEventId always win over extras. Exported for tests.
87
81
  */
88
- declare function composeSendInput(text: string, clientEventId: string, extras: ComposerSendExtras | (() => ComposerSendExtras) | undefined, bound?: Partial<SendMessageInput>): SendMessageInput;
82
+ export declare function composeSendInput(text: string, clientEventId: string, extras: ComposerSendExtras | (() => ComposerSendExtras) | undefined, bound?: Partial<SendMessageInput>): SendMessageInput;
89
83
  /** Submit on plain Enter; Shift+Enter inserts a newline. Exported for tests. */
90
- declare function shouldSubmitOnKey(event: {
84
+ export declare function shouldSubmitOnKey(event: {
91
85
  key: string;
92
86
  shiftKey: boolean;
93
87
  metaKey?: boolean;
@@ -97,9 +91,7 @@ declare function shouldSubmitOnKey(event: {
97
91
  };
98
92
  }): boolean;
99
93
  /** Cmd/Ctrl+Enter steers; ordinary Enter appends to the queue. */
100
- declare function shouldSteerOnKey(event: {
94
+ export declare function shouldSteerOnKey(event: {
101
95
  metaKey?: boolean;
102
96
  ctrlKey?: boolean;
103
97
  }): boolean;
104
-
105
- export { type ComposerState as C, FILE_ONLY_MESSAGE_TEXT as F, type SessionEventFeedOptions as S, type UseComposerOptions as U, type ComposerSendExtras as a, shouldSubmitOnKey as b, composeSendInput as c, shouldSteerOnKey as s, useComposer as u };
@@ -0,0 +1,43 @@
1
+ import { type DesktopConnectionState, type DesktopRfbFactory, type DesktopStreamCapability } from "@opengeni/sdk";
2
+ import { type RefObject } from "react";
3
+ import { type DesktopWebSocketFactory } from "./use-relay-frame-stream";
4
+ export type UseDesktopStreamOptions = {
5
+ /** The desktop cell of the negotiated capabilities (`capabilities.DesktopStream`). */
6
+ capability: DesktopStreamCapability | null;
7
+ /** The mount target. RFB (or the frame canvas) attaches here on connect. */
8
+ containerRef: RefObject<HTMLDivElement | null>;
9
+ /** Read-only by default (v1 ruling H). interactive only when cap.mode allows. */
10
+ interactive?: boolean | undefined;
11
+ scaleViewport?: boolean | undefined;
12
+ /** Custom RFB factory (tests / a WebRTC swap). Defaults to a lazy @novnc/novnc. */
13
+ rfbFactory?: DesktopRfbFactory | undefined;
14
+ /** Custom socket factory for the `relay-frames` transport (tests). Defaults to
15
+ * `new WebSocket(url)`. Mirrors `rfbFactory` for the frame renderer. */
16
+ webSocketFactory?: DesktopWebSocketFactory | undefined;
17
+ };
18
+ export type UseDesktopStreamResult = {
19
+ state: DesktopConnectionState;
20
+ error: Error | null;
21
+ /** Manual reconnect (e.g. after a securityfailure once a fresh URL arrives). */
22
+ reconnect: () => void;
23
+ };
24
+ /**
25
+ * Drive the noVNC RFB lifecycle from a `DesktopStreamCapability`, using the
26
+ * SDK's `desktop.ts` reducer + `desktopSocketUrl`. SSR-safe: the RFB import and
27
+ * the DOM attach happen inside `useEffect`, so a server render is a no-op and
28
+ * the component shows its placeholder until hydration.
29
+ *
30
+ * Read-only is enforced at three layers: `capability.mode` (server) →
31
+ * `interactive` prop → `RFB.viewOnly`. v1 always resolves to read-only. On a
32
+ * capability `url` change (a rotation), the old RFB disconnects and a fresh one
33
+ * connects to the new URL — a brief "desktop blink", acceptable on rollover.
34
+ *
35
+ * Transport dispatch: a Modal box negotiates `transport: "vnc-ws"` and drives the
36
+ * noVNC RFB below. A SELF-HOSTED machine negotiates `transport: "relay-frames"`
37
+ * (PNG-per-frame over the relay, view-only) — that path is delegated to
38
+ * `useRelayFrameStream`, which paints a `<canvas>`. Both hooks are ALWAYS called
39
+ * (rules of hooks); each is dormant for the other's transport, and we return the
40
+ * result of whichever owns the surface. The public interface is identical either
41
+ * way, so `DesktopViewer` is transport-agnostic.
42
+ */
43
+ export declare function useDesktopStream(options: UseDesktopStreamOptions): UseDesktopStreamResult;