@modelnex/sdk 0.5.38 → 0.5.39

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.
package/dist/index.js CHANGED
@@ -3305,6 +3305,22 @@ function createTourSocketPool({
3305
3305
  }
3306
3306
  var tourSocketPool = createTourSocketPool();
3307
3307
 
3308
+ // src/utils/reviewModeToggle.ts
3309
+ function isReviewModeEnabled(devMode, requestedReviewMode) {
3310
+ return Boolean(devMode && requestedReviewMode);
3311
+ }
3312
+ function getReviewModeToggleConfig(playbackState) {
3313
+ const isPaused = playbackState === "paused";
3314
+ return {
3315
+ icon: isPaused ? "\u25B6" : "\u23F8",
3316
+ label: isPaused ? "Continue Workflow" : "Pause for Feedback",
3317
+ shouldResume: isPaused
3318
+ };
3319
+ }
3320
+ function shouldCaptureReviewDraft(isReviewMode, playbackState) {
3321
+ return isReviewMode && playbackState === "paused";
3322
+ }
3323
+
3308
3324
  // src/utils/tourTransport.ts
3309
3325
  function compactCaptureEventForTransport(event) {
3310
3326
  return {
@@ -4826,7 +4842,7 @@ function useTourPlayback({
4826
4842
  }
4827
4843
  claimedPlaybackOwnerKeyRef.current = ownerKey;
4828
4844
  startRequestedRef.current = true;
4829
- const shouldReview = Boolean(options?.reviewMode);
4845
+ const shouldReview = isReviewModeEnabled(devModeRef.current, Boolean(options?.reviewMode));
4830
4846
  resetCaptionSuppression();
4831
4847
  setReviewStatusMessage(null);
4832
4848
  setIsReviewMode(shouldReview);
@@ -8804,19 +8820,6 @@ function isTourListeningSessionActive(state) {
8804
8820
  return state.isTourActive || state.isOnboardingActive || Boolean(state.startingExperienceType);
8805
8821
  }
8806
8822
 
8807
- // src/utils/reviewModeToggle.ts
8808
- function getReviewModeToggleConfig(playbackState) {
8809
- const isPaused = playbackState === "paused";
8810
- return {
8811
- icon: isPaused ? "\u25B6" : "\u23F8",
8812
- label: isPaused ? "Continue Workflow" : "Pause for Feedback",
8813
- shouldResume: isPaused
8814
- };
8815
- }
8816
- function shouldCaptureReviewDraft(isReviewMode, playbackState) {
8817
- return isReviewMode && playbackState === "paused";
8818
- }
8819
-
8820
8823
  // src/utils/reviewVoiceRouting.ts
8821
8824
  function resolveSinglePlaybackTranscriptTarget(snapshot) {
8822
8825
  return shouldCaptureReviewDraft(snapshot.isReviewMode, snapshot.playbackState) ? "review_draft" : "playback";
@@ -9613,6 +9616,7 @@ function ModelNexChatBubble({
9613
9616
  const tourPlayback = (0, import_react18.useMemo)(() => createPlaybackView("tour"), [createPlaybackView]);
9614
9617
  const onboardingPlayback = (0, import_react18.useMemo)(() => createPlaybackView("onboarding"), [createPlaybackView]);
9615
9618
  const tourReviewToggle = getReviewModeToggleConfig(tourPlayback.playbackState);
9619
+ const tourReviewModeEnabled = isReviewModeEnabled(devMode, tourPlayback.isReviewMode);
9616
9620
  const lastAutoTaggedUrlRef = (0, import_react18.useRef)(null);
9617
9621
  const handleAutoTag = (0, import_react18.useCallback)(async () => {
9618
9622
  if (!ctx) return;
@@ -9660,6 +9664,7 @@ function ModelNexChatBubble({
9660
9664
  }
9661
9665
  }, [authoringMode, handleAutoTag, ctx?.extractedElements.length, window.location.pathname]);
9662
9666
  const onboardingReviewToggle = getReviewModeToggleConfig(onboardingPlayback.playbackState);
9667
+ const onboardingReviewModeEnabled = isReviewModeEnabled(devMode, onboardingPlayback.isReviewMode);
9663
9668
  const pendingPrompt = playbackController.pendingPrompt;
9664
9669
  const pendingNotificationType = (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.notificationType ?? "bubble_card";
9665
9670
  const isPlaybackActive = tourPlayback.isActive || onboardingPlayback.isActive;
@@ -10429,7 +10434,7 @@ function ModelNexChatBubble({
10429
10434
  ]
10430
10435
  }
10431
10436
  ) }),
10432
- tourPlayback.isActive && tourPlayback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10437
+ tourPlayback.isActive && tourReviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10433
10438
  "div",
10434
10439
  {
10435
10440
  style: {
@@ -10724,7 +10729,7 @@ function ModelNexChatBubble({
10724
10729
  ] })
10725
10730
  ] })
10726
10731
  ] }),
10727
- onboardingPlayback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10732
+ onboardingReviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10728
10733
  "div",
10729
10734
  {
10730
10735
  style: {
@@ -10830,7 +10835,7 @@ function ModelNexChatBubble({
10830
10835
  }
10831
10836
  ),
10832
10837
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { display: "flex", gap: "8px" }, children: [
10833
- !onboardingPlayback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
10838
+ !onboardingReviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
10834
10839
  "button",
10835
10840
  {
10836
10841
  onClick: onboardingPlayback.repeatStep,
@@ -10842,7 +10847,7 @@ function ModelNexChatBubble({
10842
10847
  "button",
10843
10848
  {
10844
10849
  onClick: onboardingPlayback.skipTour,
10845
- style: { flex: onboardingPlayback.isReviewMode ? 1 : 0.6, borderRadius: "12px", border: "1px solid rgba(220,38,38,0.18)", background: "#fff5f5", color: "#b91c1c", padding: "11px 14px", cursor: "pointer", fontWeight: 700, fontSize: "13px" },
10850
+ style: { flex: onboardingReviewModeEnabled ? 1 : 0.6, borderRadius: "12px", border: "1px solid rgba(220,38,38,0.18)", background: "#fff5f5", color: "#b91c1c", padding: "11px 14px", cursor: "pointer", fontWeight: 700, fontSize: "13px" },
10846
10851
  children: "Exit"
10847
10852
  }
10848
10853
  )
@@ -10883,7 +10888,7 @@ function ModelNexChatBubble({
10883
10888
  ) })
10884
10889
  ] }),
10885
10890
  tourCurrentStep && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { borderRadius: "14px", background: TOUR_THEME.card, border: `1px solid ${TOUR_THEME.cardBorder}`, padding: "14px" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "15px", lineHeight: 1.55 }, children: tourCurrentStep.ask || tourCurrentStep.narration || tourCurrentStep.goal }) }),
