@opengeni/react 2.3.0-canary.0 → 2.5.0-canary.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 (46) hide show
  1. package/README.md +9 -2
  2. package/dist/{chunk-LS4POUTY.js → chunk-6H6S5V4Z.js} +250 -120
  3. package/dist/chunk-6H6S5V4Z.js.map +1 -0
  4. package/dist/{chunk-SE4W4WQ3.js → chunk-ATQJEWCA.js} +154 -114
  5. package/dist/chunk-ATQJEWCA.js.map +1 -0
  6. package/dist/{chunk-LTCHJ4MS.js → chunk-KSDXER4X.js} +21 -7
  7. package/dist/chunk-KSDXER4X.js.map +1 -0
  8. package/dist/{chunk-RSXJN73N.js → chunk-MXJGO7LE.js} +34 -1
  9. package/dist/chunk-MXJGO7LE.js.map +1 -0
  10. package/dist/{chunk-JOAVA2TW.js → chunk-T7VAYG2I.js} +8 -7
  11. package/dist/{chunk-JOAVA2TW.js.map → chunk-T7VAYG2I.js.map} +1 -1
  12. package/dist/components/composer.d.ts +1 -1
  13. package/dist/components/fleet-tile.d.ts +1 -1
  14. package/dist/components/message-timeline.d.ts +7 -2
  15. package/dist/composer.js +2 -2
  16. package/dist/hooks/use-session-events.d.ts +2 -1
  17. package/dist/hooks/use-session-lineage.d.ts +4 -0
  18. package/dist/hooks/use-session.d.ts +6 -0
  19. package/dist/hooks/use-workspace-sessions.d.ts +6 -0
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.js +41 -19
  22. package/dist/index.js.map +1 -1
  23. package/dist/older-history.d.ts +29 -0
  24. package/dist/session-ui.d.ts +2 -0
  25. package/dist/session-ui.js +5 -2
  26. package/dist/session.d.ts +2 -0
  27. package/dist/session.js +5 -3
  28. package/package.json +2 -2
  29. package/src/components/composer.tsx +19 -5
  30. package/src/components/fleet-tile.tsx +7 -5
  31. package/src/components/message-timeline.tsx +399 -160
  32. package/src/components/tip-follow.ts +18 -7
  33. package/src/hooks/use-composer.ts +20 -6
  34. package/src/hooks/use-session-events.ts +84 -76
  35. package/src/hooks/use-session-lineage.ts +26 -8
  36. package/src/hooks/use-session.ts +35 -8
  37. package/src/hooks/use-workspace-sessions.ts +38 -13
  38. package/src/index.ts +2 -0
  39. package/src/older-history.ts +69 -0
  40. package/src/session-ui.ts +2 -0
  41. package/src/session.ts +2 -0
  42. package/src/timeline/activity-rail.tsx +1 -0
  43. package/dist/chunk-LS4POUTY.js.map +0 -1
  44. package/dist/chunk-LTCHJ4MS.js.map +0 -1
  45. package/dist/chunk-RSXJN73N.js.map +0 -1
  46. package/dist/chunk-SE4W4WQ3.js.map +0 -1
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Await-compatible older-history result with a causal commit receipt.
3
+ *
4
+ * `committed` flips synchronously before the accepted older window is exposed
5
+ * to React. Returning this exact object preserves the receipt directly;
6
+ * synchronous wrappers that discard it remain supported through receipt
7
+ * capture, while replacing it asynchronously with a plain promise does not.
8
+ */
9
+ export type OlderHistoryLoadReceipt = Promise<boolean> & {
10
+ readonly committed: boolean;
11
+ };
12
+ /**
13
+ * Source-compatible public callback accepted by MessageTimeline.
14
+ *
15
+ * The callback historically returned `void`, which permits consumers to
16
+ * return any synchronous value or promise. Receipt-aware loaders opt into the
17
+ * stronger runtime contract by returning (or synchronously creating through a
18
+ * wrapper) an {@link OlderHistoryLoadReceipt}.
19
+ */
20
+ export type OlderHistoryLoader = () => unknown;
21
+ type OlderHistoryReceiptCapture = (receipt: OlderHistoryLoadReceipt) => void;
22
+ /** Bind a receipt before a synchronous forwarding stack can publish state. */
23
+ export declare function invokeOlderHistoryLoaderWithReceiptCapture(load: OlderHistoryLoader, capture: OlderHistoryReceiptCapture): unknown;
24
+ /**
25
+ * Build an await-compatible older-history receipt for custom timeline hosts.
26
+ * Call `markCommitted` immediately before publishing an accepted older window.
27
+ */
28
+ export declare function createOlderHistoryLoadReceipt(load: (markCommitted: () => void) => boolean | Promise<boolean>): OlderHistoryLoadReceipt;
29
+ export {};
@@ -4,6 +4,8 @@ export { HumanInputSurface } from "./components/human-input-surface.js";
4
4
  export type { HumanInputSurfaceProps } from "./components/human-input-surface.js";
