@raisindb/client 0.4.5 → 0.4.7

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.
@@ -954,6 +954,28 @@ declare class AuthManager {
954
954
  * @param response - Authentication response from server
955
955
  */
956
956
  setTokens(response: AuthenticateResponse): void;
957
+ /**
958
+ * Learn a bare token's expiry FROM THE TOKEN.
959
+ *
960
+ * `setTokens` is the only other writer of `expiresAt`, and it needs a whole
961
+ * `AuthenticateResponse`. Several paths hold nothing but a JWT string — a
962
+ * session restored from storage, `authenticate({type:'jwt'})`,
963
+ * `setIdentityTokens(token)` — and left `expiresAt` null. `isTokenExpired()`
964
+ * reads null as EXPIRED, so `isAuthenticated()` answered false for the whole
965
+ * life of every restored session, i.e. every page load after the first.
966
+ *
967
+ * It failed silently, and it had already been routed around three times
968
+ * rather than fixed: both HTTP send paths were made to stop consulting
969
+ * `isAuthenticated()` (see `request()` and `mcpStream()` in http-client),
970
+ * and Studio grew its own token parse to tell a 404 apart from a logged-out
971
+ * read. This is the missing writer those workarounds existed for.
972
+ *
973
+ * Same 60s safety margin as `setTokens`, so both writers agree on when a
974
+ * token stops counting as good.
975
+ *
976
+ * @param token - A JWT held in storage or handed to us
977
+ */
978
+ adoptToken(token: string): void;
957
979
  /**
958
980
  * Get current access token
959
981
  */
@@ -4555,7 +4577,7 @@ interface ChatMessage {
4555
4577
  readAt?: string;
4556
4578
  }
4557
4579
  /** Conversation type discriminator */
4558
- type ConversationType = 'ai_chat' | 'direct_message';
4580
+ type ConversationType = 'ai_chat' | 'direct_message' | 'flow_chat';
4559
4581
  /**
4560
4582
  * Chat conversation handle.
4561
4583
  */
@@ -954,6 +954,28 @@ declare class AuthManager {
954
954
  * @param response - Authentication response from server
955
955
  */
956
956
  setTokens(response: AuthenticateResponse): void;
957
+ /**
958
+ * Learn a bare token's expiry FROM THE TOKEN.
959
+ *
960
+ * `setTokens` is the only other writer of `expiresAt`, and it needs a whole
961
+ * `AuthenticateResponse`. Several paths hold nothing but a JWT string — a
962
+ * session restored from storage, `authenticate({type:'jwt'})`,
963
+ * `setIdentityTokens(token)` — and left `expiresAt` null. `isTokenExpired()`
964
+ * reads null as EXPIRED, so `isAuthenticated()` answered false for the whole
965
+ * life of every restored session, i.e. every page load after the first.
966
+ *
967
+ * It failed silently, and it had already been routed around three times
968
+ * rather than fixed: both HTTP send paths were made to stop consulting
969
+ * `isAuthenticated()` (see `request()` and `mcpStream()` in http-client),
970
+ * and Studio grew its own token parse to tell a 404 apart from a logged-out
971
+ * read. This is the missing writer those workarounds existed for.
972
+ *
973
+ * Same 60s safety margin as `setTokens`, so both writers agree on when a
974
+ * token stops counting as good.
975
+ *
976
+ * @param token - A JWT held in storage or handed to us
977
+ */
978
+ adoptToken(token: string): void;
957
979
  /**
958
980
  * Get current access token
959
981
  */
@@ -4555,7 +4577,7 @@ interface ChatMessage {
4555
4577
  readAt?: string;
4556
4578
  }
4557
4579
  /** Conversation type discriminator */
4558
- type ConversationType = 'ai_chat' | 'direct_message';
4580
+ type ConversationType = 'ai_chat' | 'direct_message' | 'flow_chat';
4559
4581
  /**
4560
4582
  * Chat conversation handle.
4561
4583
  */
@@ -1,4 +1,4 @@
1
- import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CfK-DEYd.mjs';
1
+ import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CcsnbqWp.mjs';
2
2
 
3
3
  /**
4
4
  * React adapters for the RaisinDB conversation stores.
@@ -1,4 +1,4 @@
1
- import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CfK-DEYd.js';
1
+ import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CcsnbqWp.js';
2
2
 
3
3
  /**
4
4
  * React adapters for the RaisinDB conversation stores.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { l as PropertyValue, m as RelationRef, N as Node, H as HttpClientOptions, n as ClientOptions, o as Credentials, p as RaisinHttpClient, R as RaisinClient, q as RetryOptions, U as UploadErrorCode, B as BatchUpload, r as UploaderConfig, s as FileSource, t as BatchUploadOptions, u as BatchUploadResult, v as BatchProgress, w as ReconnectOptions } from './conversation-list-store-CfK-DEYd.mjs';
2
- export { cW as AiContainerConfig, cV as AiErrorBehavior, cU as AiToolMode, aa as Archetypes, aW as AuditLogEntry, aV as AuditQueryPayload, G as AuthEvent, A as AuthManager, c8 as AuthProviders, J as AuthStateChange, K as AuthStateChangeCallback, b9 as AuthenticatePayload, ba as AuthenticateResponse, bG as BatchFileProgress, ad as BranchDiff, ae as BranchDivergence, ac as Branches, bP as BrowserFileSource, cO as CanonicalTaskType, dn as ChatAssistantMessageEvent, dq as ChatCompletedEvent, dz as ChatConversationCreatedEvent, ds as ChatDoneEvent, dh as ChatEvent, dr as ChatFailedEvent, dC as ChatLogEvent, b as ChatMessage, dB as ChatMessageDeliveredEvent, dA as ChatMessageSavedEvent, cT as ChatStepConfig, cS as ChatTerminationConfig, cR as ChatTerminationMode, dm as ChatTextChunkEvent, dv as ChatThoughtChunkEvent, du as ChatToolCallCompletedEvent, dt as ChatToolCallStartedEvent, dp as ChatWaitingEvent, bC as ChunkUploadResponse, x as ClientMode, bE as CompleteUploadRequest, bF as CompleteUploadResponse, az as Connection, aA as ConnectionOptions, C as ConnectionState, c_ as ContainerRule, cI as ContainerType, di as Conversation, cD as ConversationCreatedEvent, d as ConversationListItem, h as ConversationListSnapshot, e as ConversationListStore, g as ConversationListStoreOptions, dD as ConversationManager, dL as ConversationManagerOptions, dk as ConversationStatus, c as ConversationStore, f as ConversationStoreOptions, a as ConversationStoreSnapshot, dI as ConversationSubscription, dj as ConversationType, dG as CreateConvoOptions, bA as CreateUploadRequest, bB as CreateUploadResponse, af as CrossBranchCopySummary, ag as CrossBranchNodeChange, y as CurrentUser, bO as DEFAULT_BATCH_CONCURRENCY, bN as DEFAULT_BRANCH, bI as DEFAULT_CHUNK_SIZE, bJ as DEFAULT_MAX_RETRIES, bM as DEFAULT_NODE_TYPE, bK as DEFAULT_RETRY_BASE_DELAY, bL as DEFAULT_RETRY_MAX_DELAY, dE as DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS, D as Database, Z as DatabaseHttpOptions, ab as ElementTypes, aK as ErrorInfo, ax as EventCallback, av as EventHandler, E as EventMessage, aw as EventSubscriptions, c$ as FanOutConfig, bX as FlowClient, F as FlowClientOptions, bZ as FlowCollectResult, cx as FlowCompletedEvent, d4 as FlowDefinition, d1 as FlowDefinitionContainer, d3 as FlowDefinitionNode, cX as FlowDefinitionNodeBase, cZ as FlowDefinitionStep, cK as FlowErrorStrategy, j as FlowExecutionEvent, cy as FlowFailedEvent, co as FlowInstanceStatus, cp as FlowInstanceStatusResponse, cq as FlowMetrics, cw as FlowResumedEvent, cn as FlowRunResponse, bY as FlowRunResult, cY as FlowStepProperties, cv as FlowWaitingEvent, i as FlowsApi, c9 as FunctionInvokeOptions, ca as FunctionInvokeResponse, cb as FunctionInvokeSyncResponse, b_ as FunctionsApi, cQ as HandoffTarget, aq as HttpArchetypes, V as HttpCurrentUser, O as HttpDatabase, ar as HttpElementTypes, b$ as HttpFunctionsApi, ap as HttpNodeTypes, W as HttpUserNode, Q as HttpWorkspaceClient, cN as HumanTaskType, c0 as IdentityAuthApi, aF as IdentityAuthError, aE as IdentityAuthResponse, c2 as IdentityAuthResult, c3 as IdentityAuthTransport, c4 as IdentityInfo, c5 as IdentityMe, I as IdentityUser, dd as InboxApi, de as InboxApiOptions, d5 as InboxTask, d6 as InboxTaskStatus, aM as IncomingRelation, dF as ListConversationsOptions, ak as ListInvocationsFilter, df as ListTasksOptions, dg as ListTasksResponse, aC as LocalStorageTokenStorage, cF as LogEvent, bo as LogLevel, bu as LoggerConfig, d2 as LoopConfig, c7 as MagicLinkOptions, c6 as MagicLinkSent, ci as McpCallToolResult, cc as McpClient, ch as McpContentBlock, ce as McpFrameStream, cf as McpJsonRpcFrame, ck as McpReadResourceResult, cj as McpResourceContents, cm as McpResourceSubscription, cl as McpResourceUpdate, cg as McpToolDescriptor, cd as McpTransport, aB as MemoryTokenStorage, d0 as MergeStrategy, dl as MessageBody, dx as MessageChild, cE as MessageSavedEvent, a4 as NodeCreateDeepOptions, aP as NodeCreateDeepPayload, a3 as NodeCreateOptions, aO as NodeCreatePayload, aR as NodeDeletePayload, ah as NodeDiffInfo, aI as NodeEventPayload, bQ as NodeFileSource, aS as NodeGetPayload, aT as NodeHistoryPayload, a2 as NodeOperations, a6 as NodeQueryOptions, aX as NodeQueryPayload, aN as NodeRelationships, a9 as NodeTypes, a5 as NodeUpdateOptions, aQ as NodeUpdatePayload, dK as PlanActionOptions, dJ as PlanActionReceipt, P as PlanProjection, k as PlanProjectionTask, dy as PlanTask, d8 as RETRY_STRATEGIES, cH as RaisinReference, bn as ReconnectManager, bb as RefreshTokenPayload, aY as RelationAddPayload, aZ as RelationRemovePayload, a_ as RelationsGetPayload, aJ as RequestContext, aG as RequestEnvelope, bh as RequestType, aH as ResponseEnvelope, aL as ResponseMetadata, bi as ResponseStatus, cL as RetryConfig, cM as RetryStrategy, aU as RevisionEntry, al as ScheduleInvocationOptions, am as ScheduledInvocation, an as ScheduledInvocationRef, ao as ScheduledInvocationTargetKind, aj as SchedulerApi, as as SchemaCommit, dH as SendMessageOptions, X as SignAssetOptions, Y as SignedAssetUrl, at as SqlQuery, a$ as SqlQueryPayload, b0 as SqlResult, cs as StepCompletedEvent, cJ as StepErrorBehavior, cu as StepFailedEvent, cr as StepStartedEvent, ct as StepUsage, b6 as SubscribePayload, ay as Subscription, S as SubscriptionFilters, b8 as SubscriptionResponse, ai as Tags, d7 as TaskCompletionResult, cP as TaskOption, cz as TextChunkEvent, cC as ThoughtChunkEvent, aD as TokenStorage, cB as ToolCallCompletedEvent, T as ToolCallInfo, dw as ToolCallRecord, cA as ToolCallStartedEvent, a7 as Transaction, bc as TransactionBeginPayload, bd as TransactionBeginResponse, be as TransactionCommitPayload, bf as TransactionCommitResponse, a8 as TransactionOptions, bg as TransactionRollbackPayload, b7 as UnsubscribePayload, bz as Upload, bH as UploadError, bW as UploadManager, bw as UploadOptions, bx as UploadProgress, by as UploadResult, bv as UploadStatus, bD as UploadStatusResponse, bV as Uploader, M as UserChangeCallback, L as UserChangeEvent, z as UserNode, b1 as Workspace, _ as WorkspaceClient, a0 as WorkspaceCreateOptions, b2 as WorkspaceCreatePayload, b4 as WorkspaceDeletePayload, b3 as WorkspaceGetPayload, $ as WorkspaceManager, a1 as WorkspaceUpdateOptions, b5 as WorkspaceUpdatePayload, bT as calculateChunkCount, bq as configureLogger, bR as createFileSource, au as createSqlHandler, bk as decodeMessage, bj as encodeMessage, bU as getChunkRange, bS as getContentType, bs as getLogLevel, bt as getLoggerConfig, d9 as getRefDisplayName, da as getRefPath, bl as isEventMessage, dc as isFlowDefinitionContainer, db as isFlowDefinitionStep, bm as isResponseEnvelope, cG as isTerminalEvent, bp as logger, dM as projectPlansFromMessages, c1 as readTokensFromFragment, br as setLogLevel } from './conversation-list-store-CfK-DEYd.mjs';
3
- export { F as FlowStatus, j as RaisinContextValue, i as RaisinProviderProps, g as RaisinReact, R as ReactLike, h as ReactLikeWithContext, k as UseAuthReturn, l as UseConnectionReturn, b as UseConversationListReturn, U as UseConversationReturn, d as UseFlowOptions, e as UseFlowReturn, m as UseSqlOptions, n as UseSqlReturn, o as UseSubscriptionOptions, f as createRaisinReact, u as useConversation, a as useConversationList, c as useFlow } from './index-D2Vw7FpW.mjs';
1
+ import { l as PropertyValue, m as RelationRef, N as Node, H as HttpClientOptions, n as ClientOptions, o as Credentials, p as RaisinHttpClient, R as RaisinClient, q as RetryOptions, U as UploadErrorCode, B as BatchUpload, r as UploaderConfig, s as FileSource, t as BatchUploadOptions, u as BatchUploadResult, v as BatchProgress, w as ReconnectOptions } from './conversation-list-store-CcsnbqWp.mjs';
2
+ export { cW as AiContainerConfig, cV as AiErrorBehavior, cU as AiToolMode, aa as Archetypes, aW as AuditLogEntry, aV as AuditQueryPayload, G as AuthEvent, A as AuthManager, c8 as AuthProviders, J as AuthStateChange, K as AuthStateChangeCallback, b9 as AuthenticatePayload, ba as AuthenticateResponse, bG as BatchFileProgress, ad as BranchDiff, ae as BranchDivergence, ac as Branches, bP as BrowserFileSource, cO as CanonicalTaskType, dn as ChatAssistantMessageEvent, dq as ChatCompletedEvent, dz as ChatConversationCreatedEvent, ds as ChatDoneEvent, dh as ChatEvent, dr as ChatFailedEvent, dC as ChatLogEvent, b as ChatMessage, dB as ChatMessageDeliveredEvent, dA as ChatMessageSavedEvent, cT as ChatStepConfig, cS as ChatTerminationConfig, cR as ChatTerminationMode, dm as ChatTextChunkEvent, dv as ChatThoughtChunkEvent, du as ChatToolCallCompletedEvent, dt as ChatToolCallStartedEvent, dp as ChatWaitingEvent, bC as ChunkUploadResponse, x as ClientMode, bE as CompleteUploadRequest, bF as CompleteUploadResponse, az as Connection, aA as ConnectionOptions, C as ConnectionState, c_ as ContainerRule, cI as ContainerType, di as Conversation, cD as ConversationCreatedEvent, d as ConversationListItem, h as ConversationListSnapshot, e as ConversationListStore, g as ConversationListStoreOptions, dD as ConversationManager, dL as ConversationManagerOptions, dk as ConversationStatus, c as ConversationStore, f as ConversationStoreOptions, a as ConversationStoreSnapshot, dI as ConversationSubscription, dj as ConversationType, dG as CreateConvoOptions, bA as CreateUploadRequest, bB as CreateUploadResponse, af as CrossBranchCopySummary, ag as CrossBranchNodeChange, y as CurrentUser, bO as DEFAULT_BATCH_CONCURRENCY, bN as DEFAULT_BRANCH, bI as DEFAULT_CHUNK_SIZE, bJ as DEFAULT_MAX_RETRIES, bM as DEFAULT_NODE_TYPE, bK as DEFAULT_RETRY_BASE_DELAY, bL as DEFAULT_RETRY_MAX_DELAY, dE as DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS, D as Database, Z as DatabaseHttpOptions, ab as ElementTypes, aK as ErrorInfo, ax as EventCallback, av as EventHandler, E as EventMessage, aw as EventSubscriptions, c$ as FanOutConfig, bX as FlowClient, F as FlowClientOptions, bZ as FlowCollectResult, cx as FlowCompletedEvent, d4 as FlowDefinition, d1 as FlowDefinitionContainer, d3 as FlowDefinitionNode, cX as FlowDefinitionNodeBase, cZ as FlowDefinitionStep, cK as FlowErrorStrategy, j as FlowExecutionEvent, cy as FlowFailedEvent, co as FlowInstanceStatus, cp as FlowInstanceStatusResponse, cq as FlowMetrics, cw as FlowResumedEvent, cn as FlowRunResponse, bY as FlowRunResult, cY as FlowStepProperties, cv as FlowWaitingEvent, i as FlowsApi, c9 as FunctionInvokeOptions, ca as FunctionInvokeResponse, cb as FunctionInvokeSyncResponse, b_ as FunctionsApi, cQ as HandoffTarget, aq as HttpArchetypes, V as HttpCurrentUser, O as HttpDatabase, ar as HttpElementTypes, b$ as HttpFunctionsApi, ap as HttpNodeTypes, W as HttpUserNode, Q as HttpWorkspaceClient, cN as HumanTaskType, c0 as IdentityAuthApi, aF as IdentityAuthError, aE as IdentityAuthResponse, c2 as IdentityAuthResult, c3 as IdentityAuthTransport, c4 as IdentityInfo, c5 as IdentityMe, I as IdentityUser, dd as InboxApi, de as InboxApiOptions, d5 as InboxTask, d6 as InboxTaskStatus, aM as IncomingRelation, dF as ListConversationsOptions, ak as ListInvocationsFilter, df as ListTasksOptions, dg as ListTasksResponse, aC as LocalStorageTokenStorage, cF as LogEvent, bo as LogLevel, bu as LoggerConfig, d2 as LoopConfig, c7 as MagicLinkOptions, c6 as MagicLinkSent, ci as McpCallToolResult, cc as McpClient, ch as McpContentBlock, ce as McpFrameStream, cf as McpJsonRpcFrame, ck as McpReadResourceResult, cj as McpResourceContents, cm as McpResourceSubscription, cl as McpResourceUpdate, cg as McpToolDescriptor, cd as McpTransport, aB as MemoryTokenStorage, d0 as MergeStrategy, dl as MessageBody, dx as MessageChild, cE as MessageSavedEvent, a4 as NodeCreateDeepOptions, aP as NodeCreateDeepPayload, a3 as NodeCreateOptions, aO as NodeCreatePayload, aR as NodeDeletePayload, ah as NodeDiffInfo, aI as NodeEventPayload, bQ as NodeFileSource, aS as NodeGetPayload, aT as NodeHistoryPayload, a2 as NodeOperations, a6 as NodeQueryOptions, aX as NodeQueryPayload, aN as NodeRelationships, a9 as NodeTypes, a5 as NodeUpdateOptions, aQ as NodeUpdatePayload, dK as PlanActionOptions, dJ as PlanActionReceipt, P as PlanProjection, k as PlanProjectionTask, dy as PlanTask, d8 as RETRY_STRATEGIES, cH as RaisinReference, bn as ReconnectManager, bb as RefreshTokenPayload, aY as RelationAddPayload, aZ as RelationRemovePayload, a_ as RelationsGetPayload, aJ as RequestContext, aG as RequestEnvelope, bh as RequestType, aH as ResponseEnvelope, aL as ResponseMetadata, bi as ResponseStatus, cL as RetryConfig, cM as RetryStrategy, aU as RevisionEntry, al as ScheduleInvocationOptions, am as ScheduledInvocation, an as ScheduledInvocationRef, ao as ScheduledInvocationTargetKind, aj as SchedulerApi, as as SchemaCommit, dH as SendMessageOptions, X as SignAssetOptions, Y as SignedAssetUrl, at as SqlQuery, a$ as SqlQueryPayload, b0 as SqlResult, cs as StepCompletedEvent, cJ as StepErrorBehavior, cu as StepFailedEvent, cr as StepStartedEvent, ct as StepUsage, b6 as SubscribePayload, ay as Subscription, S as SubscriptionFilters, b8 as SubscriptionResponse, ai as Tags, d7 as TaskCompletionResult, cP as TaskOption, cz as TextChunkEvent, cC as ThoughtChunkEvent, aD as TokenStorage, cB as ToolCallCompletedEvent, T as ToolCallInfo, dw as ToolCallRecord, cA as ToolCallStartedEvent, a7 as Transaction, bc as TransactionBeginPayload, bd as TransactionBeginResponse, be as TransactionCommitPayload, bf as TransactionCommitResponse, a8 as TransactionOptions, bg as TransactionRollbackPayload, b7 as UnsubscribePayload, bz as Upload, bH as UploadError, bW as UploadManager, bw as UploadOptions, bx as UploadProgress, by as UploadResult, bv as UploadStatus, bD as UploadStatusResponse, bV as Uploader, M as UserChangeCallback, L as UserChangeEvent, z as UserNode, b1 as Workspace, _ as WorkspaceClient, a0 as WorkspaceCreateOptions, b2 as WorkspaceCreatePayload, b4 as WorkspaceDeletePayload, b3 as WorkspaceGetPayload, $ as WorkspaceManager, a1 as WorkspaceUpdateOptions, b5 as WorkspaceUpdatePayload, bT as calculateChunkCount, bq as configureLogger, bR as createFileSource, au as createSqlHandler, bk as decodeMessage, bj as encodeMessage, bU as getChunkRange, bS as getContentType, bs as getLogLevel, bt as getLoggerConfig, d9 as getRefDisplayName, da as getRefPath, bl as isEventMessage, dc as isFlowDefinitionContainer, db as isFlowDefinitionStep, bm as isResponseEnvelope, cG as isTerminalEvent, bp as logger, dM as projectPlansFromMessages, c1 as readTokensFromFragment, br as setLogLevel } from './conversation-list-store-CcsnbqWp.mjs';
3
+ export { F as FlowStatus, j as RaisinContextValue, i as RaisinProviderProps, g as RaisinReact, R as ReactLike, h as ReactLikeWithContext, k as UseAuthReturn, l as UseConnectionReturn, b as UseConversationListReturn, U as UseConversationReturn, d as UseFlowOptions, e as UseFlowReturn, m as UseSqlOptions, n as UseSqlReturn, o as UseSubscriptionOptions, f as createRaisinReact, u as useConversation, a as useConversationList, c as useFlow } from './index-CafciIjp.mjs';
4
4
  export { AuthAdapter, AuthSnapshot, ConnectionAdapter, ConnectionSnapshot, FlowAdapter, FlowAdapterOptions, FlowSnapshot, RAISIN_CONTEXT_KEY, RaisinContext, SubscriptionAdapter, FlowStatus as SvelteFlowStatus, createAuthAdapter, createConnectionAdapter, createConversationAdapter, createConversationListAdapter, createFlowAdapter, createSubscriptionAdapter } from './svelte.mjs';
5
- export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-B_YbYl-Q.mjs';
5
+ export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-Car7CGb8.mjs';
6
6
  export { RaisinVue, VueComputedRef, VueLike, VueRef, createRaisinVue } from './vue.mjs';
7
7
  import 'events';
8
8
  import 'fs/promises';
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { l as PropertyValue, m as RelationRef, N as Node, H as HttpClientOptions, n as ClientOptions, o as Credentials, p as RaisinHttpClient, R as RaisinClient, q as RetryOptions, U as UploadErrorCode, B as BatchUpload, r as UploaderConfig, s as FileSource, t as BatchUploadOptions, u as BatchUploadResult, v as BatchProgress, w as ReconnectOptions } from './conversation-list-store-CfK-DEYd.js';
2
- export { cW as AiContainerConfig, cV as AiErrorBehavior, cU as AiToolMode, aa as Archetypes, aW as AuditLogEntry, aV as AuditQueryPayload, G as AuthEvent, A as AuthManager, c8 as AuthProviders, J as AuthStateChange, K as AuthStateChangeCallback, b9 as AuthenticatePayload, ba as AuthenticateResponse, bG as BatchFileProgress, ad as BranchDiff, ae as BranchDivergence, ac as Branches, bP as BrowserFileSource, cO as CanonicalTaskType, dn as ChatAssistantMessageEvent, dq as ChatCompletedEvent, dz as ChatConversationCreatedEvent, ds as ChatDoneEvent, dh as ChatEvent, dr as ChatFailedEvent, dC as ChatLogEvent, b as ChatMessage, dB as ChatMessageDeliveredEvent, dA as ChatMessageSavedEvent, cT as ChatStepConfig, cS as ChatTerminationConfig, cR as ChatTerminationMode, dm as ChatTextChunkEvent, dv as ChatThoughtChunkEvent, du as ChatToolCallCompletedEvent, dt as ChatToolCallStartedEvent, dp as ChatWaitingEvent, bC as ChunkUploadResponse, x as ClientMode, bE as CompleteUploadRequest, bF as CompleteUploadResponse, az as Connection, aA as ConnectionOptions, C as ConnectionState, c_ as ContainerRule, cI as ContainerType, di as Conversation, cD as ConversationCreatedEvent, d as ConversationListItem, h as ConversationListSnapshot, e as ConversationListStore, g as ConversationListStoreOptions, dD as ConversationManager, dL as ConversationManagerOptions, dk as ConversationStatus, c as ConversationStore, f as ConversationStoreOptions, a as ConversationStoreSnapshot, dI as ConversationSubscription, dj as ConversationType, dG as CreateConvoOptions, bA as CreateUploadRequest, bB as CreateUploadResponse, af as CrossBranchCopySummary, ag as CrossBranchNodeChange, y as CurrentUser, bO as DEFAULT_BATCH_CONCURRENCY, bN as DEFAULT_BRANCH, bI as DEFAULT_CHUNK_SIZE, bJ as DEFAULT_MAX_RETRIES, bM as DEFAULT_NODE_TYPE, bK as DEFAULT_RETRY_BASE_DELAY, bL as DEFAULT_RETRY_MAX_DELAY, dE as DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS, D as Database, Z as DatabaseHttpOptions, ab as ElementTypes, aK as ErrorInfo, ax as EventCallback, av as EventHandler, E as EventMessage, aw as EventSubscriptions, c$ as FanOutConfig, bX as FlowClient, F as FlowClientOptions, bZ as FlowCollectResult, cx as FlowCompletedEvent, d4 as FlowDefinition, d1 as FlowDefinitionContainer, d3 as FlowDefinitionNode, cX as FlowDefinitionNodeBase, cZ as FlowDefinitionStep, cK as FlowErrorStrategy, j as FlowExecutionEvent, cy as FlowFailedEvent, co as FlowInstanceStatus, cp as FlowInstanceStatusResponse, cq as FlowMetrics, cw as FlowResumedEvent, cn as FlowRunResponse, bY as FlowRunResult, cY as FlowStepProperties, cv as FlowWaitingEvent, i as FlowsApi, c9 as FunctionInvokeOptions, ca as FunctionInvokeResponse, cb as FunctionInvokeSyncResponse, b_ as FunctionsApi, cQ as HandoffTarget, aq as HttpArchetypes, V as HttpCurrentUser, O as HttpDatabase, ar as HttpElementTypes, b$ as HttpFunctionsApi, ap as HttpNodeTypes, W as HttpUserNode, Q as HttpWorkspaceClient, cN as HumanTaskType, c0 as IdentityAuthApi, aF as IdentityAuthError, aE as IdentityAuthResponse, c2 as IdentityAuthResult, c3 as IdentityAuthTransport, c4 as IdentityInfo, c5 as IdentityMe, I as IdentityUser, dd as InboxApi, de as InboxApiOptions, d5 as InboxTask, d6 as InboxTaskStatus, aM as IncomingRelation, dF as ListConversationsOptions, ak as ListInvocationsFilter, df as ListTasksOptions, dg as ListTasksResponse, aC as LocalStorageTokenStorage, cF as LogEvent, bo as LogLevel, bu as LoggerConfig, d2 as LoopConfig, c7 as MagicLinkOptions, c6 as MagicLinkSent, ci as McpCallToolResult, cc as McpClient, ch as McpContentBlock, ce as McpFrameStream, cf as McpJsonRpcFrame, ck as McpReadResourceResult, cj as McpResourceContents, cm as McpResourceSubscription, cl as McpResourceUpdate, cg as McpToolDescriptor, cd as McpTransport, aB as MemoryTokenStorage, d0 as MergeStrategy, dl as MessageBody, dx as MessageChild, cE as MessageSavedEvent, a4 as NodeCreateDeepOptions, aP as NodeCreateDeepPayload, a3 as NodeCreateOptions, aO as NodeCreatePayload, aR as NodeDeletePayload, ah as NodeDiffInfo, aI as NodeEventPayload, bQ as NodeFileSource, aS as NodeGetPayload, aT as NodeHistoryPayload, a2 as NodeOperations, a6 as NodeQueryOptions, aX as NodeQueryPayload, aN as NodeRelationships, a9 as NodeTypes, a5 as NodeUpdateOptions, aQ as NodeUpdatePayload, dK as PlanActionOptions, dJ as PlanActionReceipt, P as PlanProjection, k as PlanProjectionTask, dy as PlanTask, d8 as RETRY_STRATEGIES, cH as RaisinReference, bn as ReconnectManager, bb as RefreshTokenPayload, aY as RelationAddPayload, aZ as RelationRemovePayload, a_ as RelationsGetPayload, aJ as RequestContext, aG as RequestEnvelope, bh as RequestType, aH as ResponseEnvelope, aL as ResponseMetadata, bi as ResponseStatus, cL as RetryConfig, cM as RetryStrategy, aU as RevisionEntry, al as ScheduleInvocationOptions, am as ScheduledInvocation, an as ScheduledInvocationRef, ao as ScheduledInvocationTargetKind, aj as SchedulerApi, as as SchemaCommit, dH as SendMessageOptions, X as SignAssetOptions, Y as SignedAssetUrl, at as SqlQuery, a$ as SqlQueryPayload, b0 as SqlResult, cs as StepCompletedEvent, cJ as StepErrorBehavior, cu as StepFailedEvent, cr as StepStartedEvent, ct as StepUsage, b6 as SubscribePayload, ay as Subscription, S as SubscriptionFilters, b8 as SubscriptionResponse, ai as Tags, d7 as TaskCompletionResult, cP as TaskOption, cz as TextChunkEvent, cC as ThoughtChunkEvent, aD as TokenStorage, cB as ToolCallCompletedEvent, T as ToolCallInfo, dw as ToolCallRecord, cA as ToolCallStartedEvent, a7 as Transaction, bc as TransactionBeginPayload, bd as TransactionBeginResponse, be as TransactionCommitPayload, bf as TransactionCommitResponse, a8 as TransactionOptions, bg as TransactionRollbackPayload, b7 as UnsubscribePayload, bz as Upload, bH as UploadError, bW as UploadManager, bw as UploadOptions, bx as UploadProgress, by as UploadResult, bv as UploadStatus, bD as UploadStatusResponse, bV as Uploader, M as UserChangeCallback, L as UserChangeEvent, z as UserNode, b1 as Workspace, _ as WorkspaceClient, a0 as WorkspaceCreateOptions, b2 as WorkspaceCreatePayload, b4 as WorkspaceDeletePayload, b3 as WorkspaceGetPayload, $ as WorkspaceManager, a1 as WorkspaceUpdateOptions, b5 as WorkspaceUpdatePayload, bT as calculateChunkCount, bq as configureLogger, bR as createFileSource, au as createSqlHandler, bk as decodeMessage, bj as encodeMessage, bU as getChunkRange, bS as getContentType, bs as getLogLevel, bt as getLoggerConfig, d9 as getRefDisplayName, da as getRefPath, bl as isEventMessage, dc as isFlowDefinitionContainer, db as isFlowDefinitionStep, bm as isResponseEnvelope, cG as isTerminalEvent, bp as logger, dM as projectPlansFromMessages, c1 as readTokensFromFragment, br as setLogLevel } from './conversation-list-store-CfK-DEYd.js';
3
- export { F as FlowStatus, j as RaisinContextValue, i as RaisinProviderProps, g as RaisinReact, R as ReactLike, h as ReactLikeWithContext, k as UseAuthReturn, l as UseConnectionReturn, b as UseConversationListReturn, U as UseConversationReturn, d as UseFlowOptions, e as UseFlowReturn, m as UseSqlOptions, n as UseSqlReturn, o as UseSubscriptionOptions, f as createRaisinReact, u as useConversation, a as useConversationList, c as useFlow } from './index-BfP-1PoU.js';
1
+ import { l as PropertyValue, m as RelationRef, N as Node, H as HttpClientOptions, n as ClientOptions, o as Credentials, p as RaisinHttpClient, R as RaisinClient, q as RetryOptions, U as UploadErrorCode, B as BatchUpload, r as UploaderConfig, s as FileSource, t as BatchUploadOptions, u as BatchUploadResult, v as BatchProgress, w as ReconnectOptions } from './conversation-list-store-CcsnbqWp.js';
2
+ export { cW as AiContainerConfig, cV as AiErrorBehavior, cU as AiToolMode, aa as Archetypes, aW as AuditLogEntry, aV as AuditQueryPayload, G as AuthEvent, A as AuthManager, c8 as AuthProviders, J as AuthStateChange, K as AuthStateChangeCallback, b9 as AuthenticatePayload, ba as AuthenticateResponse, bG as BatchFileProgress, ad as BranchDiff, ae as BranchDivergence, ac as Branches, bP as BrowserFileSource, cO as CanonicalTaskType, dn as ChatAssistantMessageEvent, dq as ChatCompletedEvent, dz as ChatConversationCreatedEvent, ds as ChatDoneEvent, dh as ChatEvent, dr as ChatFailedEvent, dC as ChatLogEvent, b as ChatMessage, dB as ChatMessageDeliveredEvent, dA as ChatMessageSavedEvent, cT as ChatStepConfig, cS as ChatTerminationConfig, cR as ChatTerminationMode, dm as ChatTextChunkEvent, dv as ChatThoughtChunkEvent, du as ChatToolCallCompletedEvent, dt as ChatToolCallStartedEvent, dp as ChatWaitingEvent, bC as ChunkUploadResponse, x as ClientMode, bE as CompleteUploadRequest, bF as CompleteUploadResponse, az as Connection, aA as ConnectionOptions, C as ConnectionState, c_ as ContainerRule, cI as ContainerType, di as Conversation, cD as ConversationCreatedEvent, d as ConversationListItem, h as ConversationListSnapshot, e as ConversationListStore, g as ConversationListStoreOptions, dD as ConversationManager, dL as ConversationManagerOptions, dk as ConversationStatus, c as ConversationStore, f as ConversationStoreOptions, a as ConversationStoreSnapshot, dI as ConversationSubscription, dj as ConversationType, dG as CreateConvoOptions, bA as CreateUploadRequest, bB as CreateUploadResponse, af as CrossBranchCopySummary, ag as CrossBranchNodeChange, y as CurrentUser, bO as DEFAULT_BATCH_CONCURRENCY, bN as DEFAULT_BRANCH, bI as DEFAULT_CHUNK_SIZE, bJ as DEFAULT_MAX_RETRIES, bM as DEFAULT_NODE_TYPE, bK as DEFAULT_RETRY_BASE_DELAY, bL as DEFAULT_RETRY_MAX_DELAY, dE as DEFAULT_SEND_MESSAGE_INACTIVITY_TIMEOUT_MS, D as Database, Z as DatabaseHttpOptions, ab as ElementTypes, aK as ErrorInfo, ax as EventCallback, av as EventHandler, E as EventMessage, aw as EventSubscriptions, c$ as FanOutConfig, bX as FlowClient, F as FlowClientOptions, bZ as FlowCollectResult, cx as FlowCompletedEvent, d4 as FlowDefinition, d1 as FlowDefinitionContainer, d3 as FlowDefinitionNode, cX as FlowDefinitionNodeBase, cZ as FlowDefinitionStep, cK as FlowErrorStrategy, j as FlowExecutionEvent, cy as FlowFailedEvent, co as FlowInstanceStatus, cp as FlowInstanceStatusResponse, cq as FlowMetrics, cw as FlowResumedEvent, cn as FlowRunResponse, bY as FlowRunResult, cY as FlowStepProperties, cv as FlowWaitingEvent, i as FlowsApi, c9 as FunctionInvokeOptions, ca as FunctionInvokeResponse, cb as FunctionInvokeSyncResponse, b_ as FunctionsApi, cQ as HandoffTarget, aq as HttpArchetypes, V as HttpCurrentUser, O as HttpDatabase, ar as HttpElementTypes, b$ as HttpFunctionsApi, ap as HttpNodeTypes, W as HttpUserNode, Q as HttpWorkspaceClient, cN as HumanTaskType, c0 as IdentityAuthApi, aF as IdentityAuthError, aE as IdentityAuthResponse, c2 as IdentityAuthResult, c3 as IdentityAuthTransport, c4 as IdentityInfo, c5 as IdentityMe, I as IdentityUser, dd as InboxApi, de as InboxApiOptions, d5 as InboxTask, d6 as InboxTaskStatus, aM as IncomingRelation, dF as ListConversationsOptions, ak as ListInvocationsFilter, df as ListTasksOptions, dg as ListTasksResponse, aC as LocalStorageTokenStorage, cF as LogEvent, bo as LogLevel, bu as LoggerConfig, d2 as LoopConfig, c7 as MagicLinkOptions, c6 as MagicLinkSent, ci as McpCallToolResult, cc as McpClient, ch as McpContentBlock, ce as McpFrameStream, cf as McpJsonRpcFrame, ck as McpReadResourceResult, cj as McpResourceContents, cm as McpResourceSubscription, cl as McpResourceUpdate, cg as McpToolDescriptor, cd as McpTransport, aB as MemoryTokenStorage, d0 as MergeStrategy, dl as MessageBody, dx as MessageChild, cE as MessageSavedEvent, a4 as NodeCreateDeepOptions, aP as NodeCreateDeepPayload, a3 as NodeCreateOptions, aO as NodeCreatePayload, aR as NodeDeletePayload, ah as NodeDiffInfo, aI as NodeEventPayload, bQ as NodeFileSource, aS as NodeGetPayload, aT as NodeHistoryPayload, a2 as NodeOperations, a6 as NodeQueryOptions, aX as NodeQueryPayload, aN as NodeRelationships, a9 as NodeTypes, a5 as NodeUpdateOptions, aQ as NodeUpdatePayload, dK as PlanActionOptions, dJ as PlanActionReceipt, P as PlanProjection, k as PlanProjectionTask, dy as PlanTask, d8 as RETRY_STRATEGIES, cH as RaisinReference, bn as ReconnectManager, bb as RefreshTokenPayload, aY as RelationAddPayload, aZ as RelationRemovePayload, a_ as RelationsGetPayload, aJ as RequestContext, aG as RequestEnvelope, bh as RequestType, aH as ResponseEnvelope, aL as ResponseMetadata, bi as ResponseStatus, cL as RetryConfig, cM as RetryStrategy, aU as RevisionEntry, al as ScheduleInvocationOptions, am as ScheduledInvocation, an as ScheduledInvocationRef, ao as ScheduledInvocationTargetKind, aj as SchedulerApi, as as SchemaCommit, dH as SendMessageOptions, X as SignAssetOptions, Y as SignedAssetUrl, at as SqlQuery, a$ as SqlQueryPayload, b0 as SqlResult, cs as StepCompletedEvent, cJ as StepErrorBehavior, cu as StepFailedEvent, cr as StepStartedEvent, ct as StepUsage, b6 as SubscribePayload, ay as Subscription, S as SubscriptionFilters, b8 as SubscriptionResponse, ai as Tags, d7 as TaskCompletionResult, cP as TaskOption, cz as TextChunkEvent, cC as ThoughtChunkEvent, aD as TokenStorage, cB as ToolCallCompletedEvent, T as ToolCallInfo, dw as ToolCallRecord, cA as ToolCallStartedEvent, a7 as Transaction, bc as TransactionBeginPayload, bd as TransactionBeginResponse, be as TransactionCommitPayload, bf as TransactionCommitResponse, a8 as TransactionOptions, bg as TransactionRollbackPayload, b7 as UnsubscribePayload, bz as Upload, bH as UploadError, bW as UploadManager, bw as UploadOptions, bx as UploadProgress, by as UploadResult, bv as UploadStatus, bD as UploadStatusResponse, bV as Uploader, M as UserChangeCallback, L as UserChangeEvent, z as UserNode, b1 as Workspace, _ as WorkspaceClient, a0 as WorkspaceCreateOptions, b2 as WorkspaceCreatePayload, b4 as WorkspaceDeletePayload, b3 as WorkspaceGetPayload, $ as WorkspaceManager, a1 as WorkspaceUpdateOptions, b5 as WorkspaceUpdatePayload, bT as calculateChunkCount, bq as configureLogger, bR as createFileSource, au as createSqlHandler, bk as decodeMessage, bj as encodeMessage, bU as getChunkRange, bS as getContentType, bs as getLogLevel, bt as getLoggerConfig, d9 as getRefDisplayName, da as getRefPath, bl as isEventMessage, dc as isFlowDefinitionContainer, db as isFlowDefinitionStep, bm as isResponseEnvelope, cG as isTerminalEvent, bp as logger, dM as projectPlansFromMessages, c1 as readTokensFromFragment, br as setLogLevel } from './conversation-list-store-CcsnbqWp.js';
3
+ export { F as FlowStatus, j as RaisinContextValue, i as RaisinProviderProps, g as RaisinReact, R as ReactLike, h as ReactLikeWithContext, k as UseAuthReturn, l as UseConnectionReturn, b as UseConversationListReturn, U as UseConversationReturn, d as UseFlowOptions, e as UseFlowReturn, m as UseSqlOptions, n as UseSqlReturn, o as UseSubscriptionOptions, f as createRaisinReact, u as useConversation, a as useConversationList, c as useFlow } from './index-CrfRIFc7.js';
4
4
  export { AuthAdapter, AuthSnapshot, ConnectionAdapter, ConnectionSnapshot, FlowAdapter, FlowAdapterOptions, FlowSnapshot, RAISIN_CONTEXT_KEY, RaisinContext, SubscriptionAdapter, FlowStatus as SvelteFlowStatus, createAuthAdapter, createConnectionAdapter, createConversationAdapter, createConversationListAdapter, createFlowAdapter, createSubscriptionAdapter } from './svelte.js';
5
- export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-Cg1Jo0Fs.js';
5
+ export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-BI1jVnoo.js';
6
6
  export { RaisinVue, VueComputedRef, VueLike, VueRef, createRaisinVue } from './vue.js';
7
7
  import 'events';
8
8
  import 'fs/promises';
package/dist/index.js CHANGED
@@ -701,7 +701,7 @@ var LocalStorageTokenStorage = class {
701
701
  function isJwtCredentials(credentials) {
702
702
  return "type" in credentials && credentials.type === "jwt";
703
703
  }
704
- var AuthManager = class {
704
+ var AuthManager = class _AuthManager {
705
705
  constructor(storage) {
706
706
  this.expiresAt = null;
707
707
  this._storage = storage ?? new MemoryTokenStorage();
@@ -724,6 +724,31 @@ var AuthManager = class {
724
724
  this.expiresAt = Date.now() + expiresInMs;
725
725
  this.scheduleTokenRefresh(expiresInMs);
726
726
  }
727
+ /**
728
+ * Learn a bare token's expiry FROM THE TOKEN.
729
+ *
730
+ * `setTokens` is the only other writer of `expiresAt`, and it needs a whole
731
+ * `AuthenticateResponse`. Several paths hold nothing but a JWT string — a
732
+ * session restored from storage, `authenticate({type:'jwt'})`,
733
+ * `setIdentityTokens(token)` — and left `expiresAt` null. `isTokenExpired()`
734
+ * reads null as EXPIRED, so `isAuthenticated()` answered false for the whole
735
+ * life of every restored session, i.e. every page load after the first.
736
+ *
737
+ * It failed silently, and it had already been routed around three times
738
+ * rather than fixed: both HTTP send paths were made to stop consulting
739
+ * `isAuthenticated()` (see `request()` and `mcpStream()` in http-client),
740
+ * and Studio grew its own token parse to tell a 404 apart from a logged-out
741
+ * read. This is the missing writer those workarounds existed for.
742
+ *
743
+ * Same 60s safety margin as `setTokens`, so both writers agree on when a
744
+ * token stops counting as good.
745
+ *
746
+ * @param token - A JWT held in storage or handed to us
747
+ */
748
+ adoptToken(token) {
749
+ const exp = _AuthManager.parseToken(token)?.exp;
750
+ this.expiresAt = typeof exp === "number" ? exp * 1e3 - 6e4 : null;
751
+ }
727
752
  /**
728
753
  * Get current access token
729
754
  */
@@ -4224,9 +4249,18 @@ var ConversationManager = class {
4224
4249
  async createUserMessage(conversationPath, content) {
4225
4250
  logger.debug("[ConversationManager] Creating user message", { path: conversationPath });
4226
4251
  const workspace = "raisin:access_control";
4252
+ const properties = await this.loadConversationProperties(conversationPath, workspace);
4253
+ const flowInstanceId = typeof properties?.flow_instance_id === "string" ? properties.flow_instance_id.trim() : "";
4254
+ if (flowInstanceId) {
4255
+ await this.httpRequest({
4256
+ method: "POST",
4257
+ path: `/api/flows/${this.repository}/instances/${encodeURIComponent(flowInstanceId)}/resume`,
4258
+ body: { resume_data: { message: content } }
4259
+ });
4260
+ return;
4261
+ }
4227
4262
  const { userId, userHome } = await this.ensureCurrentUser();
4228
4263
  const messageId = crypto.randomUUID();
4229
- const properties = await this.loadConversationProperties(conversationPath, workspace);
4230
4264
  const participants = Array.isArray(properties?.participants) ? properties.participants : [];
4231
4265
  let recipientId = participants.find(
4232
4266
  (p) => typeof p === "string" && p.length > 0 && p !== userId && p !== userHome
@@ -7169,6 +7203,7 @@ var RaisinHttpClient = class extends import_events3.EventEmitter {
7169
7203
  async authenticate(credentials, repository) {
7170
7204
  if (isJwtCredentials(credentials)) {
7171
7205
  this.authManager.storage.setAccessToken(credentials.token);
7206
+ this.authManager.adoptToken(credentials.token);
7172
7207
  if (repository) {
7173
7208
  try {
7174
7209
  const userInfo = await this.fetchCurrentUser(repository);
@@ -7575,6 +7610,7 @@ var RaisinHttpClient = class extends import_events3.EventEmitter {
7575
7610
  setIdentityTokens(accessTokenOrResult, refreshToken) {
7576
7611
  if (typeof accessTokenOrResult === "string") {
7577
7612
  this.authManager.storage.setAccessToken(accessTokenOrResult);
7613
+ this.authManager.adoptToken(accessTokenOrResult);
7578
7614
  if (refreshToken) this.authManager.storage.setRefreshToken(refreshToken);
7579
7615
  return;
7580
7616
  }
@@ -8695,6 +8731,7 @@ var _RaisinClient = class _RaisinClient extends import_events4.EventEmitter {
8695
8731
  async authenticate(credentials) {
8696
8732
  if (isJwtCredentials(credentials)) {
8697
8733
  logger.info("[authenticate] Starting JWT authentication...");
8734
+ this.authManager.adoptToken(credentials.token);
8698
8735
  const payload = { token: credentials.token };
8699
8736
  const response = await this.sendRequestInternal(
8700
8737
  payload,
@@ -9189,7 +9226,13 @@ var _RaisinClient = class _RaisinClient extends import_events4.EventEmitter {
9189
9226
  logger.debug(`[scheduleAutoRefresh] Scheduling refresh in ${Math.round(clamped / 1e3 / 60)} minutes`);
9190
9227
  this._refreshTimer = setTimeout(async () => {
9191
9228
  logger.info("[autoRefresh] Auto-refreshing token...");
9192
- await this.refreshToken();
9229
+ const user = await this.refreshToken();
9230
+ if (!user) {
9231
+ logger.error("[autoRefresh] Refresh failed, clearing session");
9232
+ this.authManager.clear();
9233
+ this._currentUser = null;
9234
+ this._emitAuthEvent("SESSION_EXPIRED");
9235
+ }
9193
9236
  }, clamped);
9194
9237
  }
9195
9238
  /**