@modelnex/sdk 0.5.9 → 0.5.11

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.d.mts CHANGED
@@ -480,7 +480,7 @@ interface ModelNexOnboardingPanelProps {
480
480
  appName?: string;
481
481
  title?: string;
482
482
  }
483
- declare function ModelNexOnboardingPanel({ appName, title, }: ModelNexOnboardingPanelProps): react_jsx_runtime.JSX.Element;
483
+ declare function ModelNexOnboardingPanel({ appName, title, }: ModelNexOnboardingPanelProps): react_jsx_runtime.JSX.Element | null;
484
484
 
485
485
  /**
486
486
  * Toggle and read the action-highlight overlay state.
@@ -827,6 +827,10 @@ interface ModelNexProviderProps {
827
827
  * userId — used for per-user tour completion state
828
828
  */
829
829
  userProfile?: UserProfile;
830
+ /**
831
+ * Same-origin base for tour API (avoids CORS for ?modelnex_test_tour=)
832
+ */
833
+ toursApiBase?: string;
830
834
  /**
831
835
  * Enable SDK dev tools unconditionally (tour recording, studio mode)
832
836
  */
package/dist/index.d.ts CHANGED
@@ -480,7 +480,7 @@ interface ModelNexOnboardingPanelProps {
480
480
  appName?: string;
481
481
  title?: string;
482
482
  }
483
- declare function ModelNexOnboardingPanel({ appName, title, }: ModelNexOnboardingPanelProps): react_jsx_runtime.JSX.Element;
483
+ declare function ModelNexOnboardingPanel({ appName, title, }: ModelNexOnboardingPanelProps): react_jsx_runtime.JSX.Element | null;
484
484
 
485
485
  /**
486
486
  * Toggle and read the action-highlight overlay state.
@@ -827,6 +827,10 @@ interface ModelNexProviderProps {
827
827
  * userId — used for per-user tour completion state
828
828
  */
829
829
  userProfile?: UserProfile;
830
+ /**
831
+ * Same-origin base for tour API (avoids CORS for ?modelnex_test_tour=)
832
+ */
833
+ toursApiBase?: string;
830
834
  /**
831
835
  * Enable SDK dev tools unconditionally (tour recording, studio mode)
832
836
  */
package/dist/index.js CHANGED
@@ -8191,6 +8191,11 @@ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { wid
8191
8191
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
8192
8192
  ] });
8193
8193
  var MinimizeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 18h8" }) });
8194
+ var TrashIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
8195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M3 6h18" }),
8196
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
8197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
8198
+ ] });
8194
8199
  var StopIcon = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) });
8195
8200
  var ChevronDown = ({ open }) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 0.2s" }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("path", { d: "m6 9 6 6 6-6" }) });
8196
8201
  function AgentTraces({ debug, command, defaultExpanded = true }) {
@@ -8252,7 +8257,7 @@ function AgentTraces({ debug, command, defaultExpanded = true }) {
8252
8257
  !hasTraceContent ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "12px", padding: "8px", background: "#fef3c7", borderRadius: "4px", borderLeft: "3px solid #f59e0b" }, children: [
8253
8258
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontWeight: 600, color: "#92400e", marginBottom: "4px" }, children: "No trace data" }),
8254
8259
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontSize: "10px", color: "#71717a", marginBottom: "6px" }, children: "The server may not have OPENROUTER_API_KEY set, or the request failed before the agent ran." }),
8255
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { style: { margin: 0, padding: "8px", background: "#fff", borderRadius: "4px", fontSize: "10px", overflow: "auto", maxHeight: "120px" }, children: JSON.stringify(debug, null, 2) })
8260
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { style: { margin: 0, padding: "8px", background: "#fff", borderRadius: "4px", fontSize: "10px", overflow: "auto", maxHeight: "120px", color: "#27272a" }, children: JSON.stringify(debug, null, 2) })
8256
8261
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
8257
8262
  debug.llmInput && traces.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "12px" }, children: [
8258
8263
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { fontWeight: 600, color: "#3f3f46", marginBottom: "4px" }, children: "Input \u2192 agent" }),
@@ -8299,7 +8304,7 @@ function AgentTraces({ debug, command, defaultExpanded = true }) {
8299
8304
  isStepExpanded && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
8300
8305
  t.reasoning && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "6px" }, children: [
8301
8306
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: { color: "#71717a", marginBottom: "2px" }, children: "Reasoning" }),
8302
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { style: { margin: 0, padding: "6px", background: "#fef3c7", borderRadius: "4px", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: "100px", overflow: "auto", borderLeft: "3px solid #f59e0b" }, children: t.reasoning })
8307
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("pre", { style: { margin: 0, padding: "6px", background: "#fef3c7", borderRadius: "4px", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: "100px", overflow: "auto", borderLeft: "3px solid #f59e0b", color: "#451a03" }, children: t.reasoning })
8303
8308
  ] }),