10886
- tourPlayback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10891
+ tourReviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
10887
10892
  "div",
10888
10893
  {
10889
10894
  style: {
@@ -11337,6 +11342,7 @@ function ModelNexOnboardingPanel({
11337
11342
  }) {
11338
11343
  const ctx = (0, import_react19.useContext)(ModelNexContext);
11339
11344
  const serverUrl = ctx?.serverUrl ?? DEFAULT_MODELNEX_SERVER_URL;
11345
+ const devMode = ctx?.devMode ?? false;
11340
11346
  const voice = useVoice(serverUrl);
11341
11347
  const audioLevels = useAudioLevel(voice.isListening);
11342
11348
  const [input, setInput] = (0, import_react19.useState)("");
@@ -11372,6 +11378,7 @@ function ModelNexOnboardingPanel({
11372
11378
  handleVoiceInput: playback.handleVoiceInput
11373
11379
  });
11374
11380
  const reviewToggle = getReviewModeToggleConfig(playback.playbackState);
11381
+ const reviewModeEnabled = isReviewModeEnabled(devMode, playback.isReviewMode);
11375
11382
  (0, import_react19.useEffect)(() => {
11376
11383
  playbackVoiceRoutingRef.current = {
11377
11384
  isReviewMode: playback.isReviewMode,
@@ -11796,7 +11803,7 @@ function ModelNexOnboardingPanel({
11796
11803
  ] })
11797
11804
  ] }),
11798
11805
  sttError === "not-allowed" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "12px", color: "#b45309", lineHeight: 1.4, padding: "8px 12px", borderRadius: "10px", background: "#fef3c7" }, children: "Microphone blocked. Allow access in your browser to use voice commands." }),
