@astralbeam/sdk 0.15.2 → 0.17.0

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.
@@ -1,4 +1,4 @@
1
- import { f as CurrentUser } from "./api-DUe8JSVU.js";
1
+ import { H as CurrentUser, kt as UploadedChatFile } from "./index-CfGnT6Od.js";
2
2
 
3
3
  //#region node_modules/.deno/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
4
4
  /** The Standard Typed interface. This is a base type extended by other specs. */
@@ -117,7 +117,7 @@ declare namespace StandardJSONSchemaV1 {
117
117
  type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
118
118
  }
119
119
  //#endregion
120
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts
120
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts
121
121
  interface InterruptCorrelation {
122
122
  threadId: string;
123
123
  interruptedRunId: string;
@@ -198,7 +198,7 @@ declare global {
198
198
  var __TANSTACK_EVENT_TARGET__: EventTarget | null;
199
199
  }
200
200
  //#endregion
201
- //#region node_modules/.deno/@tanstack+ai-event-client@0.13.0/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts
201
+ //#region node_modules/.deno/@tanstack+ai-event-client@0.13.1/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts
202
202
  type AIDevtoolsEventSource = 'client' | 'server' | 'devtools';
203
203
  type AIDevtoolsEventVisibility = 'user-visible' | 'client-state' | 'server-internal' | 'devtools-action';
204
204
  interface AIDevtoolsEventEnvelope {
@@ -224,7 +224,7 @@ declare global {
224
224
  var __TANSTACK_AI_DEVTOOLS_RUNTIME_ID__: string | undefined;
225
225
  }
226
226
  //#endregion
227
- //#region node_modules/.deno/@tanstack+ai-event-client@0.13.0/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts
227
+ //#region node_modules/.deno/@tanstack+ai-event-client@0.13.1/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts
228
228
  /**
229
229
  * Detailed breakdown of prompt/input token usage.
230
230
  * Fields are populated based on provider support.
@@ -2838,11 +2838,11 @@ type SubagentInfo = {
2838
2838
  * pick one.
2839
2839
  */
2840
2840
  //#endregion
2841
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts
2841
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts
2842
2842
  /** TokenUsage fields that have no AG-UI `usage[]` equivalent. */
2843
2843
  type TokenUsageLeftover = Omit<TokenUsage$1, 'promptTokens' | 'completionTokens' | 'totalTokens'>;
2844
2844
  //#endregion
2845
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/types.d.ts
2845
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/types.d.ts
2846
2846
  /**
2847
2847
  * Tool call states - track the lifecycle of a tool call
2848
2848
  */
@@ -2978,9 +2978,15 @@ interface ModelMessage<TContent extends string | null | Array<ContentPart> = str
2978
2978
  name?: string;
2979
2979
  toolCalls?: Array<ToolCall>;
2980
2980
  toolCallId?: string;
2981
+ /**
2982
+ * Signed thinking to send back to the provider. `redacted: true` marks a
2983
+ * block the provider encrypted: `content` is empty and `signature` holds its
2984
+ * opaque data. See `ThinkingPart.signature` for the planned rename.
2985
+ */
2981
2986
  thinking?: Array<{
2982
2987
  content: string;
2983
2988
  signature?: string;
2989
+ redacted?: boolean;
2984
2990
  }>;
2985
2991
  /** Error reported by an AG-UI tool message. */
2986
2992
  error?: string;
@@ -3061,7 +3067,28 @@ interface ThinkingPart$1 {
3061
3067
  type: 'thinking';
3062
3068
  content: string;
3063
3069
  stepId?: string;
3070
+ /**
3071
+ * The provider's opaque reasoning artefact, sent back unchanged: an
3072
+ * Anthropic signature, Anthropic redacted data, or OpenAI encrypted content.
3073
+ * TODO(#1581): rename to `encryptedValue` to match AG-UI's `ReasoningMessage`.
3074
+ * Renaming breaks stored messages, so it needs a read shim for `signature`.
3075
+ */
3064
3076
  signature?: string;
3077
+ /**
3078
+ * The provider encrypted this thinking block (Anthropic `redacted_thinking`).
3079
+ * `content` is empty, and `signature` holds the opaque data that goes back
3080
+ * to the provider unchanged. On the AG-UI wire, the reasoning message id
3081
+ * starts with `redacted_thinking-` instead.
3082
+ */
3083
+ redacted?: boolean;
3084
+ }
3085
+ /**
3086
+ * Frontend-only AG-UI activity. Never converted into ModelMessage input.
3087
+ * Mirrors {@link https://docs.ag-ui.com/concepts/messages | ActivityMessage}:
3088
+ * `activityType` selects a renderer; `content` is the structured payload.
3089
+ */
3090
+ interface ActivityPart extends Pick<ActivityMessage, 'activityType' | 'content' | 'subagentRunId'> {
3091
+ type: 'activity';
3065
3092
  }
3066
3093
  /**
3067
3094
  * Recursive `Partial` — every nested field becomes optional. Used as the
@@ -3077,14 +3104,21 @@ type DeepPartial<T> = T extends ReadonlyArray<infer U> ? Array<DeepPartial<U>> :
3077
3104
  * consumers can thread `useChat({ outputSchema })`'s schema all the way down
3078
3105
  * to `messages[i].parts[j].data`. Defaults to `unknown` so untyped consumers
3079
3106
  * (e.g. internal codepaths that don't know about TSchema) keep working.
3080
- */
3081
- interface StructuredOutputPart<TData = unknown> {
3107
+ *
3108
+ * Discriminated on `status`: checking `status === 'complete'` narrows `data`
3109
+ * to `TData`.
3110
+ */
3111
+ type StructuredOutputPart<TData = unknown> = (StructuredOutputPartBase<TData> & {
3112
+ status: 'streaming' | 'error'; /** Not set until `status === 'complete'`. */
3113
+ data?: undefined;
3114
+ }) | (StructuredOutputPartBase<TData> & {
3115
+ status: 'complete'; /** Validated final object. */
3116
+ data: TData;
3117
+ });
3118
+ interface StructuredOutputPartBase<TData> {
3082
3119
  type: 'structured-output';
3083
- status: 'streaming' | 'complete' | 'error';
3084
3120
  /** Progressive parse of `raw` via parsePartialJSON — populated while streaming and after complete. */
3085
3121
  partial?: DeepPartial<TData>;
3086
- /** Validated final object — only set when `status === 'complete'`. */
3087
- data?: TData;
3088
3122
  /** Accumulating JSON buffer. Source of truth for wire round-trip. */
3089
3123
  raw: string;
3090
3124
  /** Optional chain-of-thought surfaced by reasoning models alongside the structured output. */
@@ -3135,7 +3169,7 @@ interface UIResourcePart {
3135
3169
  * Currently always `undefined` — nothing populates this field yet. */
3136
3170
  meta?: Record<string, unknown>;
3137
3171
  }
3138
- type MessagePart$1<TData = unknown> = TextPart$1 | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$2 | ToolResultPart$1 | ThinkingPart$1 | StructuredOutputPart<TData> | UIResourcePart | SubagentPart$1;
3172
+ type MessagePart$1<TData = unknown> = TextPart$1 | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$2 | ToolResultPart$1 | ThinkingPart$1 | ActivityPart | StructuredOutputPart<TData> | UIResourcePart | SubagentPart$1;
3139
3173
  /**
3140
3174
  * Shape of `metadata.tanstack` on run events.
3141
3175
  */
@@ -3149,6 +3183,8 @@ interface TanStackRunMetadata {
3149
3183
  runId?: string;
3150
3184
  sessionId?: string;
3151
3185
  index?: number;
3186
+ /** On a `RUN_ERROR`. See `RunErrorEvent.retryAfterMs`. */
3187
+ retryAfterMs?: number;
3152
3188
  state?: ToolOutputState;
3153
3189
  /** Parsed `TOOL_CALL_END` input. Spec `TOOL_CALL_END` has no top-level `input`. */
3154
3190
  input?: unknown;
@@ -3162,7 +3198,7 @@ interface TanStackRunMetadata {
3162
3198
  */
3163
3199
  interface UIMessage$1<TData = unknown> {
3164
3200
  id: string;
3165
- role: 'system' | 'user' | 'assistant';
3201
+ role: 'system' | 'user' | 'assistant' | 'activity';
3166
3202
  parts: Array<MessagePart$1<TData>>;
3167
3203
  createdAt?: Date;
3168
3204
  /** Optional AG-UI sender name. Converters preserve it across wire and persist. */
@@ -3424,6 +3460,12 @@ interface RunErrorEvent extends Pick<RunErrorEvent$1, 'message' | 'code' | 'time
3424
3460
  message: string;
3425
3461
  code?: string;
3426
3462
  };
3463
+ /**
3464
+ * How long the provider asks you to wait before a retry, in milliseconds.
3465
+ * Adapters read it from the `retry-after-ms` or `retry-after` header.
3466
+ * `chat()` moves it to `metadata.tanstack.retryAfterMs`.
3467
+ */
3468
+ retryAfterMs?: number;
3427
3469
  metadata?: {
3428
3470
  tanstack?: TanStackRunMetadata;
3429
3471
  } & Record<string, any>;
@@ -3563,10 +3605,24 @@ interface ReasoningEndEvent extends ReasoningEndEvent$1 {}
3563
3605
  * @ag-ui/core provides: `subtype`, `entityId`, `encryptedValue`
3564
3606
  */
3565
3607
  interface ReasoningEncryptedValueEvent extends ReasoningEncryptedValueEvent$1 {}
3566
- /** AG-UI 1.0 ActivitySnapshotEvent shape. */
3567
- interface ActivitySnapshotEvent extends ActivitySnapshotEvent$1 {}
3568
- /** AG-UI 1.0 ActivityDeltaEvent shape. */
3569
- interface ActivityDeltaEvent extends ActivityDeltaEvent$1 {}
3608
+ /**
3609
+ * Full activity state for an `ActivityMessage`.
3610
+ *
3611
+ * @ag-ui/core provides: `messageId`, `activityType`, `content`, `replace?`,
3612
+ * `metadata?`, `subagentRunId?`. When `replace` is omitted it means `true`.
3613
+ */
3614
+ interface ActivitySnapshotEvent extends Omit<ActivitySnapshotEvent$1, 'type'> {
3615
+ type: 'ACTIVITY_SNAPSHOT';
3616
+ }
3617
+ /**
3618
+ * RFC 6902 JSON Patch against an existing activity's `content`.
3619
+ *
3620
+ * @ag-ui/core provides: `messageId`, `activityType`, `patch`, `metadata?`,
3621
+ * `subagentRunId?`
3622
+ */
3623
+ interface ActivityDeltaEvent extends Omit<ActivityDeltaEvent$1, 'type'> {
3624
+ type: 'ACTIVITY_DELTA';
3625
+ }
3570
3626
  /** AG-UI 1.0 RawEvent shape. */
3571
3627
  interface RawEvent extends RawEvent$1 {}
3572
3628
  /** AG-UI 1.0 TextMessageChunkEvent shape. */
@@ -3605,7 +3661,7 @@ interface SubagentErrorEvent extends SubagentErrorEvent$1 {}
3605
3661
  */
3606
3662
  type StreamChunk = AGUIEvent;
3607
3663
  //#endregion
3608
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/interrupt-definition.d.ts
3664
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/interrupt-definition.d.ts
3609
3665
  type PortableSchema = StandardJSONSchemaV1<any, any> | StandardSchemaV1$1<any, any>;
3610
3666
  type InterruptInput<TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = {
3611
3667
  key: string;
@@ -3647,7 +3703,7 @@ interface InterruptDefinition<TId extends string, TPayloadSchema extends Portabl
3647
3703
  interrupt: InterruptRequestMethod<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>;
3648
3704
  }
3649
3705
  //#endregion
3650
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.d.ts
3706
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.d.ts
3651
3707
  /**
3652
3708
  * Type-level brand key for {@link ToolApprovalCapabilityMarker}. Only ever used
3653
3709
  * in type positions, but it must stay exported: a `unique symbol` referenced by
@@ -3728,52 +3784,52 @@ type InferToolOutput<T> = T extends {
3728
3784
  outputSchema?: infer TOutput;
3729
3785
  } ? TOutput extends StandardJSONSchemaV1<any, any> ? InferSchemaType<TOutput> : TOutput extends StandardSchemaV1$1<any, any> ? InferSchemaType<TOutput> : TOutput extends JSONSchema ? unknown : InferSchemaType<TOutput> : unknown;
3730
3786
  //#endregion
3731
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/types.d.ts
3787
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/byok/define-provider.d.ts
3732
3788
  /**
3733
- * Strategy for determining when to emit text updates
3789
+ * A BYOK provider declared by an adapter. `id` is the `x-byok-<id>` slug and
3790
+ * is required — `{ id?: string }` is not a {@link ByokProvider}.
3734
3791
  */
3735
- interface ChunkStrategy {
3792
+ interface ByokProvider<TId extends string = string> {
3793
+ readonly id: TId;
3794
+ readonly label: string;
3736
3795
  /**
3737
- * Called for each text chunk received
3738
- * @param chunk - The new chunk of text (delta)
3739
- * @param accumulated - All text accumulated so far
3740
- * @returns true if an update should be emitted now
3796
+ * Env var names the relay may read. Names only — never put `process.env`
3797
+ * values here. This object is imported on the client.
3741
3798
  */
3742
- shouldEmit: (chunk: string, accumulated: string) => boolean;
3799
+ readonly env?: ReadonlyArray<string>;
3743
3800
  /**
3744
- * Optional: Reset strategy state (called when streaming starts)
3801
+ * Other descriptors this credential needs. A send for this provider also
3802
+ * carries their headers and prompts for each one that is missing.
3745
3803
  */
3746
- reset?: () => void;
3804
+ readonly with?: ReadonlyArray<ByokProvider>;
3747
3805
  }
3748
3806
  //#endregion
3749
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/byok/providers.d.ts
3807
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/byok/providers.d.ts
3750
3808
  /**
3751
3809
  * Provider ids are open slugs, not a closed catalog. `@tanstack/ai` does not
3752
3810
  * list adapters. Any matching string is a valid id and becomes `x-byok-<id>`.
3753
3811
  */
3754
3812
  type ProviderId = string;
3755
3813
  //#endregion
3756
- //#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/byok/define-provider.d.ts
3814
+ //#region node_modules/.deno/@tanstack+ai@0.68.0/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/types.d.ts
3757
3815
  /**
3758
- * A BYOK provider declared by an adapter. `id` is the `x-byok-<id>` slug and
3759
- * is required — `{ id?: string }` is not a {@link ByokProvider}.
3816
+ * Strategy for determining when to emit text updates
3760
3817
  */
3761
- interface ByokProvider<TId extends string = string> {
3762
- readonly id: TId;
3763
- readonly label: string;
3818
+ interface ChunkStrategy {
3764
3819
  /**
3765
- * Env var names the relay may read. Names only — never put `process.env`
3766
- * values here. This object is imported on the client.
3820
+ * Called for each text chunk received
3821
+ * @param chunk - The new chunk of text (delta)
3822
+ * @param accumulated - All text accumulated so far
3823
+ * @returns true if an update should be emitted now
3767
3824
  */
3768
- readonly env?: ReadonlyArray<string>;
3825
+ shouldEmit: (chunk: string, accumulated: string) => boolean;
3769
3826
  /**
3770
- * Other descriptors this credential needs. A send for this provider also
3771
- * carries their headers and prompts for each one that is missing.
3827
+ * Optional: Reset strategy state (called when streaming starts)
3772
3828
  */
3773
- readonly with?: ReadonlyArray<ByokProvider>;
3829
+ reset?: () => void;
3774
3830
  }
3775
3831
  //#endregion
3776
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/byok/storage.d.ts
3832
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/byok/storage.d.ts
3777
3833
  type Keyring = Partial<Record<ProviderId, string>>;
3778
3834
  type KeyPreview = Partial<Record<ProviderId, string>>;
3779
3835
  interface KeyringStorage {
@@ -3788,7 +3844,7 @@ interface KeyringStorage {
3788
3844
  clear: () => void | Promise<void>;
3789
3845
  }
3790
3846
  //#endregion
3791
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/byok/client.d.ts
3847
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/byok/client.d.ts
3792
3848
  type KeyStatus = {
3793
3849
  state: 'empty';
3794
3850
  } | {
@@ -3843,7 +3899,7 @@ declare class ByokClient {
3843
3899
  unlock(): Promise<void>;
3844
3900
  }
3845
3901
  //#endregion
3846
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/events.d.ts
3902
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/events.d.ts
3847
3903
  interface ChatClientRunEventContext {
3848
3904
  threadId: string;
3849
3905
  runId: string;
@@ -3863,7 +3919,7 @@ interface ChatClientToolFixtureAppliedEvent {
3863
3919
  execute?: boolean;
3864
3920
  message?: {
3865
3921
  id: string;
3866
- role: 'system' | 'user' | 'assistant';
3922
+ role: UIMessage['role'];
3867
3923
  parts: Array<unknown>;
3868
3924
  createdAt?: number | string;
3869
3925
  };
@@ -3963,7 +4019,7 @@ declare abstract class ChatClientEventEmitter {
3963
4019
  toolFixtureApplied(fixture: ChatClientToolFixtureAppliedEvent): void;
3964
4020
  }
3965
4021
  //#endregion
3966
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/devtools.d.ts
4022
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/devtools.d.ts
3967
4023
  interface AIDevtoolsDisplayOptions {
3968
4024
  name?: string;
3969
4025
  }
@@ -4131,10 +4187,10 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
4131
4187
  private findClientTool;
4132
4188
  }
4133
4189
  //#endregion
4134
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.d.ts
4190
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.d.ts
4135
4191
  type ChatDevtoolsBridgeFactory = (options: ChatDevtoolsBridgeOptions) => ChatDevtoolsBridge;
4136
4192
  //#endregion
4137
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/types.d.ts
4193
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/types.d.ts
4138
4194
  interface ChatResumeState {
4139
4195
  threadId: string;
4140
4196
  runId: string;
@@ -4606,7 +4662,7 @@ type SubagentPartOf<TAgents extends ReadonlyArray<SubagentClientAgent> | undefin
4606
4662
  };
4607
4663
  type MessagePart<TTools extends ReadonlyArray<{
4608
4664
  name: string;
4609
- }> = any, TData = unknown, TSubagents extends ReadonlyArray<SubagentClientAgent> | undefined = undefined> = TextPart | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$1<TTools> | ToolResultPart | ThinkingPart | StructuredOutputPart<TData> | UIResourcePart | SubagentPartOf<TSubagents>;
4665
+ }> = any, TData = unknown, TSubagents extends ReadonlyArray<SubagentClientAgent> | undefined = undefined> = TextPart | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$1<TTools> | ToolResultPart | ThinkingPart | ActivityPart | StructuredOutputPart<TData> | UIResourcePart | SubagentPartOf<TSubagents>;
4610
4666
  /**
4611
4667
  * UIMessage - Domain-specific message format optimized for building chat UIs
4612
4668
  * Contains parts that can be text, tool calls, or tool results.
@@ -4623,7 +4679,7 @@ interface UIMessage<TTools extends ReadonlyArray<{
4623
4679
  name: string;
4624
4680
  }> = any, TData = unknown, TSubagents extends ReadonlyArray<SubagentClientAgent> | undefined = undefined> {
4625
4681
  id: string;
4626
- role: 'system' | 'user' | 'assistant';
4682
+ role: 'system' | 'user' | 'assistant' | 'activity';
4627
4683
  name?: string;
4628
4684
  parts: Array<MessagePart<TTools, TData, TSubagents>>;
4629
4685
  createdAt?: Date;
@@ -4824,6 +4880,12 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
4824
4880
  * activity visible to all subscribers (e.g. across tabs/devices).
4825
4881
  */
4826
4882
  onSessionGeneratingChange?: (isGenerating: boolean) => void;
4883
+ /**
4884
+ * Callback when the client starts or stops rebuilding the chat from
4885
+ * persistence (the server hydrate, or an async storage adapter). It turns
4886
+ * false once the transcript is applied and any in-flight run is re-joined.
4887
+ */
4888
+ onHydratingChange?: (isHydrating: boolean) => void;
4827
4889
  /**
4828
4890
  * Policy for messages sent while the client is busy (streaming, claiming
4829
4891
  * a send, or draining the queue). Accepts a `WhenBusy` string, a
@@ -4905,7 +4967,7 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
4905
4967
  */
4906
4968
  type ChatClientOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TContext = InferredClientContext<TTools>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = DistributedOmit<ChatClientBaseOptions<TTools, TContext, TInterrupts>, 'context'> & ClientContextOptionFromTools<TTools, TContext> & ChatTransport & ChatPersistenceOptions<TTools>;
4907
4969
  //#endregion
4908
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.d.ts
4970
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.d.ts
4909
4971
  /**
4910
4972
  * Per-send context provided by the chat client to the connection adapter.
4911
4973
  * The adapter combines this with serialized messages to build a full
@@ -5068,7 +5130,7 @@ interface SubscribeConnectionAdapter {
5068
5130
  */
5069
5131
  type ConnectionAdapter = ConnectConnectionAdapter | SubscribeConnectionAdapter;
5070
5132
  //#endregion
5071
- //#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/chat-client.d.ts
5133
+ //#region node_modules/.deno/@tanstack+ai-client@0.39.2/node_modules/@tanstack/ai-client/dist/esm/chat-client.d.ts
5072
5134
  type ChatClientUpdateOptionsWithoutContext<TTools extends ReadonlyArray<AnyClientTool>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = {
5073
5135
  connection?: ConnectionAdapter;
5074
5136
  fetcher?: ChatFetcher; /** @deprecated Use `forwardedProps` instead. */
@@ -5086,6 +5148,7 @@ type ChatClientUpdateOptionsWithoutContext<TTools extends ReadonlyArray<AnyClien
5086
5148
  onSubscriptionChange?: (isSubscribed: boolean) => void;
5087
5149
  onConnectionStatusChange?: (status: ConnectionStatus) => void;
5088
5150
  onSessionGeneratingChange?: (isGenerating: boolean) => void;
5151
+ onHydratingChange?: (isHydrating: boolean) => void;
5089
5152
  onQueueChange?: (queue: Array<QueuedMessage>) => void;
5090
5153
  onResumeStateChange?: (resumeState: ChatResumeState | null, pendingInterrupts: BoundInterrupts<TTools, TInterrupts>) => void;
5091
5154
  /**
@@ -5180,6 +5243,7 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
5180
5243
  private currentMessageId;
5181
5244
  private readonly postStreamActions;
5182
5245
  private readonly pendingToolExecutions;
5246
+ private handingOverPendingToolCalls;
5183
5247
  private activeClientTools;
5184
5248
  private activeContext;
5185
5249
  private continuationPending;
@@ -5205,6 +5269,12 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
5205
5269
  private hydrationError;
5206
5270
  /** Whether a view is currently watching. See `attach` / `detach`. */
5207
5271
  private tailing;
5272
+ /** `historyGeneration` of the mount hydration GET still in flight, if any. */
5273
+ private hydrationInFlight;
5274
+ /** An async storage adapter is still reading the persisted transcript. */
5275
+ private storeHydrating;
5276
+ /** See {@link getIsHydrating}. */
5277
+ private isHydrating;
5208
5278
  /** Constructor inputs `attach()` needs on every re-attach, not just the first. */
5209
5279
  private readonly rejoinRunId;
5210
5280
  private readonly cachesMessages;
@@ -5344,9 +5414,16 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
5344
5414
  private interruptGeneration;
5345
5415
  private generateUniqueId;
5346
5416
  private setIsLoading;
5417
+ /**
5418
+ * A send or a clear now owns the transcript. A load that is still pending can
5419
+ * no longer paint it (the generation guards drop its result), so it no longer
5420
+ * counts as hydrating.
5421
+ */
5422
+ private supersedeHydration;
5347
5423
  private setStatus;
5348
5424
  private setIsSubscribed;
5349
5425
  private setConnectionStatus;
5426
+ private syncIsHydrating;
5350
5427
  private setSessionGenerating;
5351
5428
  private notifyResumeStateChange;
5352
5429
  /**
@@ -5643,6 +5720,13 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
5643
5720
  * activity visible to all subscribers (e.g. across tabs/devices).
5644
5721
  */
5645
5722
  getSessionGenerating(): boolean;
5723
+ /**
5724
+ * Whether the client is rebuilding the chat from persistence: the server
5725
+ * hydrate (`persistence: true`) or an async storage adapter. Turns false once
5726
+ * the transcript is applied and any in-flight run is re-joined (from then on
5727
+ * `isLoading` covers the stream), or when the load fails.
5728
+ */
5729
+ getIsHydrating(): boolean;
5646
5730
  /**
5647
5731
  * Get current error
5648
5732
  */
@@ -5748,8 +5832,10 @@ interface AstralBeamChatAttachmentOptions {
5748
5832
  type AstralBeamChatSlotRenderer = (container: HTMLElement) => (() => void) | void;
5749
5833
  /** Host-rendered replacements for the widget's own chrome; each renders in the host page's style. */
5750
5834
  interface AstralBeamChatSlots {
5751
- /** Replaces the header's content (title and reset button); `showHeader: false` still hides the row. */
5835
+ /** Replaces the header's title; `showHeader: false` still hides the row. */
5752
5836
  header?: AstralBeamChatSlotRenderer | undefined;
5837
+ /** Extra controls at the end of the header, after the history and new chat buttons. */
5838
+ headerActions?: AstralBeamChatSlotRenderer | undefined;
5753
5839
  /** Replaces the empty-transcript state (icon, headline, and subtitle). */
5754
5840
  empty?: AstralBeamChatSlotRenderer | undefined;
5755
5841
  /** Extra controls at the end of the composer's button row, next to send. */
@@ -5799,19 +5885,26 @@ interface AstralBeamChatTheme {
5799
5885
  interface MountAstralBeamChatOptions {
5800
5886
  /**
5801
5887
  * Public ID of the organization-owned agent. Omit it to use the organization's default agent,
5802
- * which the dashboard's agents page selects. A change answers the next run with the new agent
5803
- * and keeps the transcript, which that agent then sees as history.
5888
+ * which the dashboard's agents page selects. Saved conversations keep their agent,
5889
+ * and an update applies to new threads.
5804
5890
  */
5805
5891
  agentId?: string | undefined;
5892
+ /** Defaults to `"auto"`, restoring this tab's selection. Use `"new"` for a fresh chat, or a saved thread UUID. */
5893
+ threadId?: string | undefined;
5806
5894
  /** Name shown in the widget's header. Default `"AstralBeam"`. */
5807
5895
  title?: string | undefined;
5808
5896
  /**
5809
- * Shows the widget's header, which carries the title and the reset button. `false` hides both
5810
- * and gives the transcript the full height. Default `true`.
5897
+ * Shows the widget's header, which carries the title and the chat history and new chat buttons.
5898
+ * `false` hides it and gives the transcript the full height. Default `true`.
5811
5899
  */
5812
5900
  showHeader?: boolean | undefined;
5901
+ /**
5902
+ * Shows a bar under the header with the open conversation's title, once it has one, and a menu
5903
+ * to rename, delete, or copy it as Markdown. Default `false`.
5904
+ */
5905
+ showConversationTitle?: boolean | undefined;
5813
5906
  /** Headline shown on the empty transcript. Default `"Ask the assistant"`. */
5814
- emptyTitle?: string | undefined;
5907
+ emptyHeadline?: string | undefined;
5815
5908
  /** Subtitle shown under the empty transcript's headline. Default describes the app's tools and widgets. */
5816
5909
  emptyDescription?: string | undefined;
5817
5910
  /**
@@ -5916,15 +6009,14 @@ interface SandboxCommandRun {
5916
6009
  truncated: boolean;
5917
6010
  finished: boolean;
5918
6011
  }
5919
- /** One file the agent published for the user, with the ticket its download is authorized by. */
6012
+ /** One file the agent published for the user, with its durable stored reference. */
5920
6013
  interface SandboxArtifact {
5921
6014
  toolCallId: string;
5922
6015
  path: string;
5923
6016
  label: string;
5924
6017
  mimeType: string | undefined;
5925
6018
  size: number | undefined;
5926
- /** Capability the files endpoint accepts in its query; the whole download authorization. */
5927
- ticket: string | undefined;
6019
+ fileId: string | undefined;
5928
6020
  published: boolean;
5929
6021
  }
5930
6022
  /** Everything the sandbox did in this conversation, derived from the transcript. */
@@ -6131,6 +6223,28 @@ type ChatAuthenticationState = {
6131
6223
  error: Error;
6132
6224
  };
6133
6225
  //#endregion
6226
+ //#region src/core/threads.d.ts
6227
+ /** A saved conversation visible to the signed-in tenant user. */
6228
+ interface ChatThread {
6229
+ id: string;
6230
+ title: string | null;
6231
+ agentId: string | null;
6232
+ version: number;
6233
+ role: "viewer" | "member" | "manager";
6234
+ writerActive: boolean;
6235
+ hasMessages: boolean;
6236
+ updatedAt: string;
6237
+ }
6238
+ interface ChatPendingInteraction {
6239
+ sourceMessageId: string;
6240
+ sourcePartId: string;
6241
+ responseTargetId: string;
6242
+ toolCallId: string;
6243
+ targetTenantUserId: string | null;
6244
+ targetClientId: string | null;
6245
+ executionLocation: string;
6246
+ }
6247
+ //#endregion
6134
6248
  //#region src/core/session.d.ts
6135
6249
  /** A widget render the agent requested, handed to the host's `onRenderWidget`. */
6136
6250
  interface WidgetRenderRequest {
@@ -6154,11 +6268,17 @@ interface ChatStreamCallbacks {
6154
6268
  onFinish?: ((message: UIMessage) => void) | undefined;
6155
6269
  onError?: ((error: Error) => void) | undefined;
6156
6270
  }
6271
+ interface ChatSubmissionCallbacks {
6272
+ /** Identifies the conversation before its input is sent, including a newly created chat. */
6273
+ onThreadReady?: ((threadId: string) => void) | undefined;
6274
+ /** Called once after the server acknowledges input, before generation finishes. */
6275
+ onAccepted?: (() => void) | undefined;
6276
+ }
6157
6277
  /**
6158
6278
  * The transport and tool options of the drop-in widget, minus everything about its UI, plus this
6159
6279
  * session's own rendering hooks. The shared options are documented on `MountAstralBeamChatOptions`.
6160
6280
  */
6161
- interface AstralBeamChatCoreOptions extends Pick<MountAstralBeamChatOptions, "agentId" | "apiUrl" | "fetchAstralBeamToken" | "tools" | "debug"> {
6281
+ interface AstralBeamChatCoreOptions extends Pick<MountAstralBeamChatOptions, "agentId" | "apiUrl" | "fetchAstralBeamToken" | "tools" | "debug" | "threadId"> {
6162
6282
  /** Widgets declared to the agent, without a `render`; `onRenderWidget` is asked to draw them. */
6163
6283
  widgets?: Record<string, WidgetDeclaration> | undefined;
6164
6284
  /** Draws an agent-requested widget however the host wants; may return a cleanup. */
@@ -6184,7 +6304,21 @@ interface AstralBeamChatState {
6184
6304
  /** The tool set currently declared to the agent, in declaration order. */
6185
6305
  agentTools: readonly AgentToolInfo[];
6186
6306
  sandboxStatus: SandboxStatus | undefined;
6307
+ /** The usage limit that ended the last run, by display name, until another run starts. */
6308
+ usageLimitReached: {
6309
+ name: string;
6310
+ resetsAt: string;
6311
+ } | undefined;
6187
6312
  sandbox: SandboxActivity;
6313
+ thread: ChatThread | undefined;
6314
+ threadLoading: boolean;
6315
+ threadLoadFailed: boolean;
6316
+ messagesCursor: string | undefined;
6317
+ olderMessagesLoading: boolean;
6318
+ /** Retained until the server acknowledges the send, including after an uncertain network failure. */
6319
+ unsentMessage: string | MultimodalContent | undefined;
6320
+ activeToolCallIds: readonly string[];
6321
+ pendingInteractions: readonly ChatPendingInteraction[];
6188
6322
  }
6189
6323
  interface AstralBeamChatCore {
6190
6324
  /** Start browser side effects after a React commit. Vanilla sessions start automatically. */
@@ -6197,18 +6331,38 @@ interface AstralBeamChatCore {
6197
6331
  * the chat session. Only the keys given are replaced.
6198
6332
  */
6199
6333
  updateOptions: (options: Partial<AstralBeamChatCoreOptions>) => void;
6200
- /** Sends a message, first settling any dangling tool calls so the run can proceed. */
6201
- sendMessage: (content: string | MultimodalContent) => Promise<void>;
6334
+ /** Sends a message, persisting it before generation begins. */
6335
+ sendMessage: (content: string | MultimodalContent, callbacks?: ChatSubmissionCallbacks) => Promise<void>;
6202
6336
  /** Resolves a client tool call the host executed itself (a questionnaire, an approval). */
6203
6337
  addToolResult: ChatClient["addToolResult"];
6204
6338
  /** Stops the in-flight generation; the transcript keeps what already streamed. */
6205
6339
  stop: () => void;
6206
6340
  /** Mints a fresh chat auth token, ignoring the cached one; for a retry after a failure. */
6207
6341
  retryAuthentication: () => void;
6208
- /** Re-runs the last exchange. */
6342
+ /** Refreshes saved history and retries delivery of retained tool results. */
6209
6343
  reload: () => Promise<void>;
6210
- /** Clears the conversation and disposes live widget renders. */
6344
+ /** Starts an empty conversation and disposes widget renders, preserving any saved chat. */
6211
6345
  reset: () => void;
6346
+ /** Searches all authorized conversation titles using server pagination. */
6347
+ searchThreads: (q?: string, cursor?: string, signal?: AbortSignal) => Promise<{
6348
+ items: ChatThread[];
6349
+ page_after: string | null;
6350
+ }>;
6351
+ /** Loads saved history before accepting another send. */
6352
+ openThread: (id: string) => Promise<void>;
6353
+ renameThread: (title: string) => Promise<boolean>;
6354
+ /** Deletes a listed conversation, the selected one by default; resolves whether it succeeded. */
6355
+ deleteThread: (thread?: ChatThread) => Promise<boolean>;
6356
+ refreshThread: () => Promise<void>;
6357
+ loadOlderMessages: () => Promise<void>;
6358
+ abandonToolCall: (toolCallId: string) => Promise<void>;
6359
+ uploadAttachment: (file: {
6360
+ data: string | Promise<string>;
6361
+ filename: string;
6362
+ mimeType: string;
6363
+ }) => Promise<UploadedChatFile>;
6364
+ getFile: (fileId: string) => Promise<Blob>;
6365
+ getAttachment: (messageId: string, partId: string) => Promise<Blob>;
6212
6366
  /** Tears the session down: the connection, authentication, and widget renders. */
6213
6367
  dispose: () => void;
6214
6368
  }
@@ -6242,7 +6396,7 @@ declare function isSandboxTool(name: string): boolean;
6242
6396
  declare function sandboxRefusal(part: ToolCallPart): string | undefined;
6243
6397
  /** A `sandbox_write_file` call, readable while its content is still streaming in. */
6244
6398
  declare function readSandboxFileWrite(part: ToolCallPart): SandboxFileWrite | undefined;
6245
- /** A `sandbox_publish_artifact` call whose output carries the download ticket. */
6399
+ /** A `sandbox_publish_artifact` call whose output carries a durable file reference. */
6246
6400
  declare function readSandboxArtifact(part: ToolCallPart): SandboxArtifact | undefined;
6247
6401
  /** A `sandbox_run_command` call. `stdout` holds combined output on providers with no stderr. */
6248
6402
  declare function readSandboxCommandRun(part: ToolCallPart): SandboxCommandRun | undefined;
@@ -6275,4 +6429,26 @@ interface TypedToolDefinition<S extends ParametersSchema = JsonSchemaObject> {
6275
6429
  /** Declares a host tool; a Standard Schema `parameters` types (and validates) `execute`'s input. */
6276
6430
  declare function defineTool<const S extends ParametersSchema = JsonSchemaObject>(tool: TypedToolDefinition<S>): ToolDefinition;
6277
6431
  //#endregion
6278
- export { RenderWidgetInput as A, JsonSchemaObject as B, AstralBeamChatState as C, ChatAuthenticationState as D, createAstralBeamChat as E, SandboxStatus as F, StandardSchemaV1 as H, AstralBeamChatColorScheme as I, AstralBeamChatTheme as L, SandboxArtifact as M, SandboxCommandRun as N, WidgetDeclaration as O, SandboxFileWrite as P, AstralBeamTokenSource as R, AstralBeamChatCoreOptions as S, WidgetRenderRequest as T, ToolDefinition as U, ParametersSchema as V, hasPendingToolRun as _, SANDBOX_PUBLISH_ARTIFACT_TOOL as a, AgentToolInfo as b, SANDBOX_STATUS_EVENT as c, describeSandboxCommandRun as d, isSandboxTool as f, sandboxRefusal as g, readSandboxFileWrite as h, SANDBOX_LIST_FILES_TOOL as i, SandboxActivity as j, buildAgentTools as k, SANDBOX_WRITE_FILE_TOOL as l, readSandboxCommandRun as m, ASK_QUESTIONNAIRE_TOOL as n, SANDBOX_READ_FILE_TOOL as o, readSandboxArtifact as p, RENDER_WIDGET_TOOL as r, SANDBOX_RUN_COMMAND_TOOL as s, defineTool as t, collectSandboxActivity as u, isSettledToolCall as v, ChatStreamCallbacks as w, AstralBeamChatCore as x, lastPartInProgress as y, InferParameters as z };
6432
+ //#region src/core/web.d.ts
6433
+ interface WebSource {
6434
+ url: string;
6435
+ title: string;
6436
+ excerpt?: string;
6437
+ }
6438
+ interface WebCitation extends WebSource {
6439
+ /** UTF-16 offsets into the text part. The link follows endIndex. */
6440
+ startIndex: number;
6441
+ endIndex: number;
6442
+ /** Response-wide citation number. */
6443
+ number: number;
6444
+ }
6445
+ interface WebEvidence {
6446
+ sources: WebSource[];
6447
+ citations: WebCitation[];
6448
+ }
6449
+ interface WebPartMetadata {
6450
+ providerExecuted?: boolean;
6451
+ web?: WebEvidence;
6452
+ }
6453
+ //#endregion
6454
+ export { WidgetRenderRequest as A, SandboxCommandRun as B, lastPartInProgress as C, AstralBeamChatState as D, AstralBeamChatCoreOptions as E, WidgetDeclaration as F, AstralBeamTokenSource as G, SandboxStatus as H, buildAgentTools as I, ParametersSchema as J, InferParameters as K, RenderWidgetInput as L, ChatPendingInteraction as M, ChatThread as N, ChatStreamCallbacks as O, ChatAuthenticationState as P, SandboxActivity as R, isSettledToolCall as S, AstralBeamChatCore as T, AstralBeamChatColorScheme as U, SandboxFileWrite as V, AstralBeamChatTheme as W, ToolDefinition as X, StandardSchemaV1 as Y, readSandboxArtifact as _, defineTool as a, sandboxRefusal as b, SANDBOX_LIST_FILES_TOOL as c, SANDBOX_RUN_COMMAND_TOOL as d, SANDBOX_STATUS_EVENT as f, isSandboxTool as g, describeSandboxCommandRun as h, WebSource as i, createAstralBeamChat as j, ChatSubmissionCallbacks as k, SANDBOX_PUBLISH_ARTIFACT_TOOL as l, collectSandboxActivity as m, WebEvidence as n, ASK_QUESTIONNAIRE_TOOL as o, SANDBOX_WRITE_FILE_TOOL as p, JsonSchemaObject as q, WebPartMetadata as r, RENDER_WIDGET_TOOL as s, WebCitation as t, SANDBOX_READ_FILE_TOOL as u, readSandboxCommandRun as v, AgentToolInfo as w, hasPendingToolRun as x, readSandboxFileWrite as y, SandboxArtifact as z };