@athenaintel/react 0.10.41-rc.1 → 0.10.41-rc.2

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
@@ -23,6 +23,7 @@ import { fromThreadMessageLike, bindExternalStoreMessage, getExternalStoreMessag
23
23
  import * as React from "react";
24
24
  import React__default, { useMemo, useState, useRef, useEffect, useContext, createContext, useCallback, useLayoutEffect, useReducer, useDebugValue, forwardRef, createRef, memo, createElement, version as version$1, useImperativeHandle } from "react";
25
25
  import { A as AthenaAuthContext } from "./AthenaAuthContext-DQsdayH2.js";
26
+ import { LocalStorageSession } from "@assistant-ui/react-statewire/local-storage";
26
27
  import { resource, withKey } from "@assistant-ui/tap";
27
28
  import { StatewireSendError, StatewireSSE, StatewireWS } from "statewire";
28
29
  import "@assistant-ui/core";
@@ -10837,6 +10838,7 @@ function useDeepAgentThread({
10837
10838
  sse = false,
10838
10839
  headers,
10839
10840
  sessionStore,
10841
+ storage,
10840
10842
  isNewChat = false,
10841
10843
  attachKey,
10842
10844
  suspended = false,
@@ -11004,6 +11006,9 @@ function useDeepAgentThread({
11004
11006
  );
11005
11007
  })()
11006
11008
  ),
11009
+ // Survives the transport remounts above: a bumped attachKey re-attaches the
11010
+ // same lane, and a persistent session storage carries it across reloads.
11011
+ ...storage && { storage },
11007
11012
  // The run subsystem (status, lanes, input requests, runId) is mounted on
11008
11013
  // the state root and always replicated by react-statewire >= 0.14 (the
11009
11014
  // former `runs: true` opt-in is gone) — the converter only maps app-owned
@@ -11241,6 +11246,7 @@ function useAthenaStatewireRuntime(config2) {
11241
11246
  const clientTools = useStatewireClientTools(frontendToolkit);
11242
11247
  const clientToolsRef = useRef(clientTools);
11243
11248
  clientToolsRef.current = clientTools;
11249
+ const [canPersistSession] = useState(() => typeof localStorage !== "undefined");
11244
11250
  const thread = useDeepAgentThread({
11245
11251
  threadId,
11246
11252
  baseUrl: syncUrl,
@@ -11258,6 +11264,17 @@ function useAthenaStatewireRuntime(config2) {
11258
11264
  // Queued entries render in the SDK's queue panel, so only the steer lane
11259
11265
  // projects into the message tail.
11260
11266
  laneProjection: "steer-only",
11267
+ // Durable session: a reload resumes the lane and resends whatever the
11268
+ // server has not marked durable. Scoped by host — a thread id is only
11269
+ // meaningful against the backend that minted it.
11270
+ ...canPersistSession && {
11271
+ storage: {
11272
+ session: LocalStorageSession({
11273
+ threadId,
11274
+ key: (id) => `${syncUrl}:${id}`
11275
+ })
11276
+ }
11277
+ },
11261
11278
  capabilities: { edit: true, reload: true, continue: true },
11262
11279
  onConnectionChange,
11263
11280
  onRawConnectionChange,