@astralform/js 3.0.1 → 3.1.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.
package/dist/index.d.cts CHANGED
@@ -615,6 +615,19 @@ interface FeedbackResponse {
615
615
  comment: string | null;
616
616
  createdAt: string;
617
617
  }
618
+ /** Reasoning effort a caller may request for a turn (client-side model selection). */
619
+ type ReasoningEffort = "low" | "medium" | "high";
620
+ /**
621
+ * The per-request model choice (client-side model selection). `provider` and
622
+ * `model` are paired — send both or neither; when omitted, the server reuses the
623
+ * conversation's last model or a connected-provider default.
624
+ */
625
+ interface ModelChoiceOptions {
626
+ provider?: string;
627
+ model?: string;
628
+ reasoningEffort?: ReasoningEffort;
629
+ temperature?: number;
630
+ }
618
631
  interface ChatStreamRequest {
619
632
  message?: string;
620
633
  conversation_id?: string;
@@ -626,6 +639,14 @@ interface ChatStreamRequest {
626
639
  agent_name?: string;
627
640
  enable_search?: boolean;
628
641
  plan_mode?: boolean;
642
+ /**
643
+ * Per-request model choice (client-side model selection), wire shape.
644
+ * `provider` and `model` are paired; omit to reuse the thread's last model.
645
+ */
646
+ provider?: string;
647
+ model?: string;
648
+ reasoning_effort?: ReasoningEffort;
649
+ temperature?: number;
629
650
  }
630
651
  interface ToolResultRequest {
631
652
  conversation_id: string;
@@ -697,7 +718,7 @@ interface ConversationEvent {
697
718
  event: string;
698
719
  data: Record<string, unknown>;
699
720
  }
700
- interface SendOptions$1 {
721
+ interface SendOptions$1 extends ModelChoiceOptions {
701
722
  conversationId?: string;
702
723
  enabledClientTools?: string[];
703
724
  uploadIds?: string[];
@@ -705,6 +726,19 @@ interface SendOptions$1 {
705
726
  enableSearch?: boolean;
706
727
  planMode?: boolean;
707
728
  }
729
+ /**
730
+ * A selectable model for one of the team's connected providers, from
731
+ * `GET /v1/models`. Backs the client-side model picker.
732
+ */
733
+ interface ModelOption {
734
+ provider: string;
735
+ providerDisplay: string;
736
+ model: string;
737
+ thinking: boolean;
738
+ tools: boolean;
739
+ vision: boolean;
740
+ thinkingMode: string;
741
+ }
708
742
  interface ConversationAsset {
709
743
  id: string;
710
744
  kind: "upload" | "output";
@@ -787,6 +821,13 @@ declare class AstralformClient {
787
821
  * which enumerates the team-level agents a signed-in user can open.
788
822
  */
789
823
  getAgents(): Promise<AgentInfo[]>;
824
+ /**
825
+ * List the models the caller may pick this turn — expanded from the curated
826
+ * catalog of the providers the team has connected (client-side model
827
+ * selection). Backs the composer's model picker. Scoped to the active agent
828
+ * via X-Agent-ID, same as {@link getAgentStatus}.
829
+ */
830
+ getModels(): Promise<ModelOption[]>;
790
831
  getSkills(): Promise<SkillInfo[]>;
791
832
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
792
833
  submitToolResult(request: ToolResultRequest): Promise<void>;
@@ -1066,7 +1107,7 @@ declare function streamJobSSE(options: StreamJobSSEOptions): AsyncGenerator<Chat
1066
1107
  */
1067
1108
 
1068
1109
  type StreamState = "idle" | "streaming" | "restoring" | "detached";
1069
- interface SendOptions {
1110
+ interface SendOptions extends ModelChoiceOptions {
1070
1111
  enableSearch?: boolean;
1071
1112
  agentName?: string;
1072
1113
  uploadIds?: string[];
@@ -1202,4 +1243,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1202
1243
  */
1203
1244
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1204
1245
 
1205
- export { type ActiveJob, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
1246
+ export { type ActiveJob, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
package/dist/index.d.ts CHANGED
@@ -615,6 +615,19 @@ interface FeedbackResponse {
615
615
  comment: string | null;
616
616
  createdAt: string;
617
617
  }
618
+ /** Reasoning effort a caller may request for a turn (client-side model selection). */
619
+ type ReasoningEffort = "low" | "medium" | "high";
620
+ /**
621
+ * The per-request model choice (client-side model selection). `provider` and
622
+ * `model` are paired — send both or neither; when omitted, the server reuses the
623
+ * conversation's last model or a connected-provider default.
624
+ */
625
+ interface ModelChoiceOptions {
626
+ provider?: string;
627
+ model?: string;
628
+ reasoningEffort?: ReasoningEffort;
629
+ temperature?: number;
630
+ }
618
631
  interface ChatStreamRequest {
619
632
  message?: string;
620
633
  conversation_id?: string;
@@ -626,6 +639,14 @@ interface ChatStreamRequest {
626
639
  agent_name?: string;
627
640
  enable_search?: boolean;
628
641
  plan_mode?: boolean;
642
+ /**
643
+ * Per-request model choice (client-side model selection), wire shape.
644
+ * `provider` and `model` are paired; omit to reuse the thread's last model.
645
+ */
646
+ provider?: string;
647
+ model?: string;
648
+ reasoning_effort?: ReasoningEffort;
649
+ temperature?: number;
629
650
  }
630
651
  interface ToolResultRequest {
631
652
  conversation_id: string;
@@ -697,7 +718,7 @@ interface ConversationEvent {
697
718
  event: string;
698
719
  data: Record<string, unknown>;
699
720
  }
700
- interface SendOptions$1 {
721
+ interface SendOptions$1 extends ModelChoiceOptions {
701
722
  conversationId?: string;
702
723
  enabledClientTools?: string[];
703
724
  uploadIds?: string[];
@@ -705,6 +726,19 @@ interface SendOptions$1 {
705
726
  enableSearch?: boolean;
706
727
  planMode?: boolean;
707
728
  }
729
+ /**
730
+ * A selectable model for one of the team's connected providers, from
731
+ * `GET /v1/models`. Backs the client-side model picker.
732
+ */
733
+ interface ModelOption {
734
+ provider: string;
735
+ providerDisplay: string;
736
+ model: string;
737
+ thinking: boolean;
738
+ tools: boolean;
739
+ vision: boolean;
740
+ thinkingMode: string;
741
+ }
708
742
  interface ConversationAsset {
709
743
  id: string;
710
744
  kind: "upload" | "output";
@@ -787,6 +821,13 @@ declare class AstralformClient {
787
821
  * which enumerates the team-level agents a signed-in user can open.
788
822
  */
789
823
  getAgents(): Promise<AgentInfo[]>;
824
+ /**
825
+ * List the models the caller may pick this turn — expanded from the curated
826
+ * catalog of the providers the team has connected (client-side model
827
+ * selection). Backs the composer's model picker. Scoped to the active agent
828
+ * via X-Agent-ID, same as {@link getAgentStatus}.
829
+ */
830
+ getModels(): Promise<ModelOption[]>;
790
831
  getSkills(): Promise<SkillInfo[]>;
791
832
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
792
833
  submitToolResult(request: ToolResultRequest): Promise<void>;
@@ -1066,7 +1107,7 @@ declare function streamJobSSE(options: StreamJobSSEOptions): AsyncGenerator<Chat
1066
1107
  */
1067
1108
 
1068
1109
  type StreamState = "idle" | "streaming" | "restoring" | "detached";
1069
- interface SendOptions {
1110
+ interface SendOptions extends ModelChoiceOptions {
1070
1111
  enableSearch?: boolean;
1071
1112
  agentName?: string;
1072
1113
  uploadIds?: string[];
@@ -1202,4 +1243,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1202
1243
  */
1203
1244
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1204
1245
 
1205
- export { type ActiveJob, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
1246
+ export { type ActiveJob, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, type ChatEvent, ChatEventType, type ChatEventTypeValue, ChatSession, type ChatStorage, type ChatStreamEvent, type ChatStreamRequest, ConnectionError, type ContextUpdatePayload, type ContextWarningPayload, type Conversation, type ConversationAsset, type ConversationEvent, type DesktopStreamPayload, type EmbeddedResource, type FeedbackRequest, type FeedbackResponse, InMemoryStorage, type JobCreateResponse, type JobStatus, type JobSummary, LLMNotConfiguredError, type MemoryRecallPayload, type MemoryRecord, type MemoryUpdatePayload, type Message, type ModelChoiceOptions, type ModelOption, type MyToolGrantsPage, type PromptSuggestionPayload, type ProtocolAdapter, ProtocolRegistry, RateLimitError, type RateLimitErrorDetails, type RawSseEvent, type ReasoningEffort, type SendOptions, ServerError, type SkillInfo, StreamAbortedError, type StreamJobSSEOptions, StreamManager, type StreamManagerEvent, type StreamState, type SubagentStartPayload, type SubagentStopPayload, type TaskStatus, type TeamAgentSummary, type TeamSummary, type TitleGeneratedPayload, type TodoItem, type TodoUpdatePayload, type ToolApprovalDecision, type ToolApprovalGrantedPayload, type ToolApprovalRequest, type ToolApprovalRequestedPayload, type ToolApprovalScope, type ToolCallRequest, type ToolDefinition, type ToolGrant, type ToolHandler, type ToolHarnessWarningPayload, type ToolPermissionDeniedPayload, ToolRegistry, type ToolResult, type ToolResultRequest, type TurnUsage, type UIComponentsConfig, type UserUnavailablePayload, type WireBlockDelta, type WireBlockDeltaPayload, type WireBlockKind, type WireBlockStart, type WireBlockStatus, type WireBlockStop, type WireCustomEvent, type WireErrorEvent, type WireEvent, type WireInputArgDelta, type WireInputDelta, type WireKeepalive, type WireMessageStart, type WireMessageStop, type WireOutputDelta, type WireRetryEvent, type WireSignatureDelta, type WireStallWarning, type WireStatusDelta, type WireStopReason, type WireTextDelta, type WireThinkingDelta, type WorkspaceReadyPayload, generateId, isEmbeddedResource, mapSseToChat, parseEmbeddedResource, replayEvents, streamJobSSE, translateDelta };
package/dist/index.js CHANGED
@@ -495,6 +495,24 @@ var AstralformClient = class {
495
495
  avatarUrl: a.avatar_url
496
496
  }));
497
497
  }
498
+ /**
499
+ * List the models the caller may pick this turn — expanded from the curated
500
+ * catalog of the providers the team has connected (client-side model
501
+ * selection). Backs the composer's model picker. Scoped to the active agent
502
+ * via X-Agent-ID, same as {@link getAgentStatus}.
503
+ */
504
+ async getModels() {
505
+ const raw = await this.get("/v1/models");
506
+ return raw.map((m) => ({
507
+ provider: m.provider,
508
+ providerDisplay: m.provider_display,
509
+ model: m.model,
510
+ thinking: m.thinking,
511
+ tools: m.tools,
512
+ vision: m.vision,
513
+ thinkingMode: m.thinking_mode
514
+ }));
515
+ }
498
516
  async getSkills() {
499
517
  const raw = await this.get("/v1/skills");
500
518
  return raw.map((s) => ({
@@ -1246,6 +1264,11 @@ var ChatSession = class {
1246
1264
  this.emit({ type: "connected" });
1247
1265
  }
1248
1266
  async send(content, options) {
1267
+ if (options?.provider == null !== (options?.model == null)) {
1268
+ throw new Error(
1269
+ "`provider` and `model` must be supplied together (client-side model selection)."
1270
+ );
1271
+ }
1249
1272
  if (this.isStreaming) return;
1250
1273
  const conversationId = options?.conversationId ?? this.conversationId ?? void 0;
1251
1274
  const userMessage = {
@@ -1270,7 +1293,12 @@ var ChatSession = class {
1270
1293
  upload_ids: options?.uploadIds,
1271
1294
  agent_name: options?.agentName,
1272
1295
  enable_search: options?.enableSearch,
1273
- plan_mode: options?.planMode
1296
+ plan_mode: options?.planMode,
1297
+ // Per-request model choice (client-side model selection).
1298
+ provider: options?.provider,
1299
+ model: options?.model,
1300
+ reasoning_effort: options?.reasoningEffort,
1301
+ temperature: options?.temperature
1274
1302
  };
1275
1303
  await this.processStream(request);
1276
1304
  }
@@ -1777,6 +1805,11 @@ var StreamManager = class {
1777
1805
  }
1778
1806
  // ── Send ──────────────────────────────────────────────────────
1779
1807
  async send(content, options) {
1808
+ if (options?.provider == null !== (options?.model == null)) {
1809
+ throw new Error(
1810
+ "`provider` and `model` must be supplied together (client-side model selection)."
1811
+ );
1812
+ }
1780
1813
  if (this._state === "streaming") return;
1781
1814
  if (!this._activeConversationId) {
1782
1815
  const id = await this.session.createNewConversation();
@@ -1788,7 +1821,11 @@ var StreamManager = class {
1788
1821
  enableSearch: options?.enableSearch,
1789
1822
  agentName: options?.agentName,
1790
1823
  uploadIds: options?.uploadIds,
1791
- planMode: options?.planMode
1824
+ planMode: options?.planMode,
1825
+ provider: options?.provider,
1826
+ model: options?.model,
1827
+ reasoningEffort: options?.reasoningEffort,
1828
+ temperature: options?.temperature
1792
1829
  });
1793
1830
  } catch {
1794
1831
  }