11799
- playback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
11806
+ reviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
11800
11807
  "div",
11801
11808
  {
11802
11809
  style: {
@@ -11907,7 +11914,7 @@ function ModelNexOnboardingPanel({
11907
11914
  ] })
11908
11915
  ] }),
11909
11916
  /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { style: { padding: "0 18px 18px", display: "flex", gap: "8px" }, children: [
11910
- playback.isReviewMode && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
11917
+ reviewModeEnabled && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
11911
11918
  "button",
11912
11919
  {
11913
11920
  type: "button",
@@ -11934,7 +11941,7 @@ function ModelNexOnboardingPanel({
11934
11941
  "button",
11935
11942
  {
11936
11943
  onClick: playback.repeatStep,
11937
- style: { flex: playback.isReviewMode ? 0.6 : 1, borderRadius: "12px", border: "1px solid rgba(15,23,42,0.12)", background: "#fff", padding: "11px 14px", cursor: "pointer", fontWeight: 600 },
11944
+ style: { flex: reviewModeEnabled ? 0.6 : 1, borderRadius: "12px", border: "1px solid rgba(15,23,42,0.12)", background: "#fff", padding: "11px 14px", cursor: "pointer", fontWeight: 600 },
11938
11945
  children: "Repeat"
11939
11946
  }
11940
11947
  ),
package/dist/index.mjs CHANGED
@@ -3094,6 +3094,22 @@ function createTourSocketPool({
3094
3094
  }
3095
3095
  var tourSocketPool = createTourSocketPool();
3096
3096
 
3097
+ // src/utils/reviewModeToggle.ts
3098
+ function isReviewModeEnabled(devMode, requestedReviewMode) {
3099
+ return Boolean(devMode && requestedReviewMode);
3100
+ }
3101
+ function getReviewModeToggleConfig(playbackState) {
3102
+ const isPaused = playbackState === "paused";
3103
+ return {
3104
+ icon: isPaused ? "\u25B6" : "\u23F8",
3105
+ label: isPaused ? "Continue Workflow" : "Pause for Feedback",
3106
+ shouldResume: isPaused
3107
+ };
3108
+ }
3109
+ function shouldCaptureReviewDraft(isReviewMode, playbackState) {
3110
+ return isReviewMode && playbackState === "paused";
3111
+ }
3112
+
3097
3113
  // src/utils/tourTransport.ts
3098
3114
  function compactCaptureEventForTransport(event) {
3099
3115
  return {
@@ -4615,7 +4631,7 @@ function useTourPlayback({
4615
4631
  }
4616
4632
  claimedPlaybackOwnerKeyRef.current = ownerKey;
4617
4633
  startRequestedRef.current = true;
4618
- const shouldReview = Boolean(options?.reviewMode);
4634
+ const shouldReview = isReviewModeEnabled(devModeRef.current, Boolean(options?.reviewMode));
4619
4635
  resetCaptionSuppression();
4620
4636
  setReviewStatusMessage(null);
4621
4637
  setIsReviewMode(shouldReview);
@@ -8592,19 +8608,6 @@ function isTourListeningSessionActive(state) {
8592
8608
  return state.isTourActive || state.isOnboardingActive || Boolean(state.startingExperienceType);
8593
8609
  }
8594
8610
 
8595
- // src/utils/reviewModeToggle.ts
8596
- function getReviewModeToggleConfig(playbackState) {
8597
- const isPaused = playbackState === "paused";
8598
- return {
8599
- icon: isPaused ? "\u25B6" : "\u23F8",
8600
- label: isPaused ? "Continue Workflow" : "Pause for Feedback",
8601
- shouldResume: isPaused
8602
- };
8603
- }
8604
- function shouldCaptureReviewDraft(isReviewMode, playbackState) {
8605
- return isReviewMode && playbackState === "paused";
8606
- }
8607
-
8608
8611
  // src/utils/reviewVoiceRouting.ts
8609
8612
  function resolveSinglePlaybackTranscriptTarget(snapshot) {
8610
8613
  return shouldCaptureReviewDraft(snapshot.isReviewMode, snapshot.playbackState) ? "review_draft" : "playback";
@@ -9401,6 +9404,7 @@ function ModelNexChatBubble({
9401
9404
  const tourPlayback = useMemo3(() => createPlaybackView("tour"), [createPlaybackView]);
9402
9405
  const onboardingPlayback = useMemo3(() => createPlaybackView("onboarding"), [createPlaybackView]);
9403
9406
  const tourReviewToggle = getReviewModeToggleConfig(tourPlayback.playbackState);
9407
+ const tourReviewModeEnabled = isReviewModeEnabled(devMode, tourPlayback.isReviewMode);
9404
9408
  const lastAutoTaggedUrlRef = useRef13(null);
9405
9409
  const handleAutoTag = useCallback12(async () => {
9406
9410
  if (!ctx) return;
@@ -9448,6 +9452,7 @@ function ModelNexChatBubble({
9448
9452
  }
9449
9453
  }, [authoringMode, handleAutoTag, ctx?.extractedElements.length, window.location.pathname]);
9450
9454
  const onboardingReviewToggle = getReviewModeToggleConfig(onboardingPlayback.playbackState);
9455
+ const onboardingReviewModeEnabled = isReviewModeEnabled(devMode, onboardingPlayback.isReviewMode);
9451
9456
  const pendingPrompt = playbackController.pendingPrompt;
9452
9457
  const pendingNotificationType = (onboardingPlayback.pendingTour || tourPlayback.pendingTour)?.notificationType ?? "bubble_card";
9453
9458
  const isPlaybackActive = tourPlayback.isActive || onboardingPlayback.isActive;
@@ -10217,7 +10222,7 @@ function ModelNexChatBubble({
10217
10222
  ]
10218
10223
  }
10219
10224
  ) }),
10220
- tourPlayback.isActive && tourPlayback.isReviewMode && /* @__PURE__ */ jsxs3(
10225
+ tourPlayback.isActive && tourReviewModeEnabled && /* @__PURE__ */ jsxs3(
10221
10226
  "div",
10222
10227
  {
10223
10228
  style: {
@@ -10512,7 +10517,7 @@ function ModelNexChatBubble({
10512
10517
  ] })
10513
10518
  ] })
10514
10519
  ] }),
10515
- onboardingPlayback.isReviewMode && /* @__PURE__ */ jsxs3(
10520
+ onboardingReviewModeEnabled && /* @__PURE__ */ jsxs3(
10516
10521
  "div",
10517
10522
  {
10518
10523
  style: {
@@ -10618,7 +10623,7 @@ function ModelNexChatBubble({
10618
10623
  }
10619
10624
  ),
10620
10625
  /* @__PURE__ */ jsxs3("div", { style: { display: "flex", gap: "8px" }, children: [
10621
- !onboardingPlayback.isReviewMode && /* @__PURE__ */ jsx4(
10626
+ !onboardingReviewModeEnabled && /* @__PURE__ */ jsx4(
10622
10627
  "button",
10623
10628
  {
10624
10629
  onClick: onboardingPlayback.repeatStep,
@@ -10630,7 +10635,7 @@ function ModelNexChatBubble({
10630
10635
  "button",
10631
10636
  {
10632
10637
  onClick: onboardingPlayback.skipTour,
10633
- style: { flex: onboardingPlayback.isReviewMode ? 1 : 0.6, borderRadius: "12px", border: "1px solid rgba(220,38,38,0.18)", background: "#fff5f5", color: "#b91c1c", padding: "11px 14px", cursor: "pointer", fontWeight: 700, fontSize: "13px" },
10638
+ style: { flex: onboardingReviewModeEnabled ? 1 : 0.6, borderRadius: "12px", border: "1px solid rgba(220,38,38,0.18)", background: "#fff5f5", color: "#b91c1c", padding: "11px 14px", cursor: "pointer", fontWeight: 700, fontSize: "13px" },
10634
10639
  children: "Exit"
10635
10640
  }
10636
10641
  )
@@ -10671,7 +10676,7 @@ function ModelNexChatBubble({
10671
10676
  ) })
10672
10677
  ] }),
10673
10678
  tourCurrentStep && /* @__PURE__ */ jsx4("div", { style: { borderRadius: "14px", background: TOUR_THEME.card, border: `1px solid ${TOUR_THEME.cardBorder}`, padding: "14px" }, children: /* @__PURE__ */ jsx4("div", { style: { fontSize: "15px", lineHeight: 1.55 }, children: tourCurrentStep.ask || tourCurrentStep.narration || tourCurrentStep.goal }) }),
10674
- tourPlayback.isReviewMode && /* @__PURE__ */ jsxs3(
10679
+ tourReviewModeEnabled && /* @__PURE__ */ jsxs3(
10675
10680
  "div",
10676
10681
  {
10677
10682
  style: {
@@ -11125,6 +11130,7 @@ function ModelNexOnboardingPanel({
11125
11130
  }) {
11126
11131
  const ctx = useContext6(ModelNexContext);
11127
11132
  const serverUrl = ctx?.serverUrl ?? DEFAULT_MODELNEX_SERVER_URL;
11133
+ const devMode = ctx?.devMode ?? false;
11128
11134
  const voice = useVoice(serverUrl);
11129
11135
  const audioLevels = useAudioLevel(voice.isListening);
11130
11136
  const [input, setInput] = useState14("");
@@ -11160,6 +11166,7 @@ function ModelNexOnboardingPanel({
11160
11166
  handleVoiceInput: playback.handleVoiceInput
11161
11167
  });
11162
11168
  const reviewToggle = getReviewModeToggleConfig(playback.playbackState);
11169
+ const reviewModeEnabled = isReviewModeEnabled(devMode, playback.isReviewMode);
11163
11170
  useEffect18(() => {
11164
11171
  playbackVoiceRoutingRef.current = {
11165
11172
  isReviewMode: playback.isReviewMode,
@@ -11584,7 +11591,7 @@ function ModelNexOnboardingPanel({
11584
11591
  ] })
11585
11592
  ] }),
11586
11593
  sttError === "not-allowed" && /* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", color: "#b45309", lineHeight: 1.4, padding: "8px 12px", borderRadius: "10px", background: "#fef3c7" }, children: "Microphone blocked. Allow access in your browser to use voice commands." }),
11587
- playback.isReviewMode && /* @__PURE__ */ jsxs4(
11594
+ reviewModeEnabled && /* @__PURE__ */ jsxs4(
11588
11595
  "div",
11589
11596
  {
11590
11597
  style: {
@@ -11695,7 +11702,7 @@ function ModelNexOnboardingPanel({
11695
11702
  ] })
11696
11703
  ] }),
11697
11704
  /* @__PURE__ */ jsxs4("div", { style: { padding: "0 18px 18px", display: "flex", gap: "8px" }, children: [
11698
- playback.isReviewMode && /* @__PURE__ */ jsxs4(
11705
+ reviewModeEnabled && /* @__PURE__ */ jsxs4(
11699
11706
  "button",
11700
11707
  {
11701
11708
  type: "button",
@@ -11722,7 +11729,7 @@ function ModelNexOnboardingPanel({
11722
11729
  "button",
11723
11730
  {
11724
11731
  onClick: playback.repeatStep,
11725
- style: { flex: playback.isReviewMode ? 0.6 : 1, borderRadius: "12px", border: "1px solid rgba(15,23,42,0.12)", background: "#fff", padding: "11px 14px", cursor: "pointer", fontWeight: 600 },
11732
+ style: { flex: reviewModeEnabled ? 0.6 : 1, borderRadius: "12px", border: "1px solid rgba(15,23,42,0.12)", background: "#fff", padding: "11px 14px", cursor: "pointer", fontWeight: 600 },
11726
11733
  children: "Repeat"
11727
11734
  }
11728
11735
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.38",
3
+ "version": "0.5.39",
4
4
  "description": "React SDK for natural language control of web apps via AI agents",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",