@astralform/js 3.0.1 → 3.2.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,21 @@ 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
+ /** whether the model accepts a configurable reasoning effort (low/medium/high); false for always-on-thinking / think-tags models where effort is a no-op */
742
+ supportsEffort: boolean;
743
+ }
708
744
  interface ConversationAsset {
709
745
  id: string;
710
746
  kind: "upload" | "output";
@@ -787,6 +823,13 @@ declare class AstralformClient {
787
823
  * which enumerates the team-level agents a signed-in user can open.
788
824
  */
789
825
  getAgents(): Promise<AgentInfo[]>;
826
+ /**
827
+ * List the models the caller may pick this turn — expanded from the curated
828
+ * catalog of the providers the team has connected (client-side model
829
+ * selection). Backs the composer's model picker. Scoped to the active agent
830
+ * via X-Agent-ID, same as {@link getAgentStatus}.
831
+ */
832
+ getModels(): Promise<ModelOption[]>;
790
833
  getSkills(): Promise<SkillInfo[]>;
791
834
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
792
835
  submitToolResult(request: ToolResultRequest): Promise<void>;
@@ -1066,7 +1109,7 @@ declare function streamJobSSE(options: StreamJobSSEOptions): AsyncGenerator<Chat
1066
1109
  */
1067
1110
 
1068
1111
  type StreamState = "idle" | "streaming" | "restoring" | "detached";
1069
- interface SendOptions {
1112
+ interface SendOptions extends ModelChoiceOptions {
1070
1113
  enableSearch?: boolean;
1071
1114
  agentName?: string;
1072
1115
  uploadIds?: string[];
@@ -1202,4 +1245,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1202
1245
  */
1203
1246
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1204
1247
 
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 };
1248
+ 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,21 @@ 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
+ /** whether the model accepts a configurable reasoning effort (low/medium/high); false for always-on-thinking / think-tags models where effort is a no-op */
742
+ supportsEffort: boolean;
743
+ }
708
744
  interface ConversationAsset {
709
745
  id: string;
710
746
  kind: "upload" | "output";
@@ -787,6 +823,13 @@ declare class AstralformClient {
787
823
  * which enumerates the team-level agents a signed-in user can open.
788
824
  */
789
825
  getAgents(): Promise<AgentInfo[]>;
826
+ /**
827
+ * List the models the caller may pick this turn — expanded from the curated
828
+ * catalog of the providers the team has connected (client-side model
829
+ * selection). Backs the composer's model picker. Scoped to the active agent
830
+ * via X-Agent-ID, same as {@link getAgentStatus}.
831
+ */
832
+ getModels(): Promise<ModelOption[]>;
790
833
  getSkills(): Promise<SkillInfo[]>;
791
834
  getConversationEvents(conversationId: string, jobId?: string): Promise<ConversationEvent[]>;
792
835
  submitToolResult(request: ToolResultRequest): Promise<void>;
@@ -1066,7 +1109,7 @@ declare function streamJobSSE(options: StreamJobSSEOptions): AsyncGenerator<Chat
1066
1109
  */
1067
1110
 
1068
1111
  type StreamState = "idle" | "streaming" | "restoring" | "detached";
1069
- interface SendOptions {
1112
+ interface SendOptions extends ModelChoiceOptions {
1070
1113
  enableSearch?: boolean;
1071
1114
  agentName?: string;
1072
1115
  uploadIds?: string[];
@@ -1202,4 +1245,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1202
1245
  */
1203
1246
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1204
1247
 
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 };
1248
+ 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,29 @@ 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
+ // Coerce so the non-optional `supportsEffort: boolean` stays honest even
515
+ // against an older backend that omits `supports_effort` (→ false = safe:
516
+ // the effort control is hidden). Unlike the always-present siblings above,
517
+ // this field can be absent, so it's the one that needs coercion.
518
+ supportsEffort: Boolean(m.supports_effort)
519
+ }));
520
+ }
498
521
  async getSkills() {
499
522
  const raw = await this.get("/v1/skills");
500
523
  return raw.map((s) => ({
@@ -1246,6 +1269,11 @@ var ChatSession = class {
1246
1269
  this.emit({ type: "connected" });
1247
1270
  }
1248
1271
  async send(content, options) {
1272
+ if (options?.provider == null !== (options?.model == null)) {
1273
+ throw new Error(
1274
+ "`provider` and `model` must be supplied together (client-side model selection)."
1275
+ );
1276
+ }
1249
1277
  if (this.isStreaming) return;
1250
1278
  const conversationId = options?.conversationId ?? this.conversationId ?? void 0;
1251
1279
  const userMessage = {
@@ -1270,7 +1298,12 @@ var ChatSession = class {
1270
1298
  upload_ids: options?.uploadIds,
1271
1299
  agent_name: options?.agentName,
1272
1300
  enable_search: options?.enableSearch,
1273
- plan_mode: options?.planMode
1301
+ plan_mode: options?.planMode,
1302
+ // Per-request model choice (client-side model selection).
1303
+ provider: options?.provider,
1304
+ model: options?.model,
1305
+ reasoning_effort: options?.reasoningEffort,
1306
+ temperature: options?.temperature
1274
1307
  };
1275
1308
  await this.processStream(request);
1276
1309
  }
@@ -1777,6 +1810,11 @@ var StreamManager = class {
1777
1810
  }
1778
1811
  // ── Send ──────────────────────────────────────────────────────
1779
1812
  async send(content, options) {
1813
+ if (options?.provider == null !== (options?.model == null)) {
1814
+ throw new Error(
1815
+ "`provider` and `model` must be supplied together (client-side model selection)."
1816
+ );
1817
+ }
1780
1818
  if (this._state === "streaming") return;
1781
1819
  if (!this._activeConversationId) {
1782
1820
  const id = await this.session.createNewConversation();
@@ -1788,7 +1826,11 @@ var StreamManager = class {
1788
1826
  enableSearch: options?.enableSearch,
1789
1827
  agentName: options?.agentName,
1790
1828
  uploadIds: options?.uploadIds,
1791
- planMode: options?.planMode
1829
+ planMode: options?.planMode,
1830
+ provider: options?.provider,
1831
+ model: options?.model,
1832
+ reasoningEffort: options?.reasoningEffort,
1833
+ temperature: options?.temperature
1792
1834
  });
1793
1835
  } catch {
1794
1836
  }