@opengeni/react 2.2.0-canary.0 → 2.5.0-canary.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 (47) hide show
  1. package/README.md +9 -2
  2. package/dist/{chunk-5RZN3DD5.js → chunk-6H6S5V4Z.js} +280 -113
  3. package/dist/chunk-6H6S5V4Z.js.map +1 -0
  4. package/dist/{chunk-UOLJWT5Y.js → chunk-ATQJEWCA.js} +154 -114
  5. package/dist/chunk-ATQJEWCA.js.map +1 -0
  6. package/dist/{chunk-XSA2QAKP.js → chunk-MXJGO7LE.js} +65 -3
  7. package/dist/chunk-MXJGO7LE.js.map +1 -0
  8. package/dist/{chunk-LTCHJ4MS.js → chunk-NVREJA6V.js} +2 -2
  9. package/dist/{chunk-JOAVA2TW.js → chunk-T7VAYG2I.js} +8 -7
  10. package/dist/{chunk-JOAVA2TW.js.map → chunk-T7VAYG2I.js.map} +1 -1
  11. package/dist/components/fleet-tile.d.ts +1 -1
  12. package/dist/components/message-timeline.d.ts +7 -2
  13. package/dist/composer.js +2 -2
  14. package/dist/hooks/use-session-events.d.ts +2 -1
  15. package/dist/hooks/use-session-lineage.d.ts +4 -0
  16. package/dist/hooks/use-session.d.ts +6 -0
  17. package/dist/hooks/use-workspace-sessions.d.ts +6 -0
  18. package/dist/index.d.ts +2 -0
  19. package/dist/index.js +41 -19
  20. package/dist/index.js.map +1 -1
  21. package/dist/older-history.d.ts +29 -0
  22. package/dist/session-ui.d.ts +2 -0
  23. package/dist/session-ui.js +5 -2
  24. package/dist/session.d.ts +2 -0
  25. package/dist/session.js +5 -3
  26. package/dist/timeline/types.d.ts +2 -0
  27. package/package.json +2 -2
  28. package/src/components/fleet-tile.tsx +7 -5
  29. package/src/components/human-input-form.tsx +14 -6
  30. package/src/components/message-timeline.tsx +428 -137
  31. package/src/components/tip-follow.ts +18 -7
  32. package/src/hooks/use-composer.ts +20 -6
  33. package/src/hooks/use-session-events.ts +84 -76
  34. package/src/hooks/use-session-lineage.ts +26 -8
  35. package/src/hooks/use-session.ts +35 -8
  36. package/src/hooks/use-workspace-sessions.ts +38 -13
  37. package/src/index.ts +2 -0
  38. package/src/older-history.ts +69 -0
  39. package/src/session-ui.ts +2 -0
  40. package/src/session.ts +2 -0
  41. package/src/timeline/activity-rail.tsx +1 -0
  42. package/src/timeline/projection.ts +53 -2
  43. package/src/timeline/types.ts +2 -0
  44. package/dist/chunk-5RZN3DD5.js.map +0 -1
  45. package/dist/chunk-UOLJWT5Y.js.map +0 -1
  46. package/dist/chunk-XSA2QAKP.js.map +0 -1
  47. /package/dist/{chunk-LTCHJ4MS.js.map → chunk-NVREJA6V.js.map} +0 -0
@@ -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-5RZN3DD5.js";
15
- import "./chunk-XSA2QAKP.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-UOLJWT5Y.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-XSA2QAKP.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,
@@ -59,6 +59,8 @@ export type AgentMessageItem = {
59
59
  id: string;
60
60
  turnId: string | null;
61
61
  text: string;
62
+ /** Provider-declared assistant channel. Absent on legacy and non-Responses events. */
63
+ phase?: "commentary" | "final_answer" | undefined;
62
64
  /** Still receiving deltas (no completed/turn-end seen yet). */
63
65
  streaming: boolean;
64
66
  occurredAt: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/react",
3
- "version": "2.2.0-canary.0",
3
+ "version": "2.5.0-canary.0",
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.2.0-canary.0",
119
+ "@opengeni/sdk": "^2.5.0-canary.0",
120
120
  "clsx": "^2.1.1",
121
121
  "lucide-react": "^1.8.0",
122
122
  "motion": "^12.0.0",
@@ -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
  /**
@@ -508,6 +508,11 @@ function QuestionControls({
508
508
  ]
509
509
  .filter(Boolean)
510
510
  .join(" ") || undefined;
511
+ const selectOtherDraft = (current: HumanInputAnswerDraft): HumanInputAnswerDraft => ({
512
+ ...current,
513
+ otherSelected: true,
514
+ ...(question.kind === "single_select" ? { values: [] } : {}),
515
+ });
511
516
  return (
512
517
  <>
513
518
  {showPromptChrome ? (
@@ -679,14 +684,17 @@ function QuestionControls({
679
684
  id={otherTextId}
680
685
  type="text"
681
686
  value={draft.other}
682
- disabled={!draft.otherSelected || busy}
687
+ disabled={busy}
683
688
  placeholder="Type a value…"
684
- onChange={(event) =>
689
+ onClick={() => onUpdate(selectOtherDraft)}
690
+ onFocus={() => onUpdate(selectOtherDraft)}
691
+ onChange={(event) => {
692
+ const other = event.target.value;
685
693
  onUpdate((current) => ({
686
- ...current,
687
- other: event.target.value,
688
- }))
689
- }
694
+ ...selectOtherDraft(current),
695
+ other,
696
+ }));
697
+ }}
690
698
  className="mt-1.5 w-full rounded-og-sm border border-og-border bg-og-surface-1 px-2 py-1.5 text-og-sm text-og-fg outline-hidden focus:border-og-accent disabled:opacity-50"
691
699
  />
692
700
  </span>