sunpeak 0.20.34 → 0.20.35

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.
@@ -6732,6 +6732,7 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
6732
6732
  const [toolResultJson, setToolResultJson] = (0, react.useState)(() => JSON.stringify(toolResult ?? null, null, 2));
6733
6733
  const [modelContextJson, setModelContextJson] = (0, react.useState)("null");
6734
6734
  const [modelContext, setModelContext] = (0, react.useState)(null);
6735
+ const [modelAppContext, setModelAppContext] = (0, react.useState)(null);
6735
6736
  const [editingField, setEditingField] = (0, react.useState)(null);
6736
6737
  const [toolInputError, setToolInputError] = (0, react.useState)("");
6737
6738
  const [toolResultError, setToolResultError] = (0, react.useState)("");
@@ -6751,7 +6752,6 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
6751
6752
  setToolResultError("");
6752
6753
  }
6753
6754
  if (editingField !== "modelContext") {
6754
- setModelContextJson("null");
6755
6755
  setModelContext(null);
6756
6756
  setModelContextError("");
6757
6757
  }
@@ -6777,6 +6777,10 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
6777
6777
  };
6778
6778
  const handleUpdateModelContext = (content, structuredContent) => {
6779
6779
  setModelContextJson(JSON.stringify(structuredContent ?? content, null, 2));
6780
+ setModelAppContext(structuredContent === void 0 && content.length === 0 ? null : {
6781
+ content,
6782
+ ...structuredContent !== void 0 ? { structuredContent } : {}
6783
+ });
6780
6784
  };
6781
6785
  const validateJSON = (json, setJson, setError) => {
6782
6786
  setJson(json);
@@ -6858,6 +6862,8 @@ function useInspectorState({ simulations, defaultHost = "chatgpt", preserveToolD
6858
6862
  effectiveToolResult,
6859
6863
  modelContext,
6860
6864
  setModelContext,
6865
+ modelAppContext,
6866
+ setModelAppContext,
6861
6867
  toolInputJson,
6862
6868
  setToolInputJson,
6863
6869
  toolInputError,
@@ -8043,7 +8049,8 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
8043
8049
  provider: modelProvider,
8044
8050
  modelId,
8045
8051
  messages,
8046
- tools: modelCallableTools
8052
+ tools: modelCallableTools,
8053
+ appContext: state.modelAppContext ?? void 0
8047
8054
  });
8048
8055
  else {
8049
8056
  const endpoint = inspectorApiEndpoint("/__sunpeak/model-chat", inspectorApiBaseUrl);
@@ -8053,7 +8060,8 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
8053
8060
  body: JSON.stringify({
8054
8061
  provider: modelProvider,
8055
8062
  modelId,
8056
- messages
8063
+ messages,
8064
+ appContext: state.modelAppContext ?? void 0
8057
8065
  })
8058
8066
  });
8059
8067
  data = await readInspectorJson(res, endpoint);
@@ -9040,7 +9048,11 @@ function Inspector({ children, app, simulations: initialSimulationsProp = EMPTY_
9040
9048
  onChange: (json) => state.validateJSON(json, state.setModelContextJson, state.setModelContextError),
9041
9049
  onFocus: () => state.setEditingField("modelContext"),
9042
9050
  onBlur: () => state.commitJSON(state.modelContextJson, state.setModelContextError, (parsed) => {
9043
- state.setModelContext(parsed);
9051
+ state.setModelContext(parsed != null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null);
9052
+ state.setModelAppContext(parsed == null ? null : {
9053
+ content: [],
9054
+ structuredContent: parsed
9055
+ });
9044
9056
  }),
9045
9057
  error: state.modelContextError,
9046
9058
  maxRows: 8
@@ -9246,4 +9258,4 @@ Object.defineProperty(exports, "useThemeContext", {
9246
9258
  }
9247
9259
  });
9248
9260
 
9249
- //# sourceMappingURL=inspector-CJA_uM9g.cjs.map
9261
+ //# sourceMappingURL=inspector-DQ_vv1wj.cjs.map