5
5
  export { MessageTimeline, TimelineRow } from "./components/message-timeline.js";
6
6
  export type { MessageTimelineProps } from "./components/message-timeline.js";
7
+ export { createOlderHistoryLoadReceipt } from "./older-history.js";
8
+ export type { OlderHistoryLoader, OlderHistoryLoadReceipt } from "./older-history.js";
7
9
  export { UserMessageBody, userMessageLikelyNeedsDisclosure } from "./components/user-message-body.js";
8
10
  export type { UserMessageBodyProps } from "./components/user-message-body.js";
9
11
  export { BUILT_IN_TURN_SUMMARY_FACET_IDS } from "./timeline/turn-summary.js";
@@ -11,8 +11,10 @@ import {
11
11
  sessionChromeGoalPillLabel,
12
12
  sessionChromeGoalPillState,
13
13
  userMessageLikelyNeedsDisclosure
14
- } from "./chunk-LS4POUTY.js";
15
- import "./chunk-RSXJN73N.js";
14
+ } from "./chunk-6H6S5V4Z.js";
15
+ import {
16
+ createOlderHistoryLoadReceipt
17
+ } from "./chunk-MXJGO7LE.js";
16
18
  import "./chunk-WSK7G5LE.js";
17
19
  import "./chunk-FK6VG4LL.js";
18
20
  import "./chunk-VZTQ73XT.js";
@@ -28,6 +30,7 @@ export {
28
30
  SessionChrome,
29
31
  TimelineRow,
30
32
  UserMessageBody,
33
+ createOlderHistoryLoadReceipt,
31
34
  sessionChromeGoalPillExplanation,
32
35
  sessionChromeGoalPillLabel,
33
36
  sessionChromeGoalPillState,
package/dist/session.d.ts CHANGED
@@ -4,6 +4,8 @@ export { useSession, isTitleEvent } from "./hooks/use-session.js";
4
4
  export type { UseSessionOptions, UseSessionResult } from "./hooks/use-session.js";
5
5
  export { useSessionEvents } from "./hooks/use-session-events.js";
6
6
  export type { SessionEventsConnectionState, UseSessionEventsOptions, UseSessionEventsResult, } from "./hooks/use-session-events.js";
7
+ export { createOlderHistoryLoadReceipt } from "./older-history.js";
8
+ export type { OlderHistoryLoader, OlderHistoryLoadReceipt } from "./older-history.js";
7
9
  export { useComposer, composeSendInput, shouldSteerOnKey, shouldSubmitOnKey, FILE_ONLY_MESSAGE_TEXT, } from "./hooks/use-composer.js";
8
10
  export type { ComposerControllerState, ComposerPolicy, ComposerSendExtras, ComposerState, UseComposerOptions, } from "./hooks/use-composer.js";
9
11
  export { useFileAttachments } from "./hooks/use-file-attachments.js";
package/dist/session.js CHANGED
@@ -18,22 +18,23 @@ import {
18
18
  useSessionLineage,
19
19
  useSessionMcpApprovalPolicy,
20
20
  useTurnQueue
21
- } from "./chunk-SE4W4WQ3.js";
21
+ } from "./chunk-ATQJEWCA.js";
22
22
  import {
23
23
  FILE_ONLY_MESSAGE_TEXT,
24
24
  composeSendInput,
25
25
  shouldSteerOnKey,
26
26
  shouldSubmitOnKey,
27
27
  useComposer
28
- } from "./chunk-JOAVA2TW.js";
28
+ } from "./chunk-T7VAYG2I.js";
29
29
  import {
30
30
  buildTimeline,
31
+ createOlderHistoryLoadReceipt,
31
32
  creditExhaustedFromEvents,
32
33
  extractSessionRef,
33
34
  groupTimeline,
34
35
  sessionStatusFromEvents,
35
36
  toolDisplayName
36
- } from "./chunk-RSXJN73N.js";
37
+ } from "./chunk-MXJGO7LE.js";
37
38
  import "./chunk-KZ73RL76.js";
38
39
  import "./chunk-NEXLLTP4.js";
39
40
  import "./chunk-LAKLF4PA.js";
