@opengeni/react 0.36.0 → 0.37.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 (45) hide show
  1. package/README.md +4 -0
  2. package/dist/{chunk-J2RVJ6JX.js → chunk-4IJCL7YO.js} +13 -2
  3. package/dist/chunk-4IJCL7YO.js.map +1 -0
  4. package/dist/{chunk-OKKMZDQF.js → chunk-FSPDND3P.js} +2 -2
  5. package/dist/{chunk-FT2TXNGZ.js → chunk-HJ4OQVGW.js} +174 -14
  6. package/dist/chunk-HJ4OQVGW.js.map +1 -0
  7. package/dist/{chunk-PVW56EVR.js → chunk-IP22SLO6.js} +447 -13
  8. package/dist/chunk-IP22SLO6.js.map +1 -0
  9. package/dist/{chunk-U255M5EZ.js → chunk-SJKT4TKW.js} +39 -6
  10. package/dist/chunk-SJKT4TKW.js.map +1 -0
  11. package/dist/{chunk-XT7JF2EH.js → chunk-UCZPNXV3.js} +96 -17
  12. package/dist/chunk-UCZPNXV3.js.map +1 -0
  13. package/dist/components/chat-composer.d.ts +3 -1
  14. package/dist/components/model-policy-picker.d.ts +78 -0
  15. package/dist/components/session-chrome.d.ts +1 -1
  16. package/dist/composer.d.ts +2 -0
  17. package/dist/composer.js +17 -3
  18. package/dist/hooks/use-composer.d.ts +9 -0
  19. package/dist/index.d.ts +3 -1
  20. package/dist/index.js +30 -9
  21. package/dist/index.js.map +1 -1
  22. package/dist/model-policy.d.ts +12 -4
  23. package/dist/model-policy.js +5 -1
  24. package/dist/session-ui.js +2 -2
  25. package/dist/session.js +3 -3
  26. package/dist/timeline/types.d.ts +5 -0
  27. package/package.json +2 -2
  28. package/src/components/chat-composer.tsx +8 -3
  29. package/src/components/composer.tsx +17 -1
  30. package/src/components/copy-button.tsx +13 -6
  31. package/src/components/model-picker.tsx +2 -2
  32. package/src/components/model-policy-picker.tsx +582 -0
  33. package/src/components/session-chrome.tsx +138 -14
  34. package/src/composer.ts +13 -0
  35. package/src/hooks/use-composer.ts +213 -16
  36. package/src/index.ts +15 -0
  37. package/src/model-policy.ts +69 -14
  38. package/src/timeline/projection.ts +21 -1
  39. package/src/timeline/types.ts +5 -0
  40. package/dist/chunk-FT2TXNGZ.js.map +0 -1
  41. package/dist/chunk-J2RVJ6JX.js.map +0 -1
  42. package/dist/chunk-PVW56EVR.js.map +0 -1
  43. package/dist/chunk-U255M5EZ.js.map +0 -1
  44. package/dist/chunk-XT7JF2EH.js.map +0 -1
  45. /package/dist/{chunk-OKKMZDQF.js.map → chunk-FSPDND3P.js.map} +0 -0
