@opengeni/react 0.36.1 → 0.40.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/README.md +92 -2
  2. package/dist/{chunk-J2RVJ6JX.js → chunk-4IJCL7YO.js} +13 -2
  3. package/dist/chunk-4IJCL7YO.js.map +1 -0
  4. package/dist/{chunk-7CJOAW3V.js → chunk-EB67J347.js} +1 -135
  5. package/dist/chunk-EB67J347.js.map +1 -0
  6. package/dist/chunk-EKZH6IDG.js +141 -0
  7. package/dist/chunk-EKZH6IDG.js.map +1 -0
  8. package/dist/{chunk-OKKMZDQF.js → chunk-JALF5FI3.js} +9 -7
  9. package/dist/{chunk-OKKMZDQF.js.map → chunk-JALF5FI3.js.map} +1 -1
  10. package/dist/{chunk-Z5FV355Z.js → chunk-KR2SK5GJ.js} +1382 -724
  11. package/dist/chunk-KR2SK5GJ.js.map +1 -0
  12. package/dist/{chunk-N4XEBE23.js → chunk-OMCFRWHL.js} +22 -13
  13. package/dist/{chunk-N4XEBE23.js.map → chunk-OMCFRWHL.js.map} +1 -1
  14. package/dist/{chunk-FT2TXNGZ.js → chunk-Q2NCKWTK.js} +183 -18
  15. package/dist/chunk-Q2NCKWTK.js.map +1 -0
  16. package/dist/{chunk-22RM4GMO.js → chunk-SJKT4TKW.js} +26 -2
  17. package/dist/chunk-SJKT4TKW.js.map +1 -0
  18. package/dist/{chunk-ALA3UGWB.js → chunk-SXIQK54Z.js} +8 -6
  19. package/dist/{chunk-ALA3UGWB.js.map → chunk-SXIQK54Z.js.map} +1 -1
  20. package/dist/chunk-WZT5G5OR.js +433 -0
  21. package/dist/chunk-WZT5G5OR.js.map +1 -0
  22. package/dist/client.d.ts +2 -0
  23. package/dist/components/chat-composer.d.ts +7 -1
  24. package/dist/components/human-input-form.d.ts +16 -6
  25. package/dist/components/human-input-surface.d.ts +19 -0
  26. package/dist/components/machine-input-display.d.ts +12 -0
  27. package/dist/components/message-timeline.d.ts +6 -1
  28. package/dist/components/model-policy-picker.d.ts +78 -0
  29. package/dist/components/session-chrome.d.ts +2 -1
  30. package/dist/components/tip-follow.d.ts +30 -0
  31. package/dist/composer.d.ts +2 -0
  32. package/dist/composer.js +22 -5
  33. package/dist/hooks/use-composer.d.ts +10 -1
  34. package/dist/index.d.ts +7 -1
  35. package/dist/index.js +2261 -2230
  36. package/dist/index.js.map +1 -1
  37. package/dist/machines.js +4 -3
  38. package/dist/model-policy.d.ts +12 -4
  39. package/dist/model-policy.js +5 -1
  40. package/dist/realtime/dropdown-menu.d.ts +16 -0
  41. package/dist/realtime/realtime-control.d.ts +126 -0
  42. package/dist/realtime.d.ts +11 -0
  43. package/dist/realtime.js +1023 -0
  44. package/dist/realtime.js.map +1 -0
  45. package/dist/session-context.d.ts +7 -1
  46. package/dist/session-ui.d.ts +2 -0
  47. package/dist/session-ui.js +6 -4
  48. package/dist/session.js +5 -4
  49. package/dist/timeline/compute-label.d.ts +2 -0
  50. package/dist/timeline/index.d.ts +1 -0
  51. package/dist/timeline/types.d.ts +5 -0
  52. package/package.json +7 -2
  53. package/src/client.ts +13 -0
  54. package/src/components/chat-composer.tsx +19 -5
  55. package/src/components/composer-transcription-control.tsx +2 -2
  56. package/src/components/composer.tsx +14 -5
  57. package/src/components/human-input-form.tsx +506 -186
  58. package/src/components/human-input-surface.tsx +80 -0
  59. package/src/components/machine-input-display.ts +83 -0
  60. package/src/components/message-timeline.tsx +348 -308
  61. package/src/components/model-policy-picker.tsx +587 -0
  62. package/src/components/sandbox-files.tsx +1 -1
  63. package/src/components/session-chrome.tsx +141 -15
  64. package/src/components/tip-follow.ts +127 -6
  65. package/src/composer.ts +13 -0
  66. package/src/hooks/use-composer.ts +229 -29
  67. package/src/index.ts +19 -0
  68. package/src/model-policy.ts +51 -7
  69. package/src/realtime/dropdown-menu.tsx +123 -0
  70. package/src/realtime/realtime-control.tsx +1178 -0
  71. package/src/realtime.ts +27 -0
  72. package/src/session-context.ts +16 -0
  73. package/src/session-ui.ts +2 -0
  74. package/src/timeline/compute-label.tsx +18 -0
  75. package/src/timeline/index.ts +3 -0
  76. package/src/timeline/projection.ts +21 -1
  77. package/src/timeline/tool-renderers.tsx +232 -43
  78. package/src/timeline/types.ts +5 -0
  79. package/styles/index.css +61 -0
  80. package/styles/tokens.css +2 -0
  81. package/dist/chunk-22RM4GMO.js.map +0 -1
  82. package/dist/chunk-7CJOAW3V.js.map +0 -1
  83. package/dist/chunk-FT2TXNGZ.js.map +0 -1
  84. package/dist/chunk-J2RVJ6JX.js.map +0 -1
  85. package/dist/chunk-Z5FV355Z.js.map +0 -1