8304
8309
  t.llmInput && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
8305
8310
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: { marginBottom: "6px" }, children: [
@@ -9159,6 +9164,15 @@ function ModelNexChatBubble({
9159
9164
  children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BookOpenIcon, {})
9160
9165
  }
9161
9166
  ) }) }),
9167
+ messages.length > 0 && !(tourPlayback.isActive || onboardingPlayback.isActive) && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Tooltip, { title: "Clear chat", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
9168
+ "button",
9169
+ {
9170
+ onClick: clearChat,
9171
+ style: { padding: "8px", borderRadius: "10px", border: "none", background: "transparent", cursor: "pointer", color: "#71717a" },
9172
+ "aria-label": "Clear chat",
9173
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TrashIcon, {})
9174
+ }
9175
+ ) }),
9162
9176
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Tooltip, { title: "Minimize", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
9163
9177
  "button",
9164
9178
  {
@@ -10448,48 +10462,7 @@ function ModelNexOnboardingPanel({
10448
10462
  );
10449
10463
  }
10450
10464
  if (!playback.isActive || !playback.activeTour) {
10451
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
10452
- "div",
10453
- {
10454
- "data-modelnex-internal": "true",
10455
- style: {
10456
- position: "fixed",
10457
- right: "24px",
10458
- bottom: "24px",
10459
- width: "360px",
10460
- maxWidth: "calc(100vw - 32px)",
10461
- borderRadius: "18px",
10462
- border: `1px solid ${PANEL_THEME2.border}`,
10463
- background: PANEL_THEME2.shell,
10464
- boxShadow: "0 8px 32px rgba(15, 23, 42, 0.08)",
10465
- overflow: "hidden",
10466
- zIndex: 100004,
10467
- color: "#172033",
10468
- fontFamily: 'ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
10469
- padding: "20px 18px",
10470
- display: "flex",
10471
- gap: "12px",
10472
- alignItems: "center"
10473
- },
10474
- children: [
10475
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: {
10476
- width: "36px",
10477
- height: "36px",
10478
- borderRadius: "50%",
10479
- background: PANEL_THEME2.hero,
10480
- display: "flex",
10481
- alignItems: "center",
10482
- justifyContent: "center",
10483
- flexShrink: 0,
10484
- fontSize: "18px"
10485
- }, children: "\u{1F3AF}" }),
10486
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
10487
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "13px", fontWeight: 700, color: "#172033", marginBottom: "2px" }, children: "Workflow" }),
10488
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { style: { fontSize: "12px", color: "#6b7280" }, children: "Ready \u2014 onboarding will appear here when available." })
10489
- ] })
10490
- ]
10491
- }
10492
- );
10465
+ return null;
10493
10466
  }
10494
10467
  if (!open) {
10495
10468
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
@@ -10894,12 +10867,12 @@ var ModelNexProvider = ({
10894
10867
  children,
10895
10868
  websiteId,
10896
10869
  userProfile,
10870
+ toursApiBase,
10897
10871
  devMode
10898
10872
  }) => {
10899
10873
  const serverUrl = DEFAULT_SERVER_URL2;
10900
10874
  const commandUrl = void 0;
10901
10875
  const disableSocket = false;
10902
- const toursApiBase = void 0;
10903
10876
  const renderedChildren = children;
10904
10877
  const [activeAgentActions, setActiveAgentActions] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
10905
10878
  const [stagingFields, setStagingFields] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
@@ -10990,12 +10963,13 @@ var ModelNexProvider = ({
10990
10963
  setChatMessages,
10991
10964
  websiteId,
10992
10965
  userProfile,
10966
+ toursApiBase,
10993
10967
  voiceMuted,
10994
10968
  setVoiceMuted,
10995
10969
  socketId,
10996
10970
  devMode
10997
10971
  }),
10998
- [serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile, voiceMuted, socketId, devMode]
10972
+ [serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile, toursApiBase, voiceMuted, socketId, devMode]
10999
10973
  );
11000
10974
  return import_react21.default.createElement(
11001
10975
  ModelNexContext.Provider,
package/dist/index.mjs CHANGED
@@ -7981,6 +7981,11 @@ var CloseIcon = () => /* @__PURE__ */ jsxs3("svg", { width: "var(--modelnex-bubb
7981
7981
  /* @__PURE__ */ jsx4("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
7982
7982
  ] });
7983
7983
  var MinimizeIcon = () => /* @__PURE__ */ jsx4("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("path", { d: "M8 18h8" }) });
7984
+ var TrashIcon = () => /* @__PURE__ */ jsxs3("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
7985
+ /* @__PURE__ */ jsx4("path", { d: "M3 6h18" }),
7986
+ /* @__PURE__ */ jsx4("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
7987
+ /* @__PURE__ */ jsx4("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" })
7988
+ ] });
7984
7989
  var StopIcon = () => /* @__PURE__ */ jsx4("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx4("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) });
