dsh-plugin-lookatstudy 0.12.2 → 0.12.3

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/lib/client.js CHANGED
@@ -2055,6 +2055,9 @@ window.__ModuleLoader__.load({
2055
2055
  * Tool results are skipped: the host conversation renders the rich
2056
2056
  * `tool.call.toolview` cards, and the tutor column stays a pure persona
2057
2057
  * surface (a transcript mirror there grew a second, diverging record).
2058
+ * Both inputs tolerate undefined: newer hosts (DSH v0.1.2-alpha.4) mount
2059
+ * the conversation view before session data exists, and the fold must
2060
+ * degrade to an empty transcript instead of blanking the whole tab.
2058
2061
  * @param nodes - finalized conversation nodes from the snapshot.
2059
2062
  * @param partial - the in-flight assistant partial, or null.
2060
2063
  * @param t - translator (defaults to the active one, per call).
@@ -2062,7 +2065,7 @@ window.__ModuleLoader__.load({
2062
2065
  */
2063
2066
  function transcriptRows(nodes, partial, t = tr) {
2064
2067
  const rows = [];
2065
- for (const node of nodes) switch (node.kind) {
2068
+ for (const node of nodes ?? []) switch (node.kind) {
2066
2069
  case "user":
2067
2070
  case "steering": {
2068
2071
  const text = textOf(node.content);
@@ -2088,7 +2091,7 @@ window.__ModuleLoader__.load({
2088
2091
  text: node.message
2089
2092
  });
2090
2093
  }
2091
- if (partial !== null) {
2094
+ if (partial != null) {
2092
2095
  const text = assistantText(partial.blocks);
2093
2096
  if (text !== "") rows.push({
2094
2097
  key: "streaming",
@@ -2234,7 +2237,7 @@ window.__ModuleLoader__.load({
2234
2237
  bindLessonSession,
2235
2238
  send,
2236
2239
  ctx,
2237
- currentSessionId: snapshot.sessionId
2240
+ currentSessionId: snapshot?.sessionId ?? ""
2238
2241
  }), (0, react.createElement)(TutorColumn, {
2239
2242
  data,
2240
2243
  setMode,
@@ -2517,7 +2520,7 @@ window.__ModuleLoader__.load({
2517
2520
  /** Middle column: the tutor — transcript, proposal banner, pills, starters. Typing happens in the native composer below the tab. */
2518
2521
  function TutorColumn({ data, setMode, send, snapshot }) {
2519
2522
  const [error, setError] = (0, react.useState)(null);
2520
- const rows = transcriptRows(snapshot.nodes, snapshot.partial);
2523
+ const rows = transcriptRows(snapshot?.nodes, snapshot?.partial ?? null);
2521
2524
  const lastAssistant = rows.reduce((acc, row, i) => row.role === "assistant" ? i : acc, -1);
2522
2525
  const scrollRef = (0, react.useRef)(null);
2523
2526
  (0, react.useEffect)(() => {
@@ -2667,7 +2670,7 @@ window.__ModuleLoader__.load({
2667
2670
  */
2668
2671
  function studyStartButton(ctx) {
2669
2672
  return function StudyStartButton({ session }) {
2670
- if (session.blank !== true) return null;
2673
+ if (session?.blank !== true) return null;
2671
2674
  return (0, react.createElement)(Inner, {
2672
2675
  key: "inner",
2673
2676
  ctx