@@ -0,0 +1,78 @@
1
+ import type { ClientModel, LatencyMode, ReasoningEffort } from "@opengeni/sdk";
2
+ import { type ReactNode } from "react";
3
+ import { type PickerBillingClass, type PickerModelRow } from "../model-policy";
4
+ type NavLevel = "providers" | "models" | "thinking";
5
+ type PickerNavState = {
6
+ level: NavLevel;
7
+ rail: PickerBillingClass | null;
8
+ modelId: string | null;
9
+ };
10
+ type NavUpdater = PickerNavState | ((previous: PickerNavState) => PickerNavState);
11
+ export type ModelPolicyPickerMessages = {
12
+ label: string;
13
+ loading: string;
14
+ noModels: string;
15
+ thinking: string;
16
+ fast: string;
17
+ fastRateHint: string;
18
+ codexOnly: string;
19
+ billingHints: Record<PickerBillingClass, string>;
20
+ };
21
+ export declare const defaultModelPolicyPickerMessages: ModelPolicyPickerMessages;
22
+ export type ModelPolicyPickerProps = {
23
+ /** Lightweight deployment models. Catalog rows take precedence when supplied. */
24
+ models?: ClientModel[] | undefined;
25
+ /** Catalog-backed rows with availability and billing-class truth. */
26
+ rows?: PickerModelRow[] | undefined;
27
+ model: string;
28
+ effort: ReasoningEffort;
29
+ latencyMode: LatencyMode;
30
+ disabled?: boolean | undefined;
31
+ loading?: boolean | undefined;
32
+ error?: string | null | undefined;
33
+ /** Non-Codex models stay visible but cannot be selected. */
34
+ codexOnly?: boolean | undefined;
35
+ /** Resets drill-down navigation when the session scope changes. */
36
+ sessionKey?: string | undefined;
37
+ /** Prefer bottom on new-chat surfaces and top for bottom-docked composers. */
38
+ menuSide?: "top" | "bottom" | undefined;
39
+ className?: string | undefined;
40
+ messages?: Partial<ModelPolicyPickerMessages> | undefined;
41
+ onModelChange: (modelId: string) => void;
42
+ onEffortChange: (effort: ReasoningEffort) => void;
43
+ onLatencyModeChange: (latencyMode: LatencyMode) => void;
44
+ };
45
+ export declare function BillingClassMark(props: {
46
+ billingClass: PickerBillingClass;
47
+ className?: string | undefined;
48
+ "aria-label"?: string | undefined;
49
+ }): import("react/jsx-runtime").JSX.Element;
50
+ export declare function PickerNavRow(props: {
51
+ label: string;
52
+ hint?: string | undefined;
53
+ icon?: ReactNode;
54
+ trailing?: ReactNode;
55
+ showChevron?: boolean | undefined;
56
+ disabled?: boolean | undefined;
57
+ title?: string | undefined;
58
+ active?: boolean | undefined;
59
+ testId?: string | undefined;
60
+ onClick: () => void;
61
+ }): import("react/jsx-runtime").JSX.Element;
62
+ export declare function PickerBackHeader(props: {
63
+ label: string;
64
+ icon?: ReactNode;
65
+ onBack: () => void;
66
+ trailing?: ReactNode;
67
+ }): import("react/jsx-runtime").JSX.Element;
68
+ export declare function PickerAnimatedPage(props: {
69
+ pageKey: string;
70
+ direction: 1 | -1;
71
+ children: ReactNode;
72
+ }): import("react/jsx-runtime").JSX.Element;
73
+ export declare function ModelPolicyPickerMenu(props: ModelPolicyPickerProps & {
74
+ nav?: PickerNavState | undefined;
75
+ onNavChange?: ((next: NavUpdater) => void) | undefined;
76
+ }): import("react/jsx-runtime").JSX.Element;
77
+ export declare function ModelPolicyPicker(props: ModelPolicyPickerProps): import("react/jsx-runtime").JSX.Element;
78
+ export {};
@@ -18,6 +18,7 @@
18
18
  * | `--og-session-chrome-chip-pad-x` / `--og-session-chrome-chip-gap` | Chip padding / rail gap |