@@ -42,6 +43,7 @@ export {
42
43
  approvalsFromRequiresAction,
43
44
  buildTimeline,
44
45
  composeSendInput,
46
+ createOlderHistoryLoadReceipt,
45
47
  creditExhaustedFromEvents,
46
48
  extractSessionRef,
47
49
  groupTimeline,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/react",
3
- "version": "2.3.0-canary.0",
3
+ "version": "2.5.0-canary.1",
4
4
  "description": "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views — token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -116,7 +116,7 @@
116
116
  "@dnd-kit/utilities": "3.2.2",
117
117
  "@fontsource-variable/noto-sans-arabic": "5.2.10",
118
118
  "@fontsource-variable/noto-sans-jp": "5.2.10",
119
- "@opengeni/sdk": "^2.3.0-canary.0",
119
+ "@opengeni/sdk": "^2.5.0-canary.1",
120
120
  "clsx": "^2.1.1",
121
121
  "lucide-react": "^1.8.0",
122
122
  "motion": "^12.0.0",
@@ -367,6 +367,20 @@ export function useChatComposerController({
367
367
  const submittingRef = useRef(false);
368
368
  const controlOperationRef = useRef(false);
369
369
  const mountedRef = useRef(true);
370
+ const deliveredValueRef = useRef(delivery.value);
371
+ const liveValueRef = useRef(delivery.value);
372
+ if (delivery.value !== deliveredValueRef.current) {
373
+ deliveredValueRef.current = delivery.value;
374
+ liveValueRef.current = delivery.value;
375
+ }
376
+ const setComposerValue = useCallback(
377
+ (next: string) => {
378
+ liveValueRef.current = next;
379
+ delivery.setValue(next);
380
+ },
381
+ [delivery.setValue],
382
+ );
383
+ const visibleValue = liveValueRef.current;
370
384
 
371
385
  useEffect(() => {
372
386
  mountedRef.current = true;
@@ -468,7 +482,7 @@ export function useChatComposerController({
468
482
  applyComposerTextareaHeight(textarea, 220);
469
483
  });
470
484
  }, []);
471
- useEffect(() => resizeInput(), [delivery.value, resizeInput]);
485
+ useEffect(() => resizeInput(), [resizeInput, visibleValue]);
472
486
  useEffect(
473
487
  () => () => {
474
488
  if (resizeInputRafRef.current !== null) {
@@ -505,8 +519,8 @@ export function useChatComposerController({
505
519
  commands,
506
520
  context: commandContext,
507
521
  handlers,
508
- value: delivery.value,
509
- setValue: delivery.setValue,
522
+ value: visibleValue,
523
+ setValue: setComposerValue,
510
524
  });
511
525
  const paletteEnabled = commandContext !== undefined;
512
526
  const commandDraftBlocked = paletteEnabled && palette.isCommandDraft;
@@ -696,8 +710,8 @@ export function useChatComposerController({
696
710
  handlePaste,
697
711
  handleFileChange,
698
712
  focusInput: () => textareaRef.current?.focus(),
699
- setValue: delivery.setValue,
700
- value: delivery.value,
713
+ setValue: setComposerValue,
714
+ value: visibleValue,
701
715
  };
702
716
  }
703
717
 
@@ -1,11 +1,13 @@
1
1
  import type { Session } from "@opengeni/sdk";
2
2
  import { cn } from "../lib/cn";
3
- import { formatRelativeTime, truncate } from "../lib/format";
3
+ import { formatRelativeTime } from "../lib/format";
4
4
  import { SessionStatus } from "./session-status";
5
5
 
6
+ const AUTOMATIC_SESSION_TITLE_FALLBACK = "New conversation";
7
+
6
8
  export type FleetTileProps = {
7
9
  session: Session;
8
- /** Overrides the derived title (metadata.title/name, else the initial message). */
10
+ /** Overrides the derived title (session title, metadata title/name, or safe fallback). */
9
11
  title?: string | undefined;
10
12
  /** Extra line under the title — e.g. "drift check" or the worker's task. */
11
13
  subtitle?: string | undefined;
@@ -15,8 +17,8 @@ export type FleetTileProps = {
15
17
 
16
18
  /** Best-effort display title for a session. */
17
19
  export function sessionDisplayTitle(session: Session): string {
18
- // A set title (agent-generated or user-renamed) wins over metadata + the
19
- // initial-message fallback.
20
+ // A set title (agent-generated or user-renamed) wins over metadata and the
21
+ // prompt-free fallback.
20
22
  if (typeof session.title === "string" && session.title.trim().length > 0) {
21
23
  return session.title;
22
24
  }
@@ -26,7 +28,7 @@ export function sessionDisplayTitle(session: Session): string {
26
28
  return value;
27
29
  }
28
30
  }
29
- return truncate(session.initialMessage, 100) || session.id.slice(0, 8);
31
+ return AUTOMATIC_SESSION_TITLE_FALLBACK;
30
32
  }
31
33
 
32
34
  /**