@opengeni/react-native 4.3.3-canary.39685962091001 → 4.3.3-canary.39705388692001

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.
@@ -7,7 +7,7 @@ import { useOpenNativeLink } from '../chunk-2WJTBHO6.js';
7
7
  import '../chunk-7ZDF5VGA.js';
8
8
  import { useNativeTimelineTheme, fontStyle, Icon } from '../chunk-FHPMRXIG.js';
9
9
  export { Icon, NativeTimelineThemeProvider, createNativeTimelineTheme, fontStyle, useNativeTimelineTheme, webColorsDark, webColorsLight } from '../chunk-FHPMRXIG.js';
10
- import { buildTimeline, groupTimeline, conversationTimeline } from '@opengeni/react/session';
10
+ import { buildTimeline, groupTimeline, conversationTimeline, useSessionStart, personalMachineCopy } from '@opengeni/react/session';
11
11
  import { defaultHumanInputFormMessages, createTurnSummaryContext, resolveTurnSummaryFacets, selectTurnSummaryFacets, formatElapsed, turnSummaryFallbackLabel, rollingActivityItem, toolDisplayName, annotationHasNote, annotationDisplayOrdinal, ANNOTATION_MAX_NOTE_LENGTH, questionNavTarget, timelineGroupIndexAtSequence, QUESTION_NAV_MARGIN_PX, flattenActivityItems, timelineGroupContainsPresentedImage, durationBetween, isPreparingWork, readableWorkStatus, readableWorkShowsPreview, readableWorkDefaultOpen, compactedLandmarkCount, SESSION_STATUS_PRESENTATION, formatRelativeTime, recordedWaitSummaryText, noticeTone, noticeDisplayText, isActionableHumanInputRequest, humanInputHeading, initialDrafts, emptyDraft, SESSION_STATUS_BADGE, workerRowTitle, startupDuration, STARTUP_WAIT_TITLES, startupPhaseTitle, sandboxRowTitle, toolRowPresentation, presentsToolOutputPreview, GENIE_WAITING_PHRASES, GENIE_PREPARING_PHRASES, truncateAnnotationQuote, annotationNoteNeedsDisclosure, annotationFromSelection, answersFromDrafts, notificationPlainText, pathDirname, pathBasename, formatClockTime, parseNotificationText } from '@opengeni/react/timeline-model';
12
12
  import { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback, useId } from 'react';
13
13
  import { Platform, Text, View, Pressable, useWindowDimensions, Animated as Animated$1, AccessibilityInfo, Easing, PanResponder, Modal, KeyboardAvoidingView, ScrollView, TextInput, Keyboard, ActivityIndicator, Image, Alert, AppState, ActionSheetIOS, Linking } from 'react-native';