19
19
  * | `--og-session-chrome-rail-pad` | Outer rail inset |
20
20
  * | `--og-session-chrome-panel-pad-x` / `-y` | Expanded panel padding |
21
+ * | `--og-session-chrome-panel-max-height` | Cap for expanded body (scrolls inside) |
21
22
  * | `--og-session-chrome-duration` / `--og-session-chrome-ease` | Expand + pill motion |
22
23
  * | `--og-session-chrome-crossfade-duration` | Segment content opacity crossfade |
23
24
  * | `--og-session-chrome-row-hover` | Inbox / queue row hover wash |
@@ -35,7 +36,7 @@ import { type ReactNode } from "react";
35
36
  import type { ComposerState } from "../hooks/use-composer";
36
37
  import type { UseGoalResult } from "../hooks/use-goal";
37
38
  import type { UseTurnQueueResult } from "../hooks/use-turn-queue";
38
- export type SessionChromeSignalId = "incoming" | "queue" | "goal" | "agents";
39
+ export type SessionChromeSignalId = "incoming" | "steering" | "queue" | "goal" | "agents";
39
40
  export type SessionChromeSignalTone = "neutral" | "accent" | "waiting" | "running";
40
41
  export type SessionChromeAgentsSignal = {
41
42
  count: number;
@@ -56,6 +56,13 @@ export declare const TIP_FOLLOW_VELOCITY_ARM_DEBT_PX = 72;
56
56
  export declare const TIP_FOLLOW_VELOCITY_DECAY_MS: number;
57
57
  /** Reader-up pixels above clamp budget that count as leaving the tip. */
58
58
  export declare const TIP_FOLLOW_READER_UP_EPS_PX = 2;
59
+ /**
60
+ * Browsers snap scrollTop writes to device pixels (whole px at dpr 1). A DOM
61
+ * position within this window of the camera's own fractional position is that
62
+ * quantization echo, not external motion — keep the fraction so sub-pixel
63
+ * settle steps accumulate. Anything larger (clamp, user, glue) re-bases.
64
+ */
65
+ export declare const TIP_FOLLOW_QUANTIZE_WINDOW_PX = 1;
59
66
  /** @internal */ export declare function setScrollEndSupportForTests(value: boolean | null): void;
60
67
  /** True when the engine exposes element `scrollend` (prefer over rAF leave). */
61
68
  export declare function supportsScrollEndEvent(): boolean;
@@ -74,11 +81,20 @@ export type TipFollowState = {
74
81
  hotUntil: number;
75
82
  lastTs: number;
76
83
  lastHeight: number;
84
+ /** Last observed scroller clientHeight — viewport shrink heats like tip growth. */
85
+ lastClientHeight: number;
77
86
  lastGrowthAt: number;
78
87
  /** EMA of recent height growth (px/s); nudges τ / ceiling under bursts. */
79
88
  growthVelocity: number;
80
89
  /** Camera velocity toward tip (px/s). Smoothed — never jumps with debt. */
81
90
  scrollVelocity: number;
91
+ /**
92
+ * Fractional camera position. The DOM quantizes scrollTop to device pixels,
93
+ * so settle steps under 1px would be discarded every frame if the camera
94
+ * re-based on the DOM — it then parks 20-50px short of the tip forever.
95
+ * `null` = no fraction in flight; adopt the DOM position.
96
+ */
97
+ cameraTop: number | null;
82
98
  };
83
99
  export type TipFollowStepInput = {
84
100
  scrollTop: number;
@@ -100,6 +116,14 @@ export declare function tipFollowCancel(state: TipFollowState): TipFollowState;
100
116
  * lines do not tear down the follow loop between appends.
101
117
  */
102
118
  export declare function tipFollowNoteGrowth(state: TipFollowState, height: number, now: number): TipFollowState;
119
+ /**
120
+ * Record scroller viewport height. A shrink (composer / SessionChrome /
121
+ * window) raises tip debt (`scrollHeight - clientHeight`) without growing
122
+ * content — the same debt content-growth would create. Heat the camera so
123
+ * catch-up does not fall into cold soft-settle (~42px/s) and leave the tip
124
+ * parked under the chrome.
125
+ */
126
+ export declare function tipFollowNoteViewportShrink(state: TipFollowState, clientHeight: number, now: number): TipFollowState;
103
127
  /**
104
128
  * Adaptive τ: small debt → calm; large debt / armed velocity → catch-up.
105
129
  * While hot, floor urgency so live streams are not stuck on calm τ.
@@ -136,6 +160,12 @@ export declare function tipFollowClearSoftRise(el: HTMLElement): void;
136
160
  * on screen: scrollTop -= Δh, clamped to the new max.
137
161
  */
138
162
  export declare function tipFollowCompensateShrink(scrollTop: number, previousHeight: number, nextHeight: number, clientHeight: number, epsPx?: number): number;
163
+ /**
164
+ * Viewport shrank (SessionChrome / composer / window). maxScroll rises by ≈Δc;
165
+ * keep the same tip distance: scrollTop += Δc. Without this, pinned follow only
166
+ * sees new tip debt and soft-settles under the chrome.
167
+ */
168
+ export declare function tipFollowCompensateViewportShrink(scrollTop: number, previousClientHeight: number, nextClientHeight: number, scrollHeight: number, epsPx?: number): number;
139
169
  /**
140
170
  * One camera step. Shell schedules the next rAF while `result.state.running`.
141
171
  */
@@ -4,6 +4,8 @@
4
4
  * `import * as Composer from "@opengeni/react/composer"`.
5
5
  */
6
6
  export { OPEN_WORKSTREAM_CONTROL_EVENT } from "./workstream-control-event";
7
+ export { BillingClassMark, ModelPolicyPicker, ModelPolicyPickerMenu, PickerAnimatedPage, PickerBackHeader, PickerNavRow, defaultModelPolicyPickerMessages, } from "./components/model-policy-picker";
8
+ export type { ModelPolicyPickerMessages, ModelPolicyPickerProps, } from "./components/model-policy-picker";
7
9
  export { Actions, AttachButton, Attachments, CommandPalette, Confirmation, Controls, Footer, Frame, Help, Hint, Input, ModelPicker, PauseButton, PausedState, RestoredResources, Root, SendButton, Status, Surface, defaultChatComposerMessages, useChatComposer, useChatComposerController, } from "./components/composer";
8
10
  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";
9
11
  export { ComposerTranscriptionControl } from "./components/composer-transcription-control";
package/dist/composer.js CHANGED
@@ -24,17 +24,28 @@ import {
24
24
  useChatComposer,
25
25
  useChatComposerController,
26
26
  useVoiceInput
27
- } from "./chunk-N4XEBE23.js";
28
- import "./chunk-FT2TXNGZ.js";
29
- import "./chunk-7CJOAW3V.js";
30
- import "./chunk-22RM4GMO.js";
27
+ } from "./chunk-OMCFRWHL.js";
28
+ import "./chunk-Q2NCKWTK.js";
29
+ import "./chunk-EB67J347.js";
30
+ import {
31
+ BillingClassMark,
32
+ ModelPolicyPicker,
33
+ ModelPolicyPickerMenu,
34
+ PickerAnimatedPage,
35
+ PickerBackHeader,
36
+ PickerNavRow,
37
+ defaultModelPolicyPickerMessages
38
+ } from "./chunk-WZT5G5OR.js";
39
+ import "./chunk-EKZH6IDG.js";
40
+ import "./chunk-SJKT4TKW.js";
31
41
  import "./chunk-ATSTR5P3.js";
32
- import "./chunk-TK7G6XLT.js";
33
42
  import "./chunk-LAKLF4PA.js";
43
+ import "./chunk-TK7G6XLT.js";
34
44
  export {
35
45
  Actions,
36
46
  AttachButton,
37
47
  Attachments,
48
+ BillingClassMark,
38
49
  CommandPalette,
39
50
  ComposerTranscriptionControl,
40
51
  Confirmation,
@@ -45,15 +56,21 @@ export {
45
56
  Hint,
46
57
  Input,
47
58
  ModelPicker,
59
+ ModelPolicyPicker,
60
+ ModelPolicyPickerMenu,
48
61
  OPEN_WORKSTREAM_CONTROL_EVENT,
49
62
  PauseButton,
50
63
  PausedState,
64
+ PickerAnimatedPage,
65
+ PickerBackHeader,
66
+ PickerNavRow,
51
67
  RestoredResources,
52
68
  Root,
53
69
  SendButton,
54
70
  Status,
55
71
  Surface,
56
72
  defaultChatComposerMessages,
73
+ defaultModelPolicyPickerMessages,
57
74
  useChatComposer,
58
75
  useChatComposerController,
59
76
  useVoiceInput
@@ -1,4 +1,4 @@
1
- import type { ComposerDraft, EffectiveControlResumeOption, EffectiveSessionControl, ResourceRef, SendMessageInput, SessionEvent } from "@opengeni/sdk";
1
+ import { type ComposerDraft, type EffectiveControlResumeOption, type EffectiveSessionControl, type ResourceRef, type SendMessageInput, type SessionEvent } from "@opengeni/sdk";
2
2
  import { type EmbeddedSessionClientOverride } from "../session-context";
3
3
  import { type SessionEventFeedOptions } from "./internal";
4
4
  export type ComposerSendExtras = Omit<SendMessageInput, "text" | "clientEventId">;
@@ -33,6 +33,8 @@ export type ComposerState = {
33
33
  send: (text?: string) => Promise<boolean>;
34
34
  /** Supersede current direction with the draft. */
35
35
  steer: (text?: string) => Promise<boolean>;
36
+ /** Optimistic-to-durable projection for a Steer that has not started yet. */
37
+ steering?: ComposerSteeringState | null | undefined;
36
38
  sending: boolean;
37
39
  canSend: boolean;
38
40
  /** Pause the session without deleting its prompt queue. */
@@ -57,6 +59,13 @@ export type ComposerState = {
57
59
  error: Error | null;
58
60
  clearError: () => void;
59
61
  };
62
+ export type ComposerSteeringState = {
63
+ phase: "submitting" | "accepted";
64
+ text: string;
65
+ clientEventId: string | null;
66
+ triggerEventId: string | null;
67
+ turnId: string | null;
68
+ };
60
69
  /**
61
70
  * Draft + send + Pause/Resume state for the chat composer — the only
62
71
  * human-to-agent input surface. The draft survives a failed send (nothing is
package/dist/index.d.ts CHANGED
@@ -80,6 +80,8 @@ export { isHumanInputEvent, useHumanInputRequests } from "./hooks/use-human-inpu
80
80
  export type { UseHumanInputRequestsOptions, UseHumanInputRequestsResult, } from "./hooks/use-human-input";
81
81
  export { HumanInputForm, answersFromDrafts, defaultHumanInputFormMessages, } from "./components/human-input-form";
82
82
  export type { HumanInputAnswerDraft, HumanInputFormMessages, HumanInputFormProps, } from "./components/human-input-form";
83
+ export { HumanInputSurface } from "./components/human-input-surface";
84
+ export type { HumanInputSurfaceProps } from "./components/human-input-surface";
83
85
  export { buildTimeline, creditExhaustedFromEvents, extractSessionRef, groupTimeline, sessionStatusFromEvents, toolDisplayName, } from "./timeline";
84
86
  export type { ActivityItem, AgentMessageItem, AuthNeededItem, ContextCompactionItem, GoalItem, MachineInputBatchItem, MachineInputMember, NoticeItem, ReasoningItem, SandboxItem, SessionStatusItem, TimelineGroup, TimelineItem, TurnEndItem, ToolCallItem, UserMessageItem, WorkerItem, } from "./timeline";
85
87
  export { createDefaultToolRegistry, createToolRegistry, defaultToolRegistry, rawTypeOf, } from "./timeline";
@@ -103,7 +105,9 @@ export { defaultChatComposerMessages } from "./components/composer";
103
105
  export type { ChatComposerMessages } from "./components/composer";
104
106
  export { ModelPicker } from "./components/model-picker";
105
107
  export type { ModelPickerProps } from "./components/model-picker";
106
- export { advancedSourceSummary, availabilityReasonLabel, billingClassForModel, billingClassLabel, coerceReasoningEffortForModel, defaultEffortForModel, effortOptionsForModel, findPickerRow, groupPickerRowsByBillingClass, labelLatencyMode, payerSummaryForModel, projectPickerRows, runnableLatencyModesForModel, sortPickerRows, } from "./model-policy";
108
+ export { BillingClassMark, ModelPolicyPicker, ModelPolicyPickerMenu, PickerAnimatedPage, PickerBackHeader, PickerNavRow, defaultModelPolicyPickerMessages, } from "./components/model-policy-picker";
109
+ export type { ModelPolicyPickerMessages, ModelPolicyPickerProps, } from "./components/model-policy-picker";
110
+ export { advancedSourceSummary, availabilityReasonLabel, billingClassForModel, billingClassLabel, coerceReasoningEffortForModel, defaultEffortForModel, effortOptionsForModel, findPickerRow, groupPickerRowsByBillingClass, labelLatencyMode, labelReasoningEffort, payerSummaryForModel, projectClientModelRows, projectPickerRows, runnableLatencyModesForModel, sortPickerRows, } from "./model-policy";
107
111
  export type { LatencyModeId, PickerBillingClass, PickerModelRow } from "./model-policy";
108
112
  export { MessageTimeline, TimelineRow } from "./components/message-timeline";
109
113
  export type { MessageTimelineProps } from "./components/message-timeline";
@@ -119,6 +123,8 @@ export { SandboxTerminal } from "./components/sandbox-terminal";
119
123
  export type { SandboxTerminalProps, XtermTheme } from "./components/sandbox-terminal";
120
124
  export { FileBrowser } from "./components/file-browser";
121
125
  export type { FileBrowserProps } from "./components/file-browser";
126
+ export { WorkbenchChanges } from "./components/workbench-changes";
127
+ export type { WorkbenchChangesProps } from "./components/workbench-changes";
122
128
  export { DiffView } from "./components/diff-view";
123
129
  export type { DiffViewProps, DiffTheme } from "./components/diff-view";
124
130
  export { PierreDiff } from "./components/pierre-diff";