7985
7990
  var ChevronDown = ({ open }) => /* @__PURE__ */ jsx4("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 0.2s" }, children: /* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }) });
7986
7991
  function AgentTraces({ debug, command, defaultExpanded = true }) {
@@ -8042,7 +8047,7 @@ function AgentTraces({ debug, command, defaultExpanded = true }) {
8042
8047
  !hasTraceContent ? /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "12px", padding: "8px", background: "#fef3c7", borderRadius: "4px", borderLeft: "3px solid #f59e0b" }, children: [
8043
8048
  /* @__PURE__ */ jsx4("div", { style: { fontWeight: 600, color: "#92400e", marginBottom: "4px" }, children: "No trace data" }),
8044
8049
  /* @__PURE__ */ jsx4("div", { style: { fontSize: "10px", color: "#71717a", marginBottom: "6px" }, children: "The server may not have OPENROUTER_API_KEY set, or the request failed before the agent ran." }),
8045
- /* @__PURE__ */ jsx4("pre", { style: { margin: 0, padding: "8px", background: "#fff", borderRadius: "4px", fontSize: "10px", overflow: "auto", maxHeight: "120px" }, children: JSON.stringify(debug, null, 2) })
8050
+ /* @__PURE__ */ jsx4("pre", { style: { margin: 0, padding: "8px", background: "#fff", borderRadius: "4px", fontSize: "10px", overflow: "auto", maxHeight: "120px", color: "#27272a" }, children: JSON.stringify(debug, null, 2) })
8046
8051
  ] }) : /* @__PURE__ */ jsxs3(Fragment2, { children: [
8047
8052
  debug.llmInput && traces.length === 0 && /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "12px" }, children: [
8048
8053
  /* @__PURE__ */ jsx4("div", { style: { fontWeight: 600, color: "#3f3f46", marginBottom: "4px" }, children: "Input \u2192 agent" }),
@@ -8089,7 +8094,7 @@ function AgentTraces({ debug, command, defaultExpanded = true }) {
8089
8094
  isStepExpanded && /* @__PURE__ */ jsxs3(Fragment2, { children: [
8090
8095
  t.reasoning && /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "6px" }, children: [
8091
8096
  /* @__PURE__ */ jsx4("div", { style: { color: "#71717a", marginBottom: "2px" }, children: "Reasoning" }),
8092
- /* @__PURE__ */ jsx4("pre", { style: { margin: 0, padding: "6px", background: "#fef3c7", borderRadius: "4px", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: "100px", overflow: "auto", borderLeft: "3px solid #f59e0b" }, children: t.reasoning })
8097
+ /* @__PURE__ */ jsx4("pre", { style: { margin: 0, padding: "6px", background: "#fef3c7", borderRadius: "4px", whiteSpace: "pre-wrap", wordBreak: "break-word", maxHeight: "100px", overflow: "auto", borderLeft: "3px solid #f59e0b", color: "#451a03" }, children: t.reasoning })
8093
8098
  ] }),
8094
8099
  t.llmInput && /* @__PURE__ */ jsxs3(Fragment2, { children: [
8095
8100
  /* @__PURE__ */ jsxs3("div", { style: { marginBottom: "6px" }, children: [
@@ -8949,6 +8954,15 @@ function ModelNexChatBubble({
8949
8954
  children: /* @__PURE__ */ jsx4(BookOpenIcon, {})
8950
8955
  }
8951
8956
  ) }) }),
8957
+ messages.length > 0 && !(tourPlayback.isActive || onboardingPlayback.isActive) && /* @__PURE__ */ jsx4(Tooltip, { title: "Clear chat", children: /* @__PURE__ */ jsx4(
8958
+ "button",
8959
+ {
8960
+ onClick: clearChat,
8961
+ style: { padding: "8px", borderRadius: "10px", border: "none", background: "transparent", cursor: "pointer", color: "#71717a" },
8962
+ "aria-label": "Clear chat",
8963
+ children: /* @__PURE__ */ jsx4(TrashIcon, {})
8964
+ }
8965
+ ) }),
8952
8966
  /* @__PURE__ */ jsx4(Tooltip, { title: "Minimize", children: /* @__PURE__ */ jsx4(
8953
8967
  "button",
8954
8968
  {
@@ -10238,48 +10252,7 @@ function ModelNexOnboardingPanel({
10238
10252
  );
10239
10253
  }
10240
10254
  if (!playback.isActive || !playback.activeTour) {
10241
- return /* @__PURE__ */ jsxs4(
10242
- "div",
10243
- {
10244
- "data-modelnex-internal": "true",
10245
- style: {
10246
- position: "fixed",
10247
- right: "24px",
10248
- bottom: "24px",
10249
- width: "360px",
10250
- maxWidth: "calc(100vw - 32px)",
10251
- borderRadius: "18px",
10252
- border: `1px solid ${PANEL_THEME2.border}`,
10253
- background: PANEL_THEME2.shell,
10254
- boxShadow: "0 8px 32px rgba(15, 23, 42, 0.08)",
10255
- overflow: "hidden",
10256
- zIndex: 100004,
10257
- color: "#172033",
10258
- fontFamily: 'ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
10259
- padding: "20px 18px",
10260
- display: "flex",
10261
- gap: "12px",
10262
- alignItems: "center"
10263
- },
10264
- children: [
10265
- /* @__PURE__ */ jsx5("div", { style: {
10266
- width: "36px",
10267
- height: "36px",
10268
- borderRadius: "50%",
10269
- background: PANEL_THEME2.hero,
10270
- display: "flex",
10271
- alignItems: "center",
10272
- justifyContent: "center",
10273
- flexShrink: 0,
10274
- fontSize: "18px"
10275
- }, children: "\u{1F3AF}" }),
10276
- /* @__PURE__ */ jsxs4("div", { children: [
10277
- /* @__PURE__ */ jsx5("div", { style: { fontSize: "13px", fontWeight: 700, color: "#172033", marginBottom: "2px" }, children: "Workflow" }),
10278
- /* @__PURE__ */ jsx5("div", { style: { fontSize: "12px", color: "#6b7280" }, children: "Ready \u2014 onboarding will appear here when available." })
10279
- ] })
10280
- ]
10281
- }
10282
- );
10255
+ return null;
10283
10256
  }
10284
10257
  if (!open) {
10285
10258
  return /* @__PURE__ */ jsx5(
@@ -10684,12 +10657,12 @@ var ModelNexProvider = ({
10684
10657
  children,
10685
10658
  websiteId,
10686
10659
  userProfile,
10660
+ toursApiBase,
10687
10661
  devMode
10688
10662
  }) => {
10689
10663
  const serverUrl = DEFAULT_SERVER_URL2;
10690
10664
  const commandUrl = void 0;
10691
10665
  const disableSocket = false;
10692
- const toursApiBase = void 0;
10693
10666
  const renderedChildren = children;
10694
10667
  const [activeAgentActions, setActiveAgentActions] = useState15(/* @__PURE__ */ new Set());
10695
10668
  const [stagingFields, setStagingFields] = useState15(/* @__PURE__ */ new Set());
@@ -10780,12 +10753,13 @@ var ModelNexProvider = ({
10780
10753
  setChatMessages,
10781
10754
  websiteId,
10782
10755
  userProfile,
10756
+ toursApiBase,
10783
10757
  voiceMuted,
10784
10758
  setVoiceMuted,
10785
10759
  socketId,
10786
10760
  devMode
10787
10761
  }),
10788
- [serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile, voiceMuted, socketId, devMode]
10762
+ [serverUrl, commandUrl, registerAction, unregisterAction, activeAgentActions, stagingFields, highlightActions, studioMode, recordingMode, extractedElements, tagStore, chatMessages, websiteId, userProfile, toursApiBase, voiceMuted, socketId, devMode]
10789
10763
  );
10790
10764
  return React8.createElement(
10791
10765
  ModelNexContext.Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modelnex/sdk",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
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",