@@ -25,6 +25,8 @@ export type ChatComposerProps = {
25
25
  hint?: string | undefined;
26
26
  /** App controls in the footer row, replacing the hint. */
27
27
  controlsStart?: ReactNode | undefined;
28
+ /** App actions beside Pause/Send, ordered before the built-in actions. */
29
+ actionsStart?: ReactNode | undefined;
28
30
  /** Provider-neutral speech capability. Provider configuration stays in workspace settings. */
29
31
  transcription?: ComposerTranscriptionControlProps | undefined;
30
32
  /** Content rendered above the textarea, inside the field chrome. */
@@ -49,4 +51,4 @@ export type ChatComposerProps = {
49
51
  * the public controller and compound primitives exported by the composer
50
52
  * subpath, so custom and default layouts share one behavioral implementation.
51
53
  */
52
- export declare function ChatComposer({ composer, effectiveControl, queuedAheadCount, canControlWorkspace, controlLinks, placeholder, disabled, autoFocus, hint, controlsStart, transcription, header, onPaste, attachments, models, selectedModel, onSelectModel, className, commands, commandContext, onClearView, messages, }: ChatComposerProps): import("react/jsx-runtime").JSX.Element;
54
+ export declare function ChatComposer({ composer, effectiveControl, queuedAheadCount, canControlWorkspace, controlLinks, placeholder, disabled, autoFocus, hint, controlsStart, actionsStart, transcription, header, onPaste, attachments, models, selectedModel, onSelectModel, className, commands, commandContext, onClearView, messages, }: ChatComposerProps): import("react/jsx-runtime").JSX.Element;
@@ -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 {};
@@ -35,7 +35,7 @@ import { type ReactNode } from "react";
35
35
  import type { ComposerState } from "../hooks/use-composer";
36
36
  import type { UseGoalResult } from "../hooks/use-goal";
37
37
  import type { UseTurnQueueResult } from "../hooks/use-turn-queue";
38
- export type SessionChromeSignalId = "incoming" | "queue" | "goal" | "agents";
38
+ export type SessionChromeSignalId = "incoming" | "steering" | "queue" | "goal" | "agents";
39
39
  export type SessionChromeSignalTone = "neutral" | "accent" | "waiting" | "running";
40
40
  export type SessionChromeAgentsSignal = {
41
41
  count: number;
@@ -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
@@ -2,6 +2,7 @@ import {
2
2
  Actions,
3
3
  AttachButton,
4
4
  Attachments,
5
+ BillingClassMark,
5
6
  CommandPalette2 as CommandPalette,
6
7
  ComposerTranscriptionControl,
7
8
  Confirmation,
@@ -12,22 +13,28 @@ import {
12
13
  Hint,
13
14
  Input,
14
15
  ModelPicker2 as ModelPicker,
16
+ ModelPolicyPicker,
17
+ ModelPolicyPickerMenu,
15
18
  OPEN_WORKSTREAM_CONTROL_EVENT,
16
19
  PauseButton,
17
20
  PausedState,
21
+ PickerAnimatedPage,
22
+ PickerBackHeader,
23
+ PickerNavRow,
18
24
  RestoredResources,
19
25
  Root,
20
26
  SendButton,
21
27
  Status,
22
28
  Surface,
23
29
  defaultChatComposerMessages,
30
+ defaultModelPolicyPickerMessages,
24
31
  useChatComposer,
25
32
  useChatComposerController,
26
33
  useVoiceInput
27
- } from "./chunk-PVW56EVR.js";
28
- import "./chunk-FT2TXNGZ.js";
34
+ } from "./chunk-IP22SLO6.js";
35
+ import "./chunk-HJ4OQVGW.js";
29
36
  import "./chunk-7CJOAW3V.js";
30
- import "./chunk-U255M5EZ.js";
37
+ import "./chunk-SJKT4TKW.js";
31
38
  import "./chunk-ATSTR5P3.js";
32
39
  import "./chunk-TK7G6XLT.js";
33
40
  import "./chunk-LAKLF4PA.js";
@@ -35,6 +42,7 @@ export {
35
42
  Actions,
36
43
  AttachButton,
37
44
  Attachments,
45
+ BillingClassMark,
38
46
  CommandPalette,
39
47
  ComposerTranscriptionControl,
40
48
  Confirmation,
@@ -45,15 +53,21 @@ export {
45
53
  Hint,
46
54
  Input,
47
55
  ModelPicker,
56
+ ModelPolicyPicker,
57
+ ModelPolicyPickerMenu,
48
58
  OPEN_WORKSTREAM_CONTROL_EVENT,
49
59
  PauseButton,
50
60
  PausedState,
61
+ PickerAnimatedPage,
62
+ PickerBackHeader,
63
+ PickerNavRow,
51
64
  RestoredResources,
52
65
  Root,
53
66
  SendButton,
54
67
  Status,
55
68
  Surface,
56
69
  defaultChatComposerMessages,
70
+ defaultModelPolicyPickerMessages,
57
71
  useChatComposer,
58
72
  useChatComposerController,
59
73
  useVoiceInput
@@ -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
@@ -103,7 +103,9 @@ export { defaultChatComposerMessages } from "./components/composer";
103
103
  export type { ChatComposerMessages } from "./components/composer";
104
104
  export { ModelPicker } from "./components/model-picker";
105
105
  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";
106
+ export { BillingClassMark, ModelPolicyPicker, ModelPolicyPickerMenu, PickerAnimatedPage, PickerBackHeader, PickerNavRow, defaultModelPolicyPickerMessages, } from "./components/model-policy-picker";
107
+ export type { ModelPolicyPickerMessages, ModelPolicyPickerProps, } from "./components/model-policy-picker";
108
+ export { advancedSourceSummary, availabilityReasonLabel, billingClassForModel, billingClassLabel, coerceReasoningEffortForModel, defaultEffortForModel, effortOptionsForModel, findPickerRow, groupPickerRowsByBillingClass, labelLatencyMode, labelReasoningEffort, payerSummaryForModel, projectClientModelRows, projectPickerRows, runnableLatencyModesForModel, sortPickerRows, } from "./model-policy";
107
109
  export type { LatencyModeId, PickerBillingClass, PickerModelRow } from "./model-policy";
108
110
  export { MessageTimeline, TimelineRow } from "./components/message-timeline";
109
111
  export type { MessageTimelineProps } from "./components/message-timeline";
package/dist/index.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  useSessionLineage,
53
53
  useSessionMcpApprovalPolicy,
54
54
  useTurnQueue
55
- } from "./chunk-OKKMZDQF.js";
55
+ } from "./chunk-FSPDND3P.js";
56
56
  import {
57
57
  ActivityDisclosure,
58
58
  ActivityRail,
@@ -106,7 +106,7 @@ import {
106
106
  useLightboxOptional,
107
107
  useThemeType,
108
108
  v4aToGitFileDiff
109
- } from "./chunk-XT7JF2EH.js";
109
+ } from "./chunk-UCZPNXV3.js";
110
110
  import {
111
111
  buildTimeline,
112
112
  creditExhaustedFromEvents,
@@ -114,11 +114,12 @@ import {
114
114
  groupTimeline,
115
115
  sessionStatusFromEvents,
116
116
  toolDisplayName
117
- } from "./chunk-J2RVJ6JX.js";
117
+ } from "./chunk-4IJCL7YO.js";
118
118
  import {
119
119
  Actions,
120
120
  AttachButton,
121
121
  Attachments,
122
+ BillingClassMark,
122
123
  CommandPalette,
123
124
  CommandPalette2,
124
125
  ComposerTranscriptionControl,
@@ -132,9 +133,14 @@ import {
132
133
  Input,
133
134
  ModelPicker,
134
135
  ModelPicker2,
136
+ ModelPolicyPicker,
137
+ ModelPolicyPickerMenu,
135
138
  OPEN_WORKSTREAM_CONTROL_EVENT,
136
139
  PauseButton,
137
140
  PausedState,
141
+ PickerAnimatedPage,
142
+ PickerBackHeader,
143
+ PickerNavRow,
138
144
  RestoredResources,
139
145
  Root,
140
146
  SendButton,
@@ -144,6 +150,7 @@ import {
144
150
  argHint,
145
151
  defaultChatComposerMessages,
146
152
  defaultCommands,
153
+ defaultModelPolicyPickerMessages,
147
154
  filterCommands,
148
155
  firstMissingRequiredArg,
149
156
  hasPermission,
@@ -154,14 +161,14 @@ import {
154
161
  useSlashCommands,
155
162
  useTranscription,
156
163
  useVoiceInput
157
- } from "./chunk-PVW56EVR.js";
164
+ } from "./chunk-IP22SLO6.js";
158
165
  import {
159
166
  FILE_ONLY_MESSAGE_TEXT,
160
167
  composeSendInput,
161
168
  shouldSteerOnKey,
162
169
  shouldSubmitOnKey,
163
170
  useComposer
164
- } from "./chunk-FT2TXNGZ.js";
171
+ } from "./chunk-HJ4OQVGW.js";
165
172
  import {
166
173
  useMutationRunner,
167
174
  useOpenGeni,
@@ -180,11 +187,13 @@ import {
180
187
  findPickerRow,
181
188
  groupPickerRowsByBillingClass,
182
189
  labelLatencyMode,
190
+ labelReasoningEffort,
183
191
  payerSummaryForModel,
192
+ projectClientModelRows,
184
193
  projectPickerRows,
185
194
  runnableLatencyModesForModel,
186
195
  sortPickerRows
187
- } from "./chunk-U255M5EZ.js";
196
+ } from "./chunk-SJKT4TKW.js";
188
197
  import {
189
198
  Tooltip,
190
199
  TooltipContent,
@@ -3325,6 +3334,7 @@ function ChatComposer({
3325
3334
  autoFocus,
3326
3335
  hint,
3327
3336
  controlsStart,
3337
+ actionsStart,
3328
3338
  transcription,
3329
3339
  header,
3330
3340
  onPaste,
@@ -3355,6 +3365,7 @@ function ChatComposer({
3355
3365
  messages
3356
3366
  });
3357
3367
  const hasControls = Boolean(attachments || models || controlsStart || transcription);
3368
+ const stackActions = hasControls && Boolean(actionsStart);
3358
3369
  return /* @__PURE__ */ jsxs2(Root, { controller, className, children: [
3359
3370
  /* @__PURE__ */ jsxs2(Frame, { children: [
3360
3371
  /* @__PURE__ */ jsx2(CommandPalette2, {}),
@@ -3364,14 +3375,15 @@ function ChatComposer({
3364
3375
  /* @__PURE__ */ jsx2(Attachments, {}),
3365
3376
  header,
3366
3377
  /* @__PURE__ */ jsx2(Input, { placeholder, autoFocus }),
3367
- controller.confirmState ? /* @__PURE__ */ jsx2(Confirmation, {}) : /* @__PURE__ */ jsxs2(Footer, { children: [
3368
- hasControls ? /* @__PURE__ */ jsxs2(Controls, { children: [
3378
+ controller.confirmState ? /* @__PURE__ */ jsx2(Confirmation, {}) : /* @__PURE__ */ jsxs2(Footer, { className: stackActions ? "flex-wrap" : void 0, children: [
3379
+ hasControls ? /* @__PURE__ */ jsxs2(Controls, { className: stackActions ? "w-full sm:w-auto" : void 0, children: [
3369
3380
  /* @__PURE__ */ jsx2(AttachButton, {}),
3370
3381
  transcription ? /* @__PURE__ */ jsx2(ComposerTranscriptionControl, { ...transcription }) : null,
3371
3382
  models ? /* @__PURE__ */ jsx2(ModelPicker2, { models, value: selectedModel, onChange: onSelectModel }) : null,
3372
3383
  controlsStart
3373
3384
  ] }) : /* @__PURE__ */ jsx2(Hint, { children: hint }),
3374
- /* @__PURE__ */ jsxs2(Actions, { children: [
3385
+ /* @__PURE__ */ jsxs2(Actions, { className: stackActions ? "w-full justify-end sm:w-auto" : void 0, children: [
3386
+ actionsStart,
3375
3387
  /* @__PURE__ */ jsx2(PauseButton, {}),
3376
3388
  /* @__PURE__ */ jsx2(SendButton, {})
3377
3389
  ] })
@@ -8376,6 +8388,7 @@ export {
8376
8388
  ActivityRail,
8377
8389
  ApprovalSurface,
8378
8390
  BUILT_IN_TURN_SUMMARY_FACET_IDS,
8391
+ BillingClassMark,
8379
8392
  BodyNote,
8380
8393
  COMPOSER_PAYMENT_REQUIRED_MESSAGE,
8381
8394
  CONNECTION_STATUS_META,
@@ -8419,9 +8432,14 @@ export {
8419
8432
  MetricHistoryChart,
8420
8433
  MetricSparkline,
8421
8434
  ModelPicker,
8435
+ ModelPolicyPicker,
8436
+ ModelPolicyPickerMenu,
8422
8437
  OPEN_WORKSTREAM_CONTROL_EVENT,
8423
8438
  OpenGeniProvider,
8424
8439
  PayloadBlock,
8440
+ PickerAnimatedPage,
8441
+ PickerBackHeader,
8442
+ PickerNavRow,
8425
8443
  PierreDiff,
8426
8444
  PierreFile,
8427
8445
  QueueSurface,
@@ -8480,6 +8498,7 @@ export {
8480
8498
  defaultCommands,
8481
8499
  defaultEffortForModel,
8482
8500
  defaultHumanInputFormMessages,
8501
+ defaultModelPolicyPickerMessages,
8483
8502
  defaultToolRegistry,
8484
8503
  deriveHealth,
8485
8504
  deriveMachineChip,
@@ -8513,6 +8532,7 @@ export {
8513
8532
  isTitleEvent,
8514
8533
  isTurnQueueEvent,
8515
8534
  labelLatencyMode,
8535
+ labelReasoningEffort,
8516
8536
  languageForPath,
8517
8537
  looksBinary,
8518
8538
  matchCommand,
@@ -8521,6 +8541,7 @@ export {
8521
8541
  parseToolArgs,
8522
8542
  payerSummaryForModel,
8523
8543
  pointsFor,
8544
+ projectClientModelRows,
8524
8545
  projectPendingApprovals,
8525
8546
  projectPendingHumanInputRequests,
8526
8547
  projectPickerRows,