@@ -15,6 +15,7 @@ import Animated, { FadeIn, FadeOut, FadeOutUp, FadeInDown, useAnimatedKeyboard,
15
15
  import { createOpenGeniText, useOpenGeniText, SingleSendWording } from '@opengeni/react/messages';
16
16
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
17
17
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
18
+ import { machineDisplayName } from '@opengeni/react/sandbox-label-model';
18
19
  import { defaultChatComposerMessages } from '@opengeni/react/composer-messages';
19
20
  import { isLiquidGlassAvailable, GlassView } from 'expo-glass-effect';
20
21
  import { loadSessionFeedback, turnRatingsFromFeedback, feedbackSentimentLabel, feedbackDialogCopy, feedbackSubmission } from '@opengeni/react/session-feedback-model';
@@ -6344,15 +6345,13 @@ function SessionScreenBody({
6344
6345
  }
6345
6346
  ) : empty && controller.initialLoading ? /* @__PURE__ */ jsx(View, { style: { flex: 1, alignItems: "center", justifyContent: "center", gap: 8 }, children: /* @__PURE__ */ jsx(ActivityIndicator, { color: theme.colors["fg-muted"] }) }) : timelineProps.emptyState,
6346
6347
  trailing: /* @__PURE__ */ jsxs(Fragment, { children: [
6347
- controller.admissionBlocked && !paused ? /* @__PURE__ */ jsx(
6348
+ controller.admissionBlocked && !paused && controller.session.session ? /* @__PURE__ */ jsx(
6348
6349
  StuckCard,
6349
6350
  {
6350
- needsAccess: controller.session.session?.admissionBlock?.reason === "initiator_membership_required" || controller.session.session?.admissionBlock?.reason === "personal_resource_grant_required",
6351
+ session: controller.session.session,
6351
6352
  busy: composer.resuming || control.controlling,
6352
- onRetry: async () => {
6353
- const result = await control.resume();
6353
+ onSessionChanged: async () => {
6354
6354
  await Promise.all([controller.session.refresh(), queue.refresh()]);
6355
- if (!result) throw new Error("Resume was not accepted");
6356
6355
  }
6357
6356
  }
6358
6357
  ) : null,
@@ -6577,14 +6576,22 @@ function LoadFailure({ message, onRetry }) {
6577
6576
  ] });
6578
6577
  }
6579
6578
  function StuckCard({
6579
+ session,
6580
6580
  busy,
6581
- needsAccess,
6582
- onRetry
6581
+ onSessionChanged
6583
6582
  }) {
6584
6583
  const theme = useNativeTimelineTheme();
6585
6584
  const m = useNativeTimelineMessages();
6585
+ const t = useOpenGeniText();
6586
+ const start = useSessionStart({ session, onSessionChanged });
6586
6587
  const [failed, setFailed] = useState(false);
6588
+ const [moving, setMoving] = useState(null);
6589
+ const [moveError, setMoveError] = useState(null);
6587
6590
  const c = theme.colors;
6591
+ const reason = start.reason;
6592
+ const machine = start.needsDifferentMachine && start.machineAccess ? personalMachineCopy(t, start.machineAccess, { queued: true }) : null;
6593
+ const needsAccess = reason?.reason === "initiator_membership_required" || reason?.reason === "personal_resource_grant_required";
6594
+ const textStyle = { ...fontStyle(theme), fontSize: 14, lineHeight: 20, color: c["fg-muted"] };
6588
6595
  return /* @__PURE__ */ jsxs(
6589
6596
  View,
6590
6597
  {
@@ -6600,20 +6607,48 @@ function StuckCard({
6600
6607
  children: [
6601
6608
  /* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "center", gap: 8 }, children: [
6602
6609
  /* @__PURE__ */ jsx(Icon, { name: "circle-alert", size: 16, color: c["status-failed"] }),
6603
- /* @__PURE__ */ jsx(Text, { style: { ...fontStyle(theme, 600), fontSize: 15, color: c.fg }, children: m.stuckTitle })
6610
+ /* @__PURE__ */ jsx(Text, { style: { ...fontStyle(theme, 600), fontSize: 15, color: c.fg, flexShrink: 1 }, children: machine ? t("sessionAdmission.needsDifferentMachineTitle") : m.stuckTitle })
6604
6611
  ] }),
6605
- /* @__PURE__ */ jsx(
6606
- Text,
6607
- {
6608
- style: {
6609
- ...fontStyle(theme),
6610
- fontSize: 14,
6611
- lineHeight: 20,
6612
- color: c["fg-muted"]
6613
- },
6614
- children: needsAccess ? m.stuckAccessBody : m.stuckBody
6615
- }
6616
- ),
6612
+ machine ? /* @__PURE__ */ jsxs(Fragment, { children: [
6613
+ /* @__PURE__ */ jsx(Text, { style: textStyle, children: machine.explanation }),
6614
+ /* @__PURE__ */ jsx(Text, { style: textStyle, children: machine.next }),
6615
+ start.canChooseMachine ? /* @__PURE__ */ jsxs(
6616
+ View,
6617
+ {
6618
+ style: { gap: 6 },
6619
+ accessibilityLabel: t("sessionAdmission.chooseAMachineForThisChat"),
6620
+ children: [
6621
+ start.machineChoices.length === 0 ? /* @__PURE__ */ jsx(Text, { style: textStyle, children: t("sessionAdmission.noMachineChoices") }) : start.machineChoices.map((choice) => /* @__PURE__ */ jsx(
6622
+ Button,
6623
+ {
6624
+ label: moving === choice.sandboxId ? t("sessionAdmission.moving") : machineDisplayName(t, choice),
6625
+ busy: moving === choice.sandboxId,
6626
+ disabled: busy || moving !== null,
6627
+ style: { alignSelf: "stretch" },
6628
+ onPress: () => {
6629
+ setMoving(choice.sandboxId);
6630
+ setMoveError(null);
6631
+ start.chooseMachine(choice).then(
6632
+ setMoveError,
6633
+ () => setMoveError(t("sessionAdmission.machineChangeFailed"))
6634
+ ).finally(() => setMoving(null));
6635
+ }
6636
+ },
6637
+ choice.sandboxId
6638
+ )),
6639
+ /* @__PURE__ */ jsx(Text, { style: { ...textStyle, fontSize: 13 }, children: t("sessionAdmission.savedMessageMachineNote") })
6640
+ ]
6641
+ }
6642
+ ) : null,
6643
+ moveError ? /* @__PURE__ */ jsx(
6644
+ Text,
6645
+ {
6646
+ accessibilityLiveRegion: "polite",
6647
+ style: { ...fontStyle(theme), fontSize: 13, color: c["status-failed"] },
6648
+ children: start.machineChoiceError || moveError
6649
+ }
6650
+ ) : null
6651
+ ] }) : /* @__PURE__ */ jsx(Text, { style: textStyle, children: needsAccess ? m.stuckAccessBody : m.stuckBody }),
6617
6652
  failed ? /* @__PURE__ */ jsx(
6618
6653
  Text,
6619
6654
  {
@@ -6626,7 +6661,7 @@ function StuckCard({
6626
6661
  children: m.stuckRetryFailed
6627
6662
  }
6628
6663
  ) : null,
6629
- /* @__PURE__ */ jsx(
6664
+ machine ? null : /* @__PURE__ */ jsx(
6630
6665
  Button,
6631
6666
  {
6632
6667
  label: m.stuckRetry,
@@ -6636,7 +6671,7 @@ function StuckCard({
6636
6671
  style: { alignSelf: "flex-start" },
6637
6672
  onPress: () => {
6638
6673
  setFailed(false);
6639
- onRetry().catch(() => setFailed(true));
6674
+ start.recheck().catch(() => setFailed(true));
6640
6675
  }
6641
6676
  }
6642
6677
  )