@astralform/js 6.0.4 → 7.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
@@ -683,8 +683,47 @@ interface FeedbackResponse {
683
683
  comment: string | null;
684
684
  createdAt: string;
685
685
  }
686
- /** Reasoning effort a caller may request for a turn (client-side model selection). */
687
- type ReasoningEffort = "low" | "medium" | "high";
686
+ /**
687
+ * One rung on a model's thinking ladder.
688
+ *
689
+ * These strings are not ours to choose: they are verbatim what OpenAI,
690
+ * DeepSeek and Z.AI each enumerate when rejecting an invalid
691
+ * `reasoning_effort`, so renaming one means sending a value the provider 400s
692
+ * on. A given model accepts a SUBSET — read it from
693
+ * {@link ModelOption.thinkingControl}, never assume all seven.
694
+ *
695
+ * `"none"` is a real off on the providers that list it, and is distinct from
696
+ * omitting the effort entirely: omitting means "use the model's own default",
697
+ * which on some models still reasons.
698
+ */
699
+ type EffortRung = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
700
+ /**
701
+ * A reasoning effort a caller may request. Widened from `low | medium | high`
702
+ * once the providers were probed and shown to expose seven values.
703
+ */
704
+ type ReasoningEffort = EffortRung;
705
+ /** One selectable rung, with the label every client should display for it. */
706
+ interface ThinkingRungOption {
707
+ id: EffortRung;
708
+ /** Server-owned, so two clients cannot word the same rung differently. */
709
+ label: string;
710
+ }
711
+ /**
712
+ * A model's thinking control, from `GET /v1/models`.
713
+ *
714
+ * `ladder` runs least-effort-first. That order is the menu order and the basis
715
+ * of any proportional indicator — a rung's INDEX is its strength. It contains a
716
+ * `none` rung if and only if the model can genuinely stop reasoning, so an Off
717
+ * is an ordinary rung rather than something a client synthesizes.
718
+ *
719
+ * `default` is the rung a run uses when the caller picks nothing, and is
720
+ * nullable: for the OpenAI-style family the server sends no effort at all, so
721
+ * the choice belongs to the provider and naming a rung would be a guess.
722
+ */
723
+ interface ThinkingDescriptor {
724
+ ladder: ThinkingRungOption[];
725
+ default: EffortRung | null;
726
+ }
688
727
  /**
689
728
  * The per-request model choice (client-side model selection). `provider` and
690
729
  * `model` are paired — send both or neither; when omitted, the server reuses the
@@ -865,9 +904,29 @@ interface ModelOption {
865
904
  thinking: boolean;
866
905
  tools: boolean;
867
906
  vision: boolean;
868
- thinkingMode: string;
869
- /** 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 */
870
- supportsEffort: boolean;
907
+ /**
908
+ * The model's thinking control, or absent when it has none.
909
+ *
910
+ * Its ABSENCE is the signal to render no control — that replaces a separate
911
+ * `supportsEffort` flag which had to be kept consistent with the level list
912
+ * beside it. Distinct from `thinking` above, which says only whether the
913
+ * model reasons at all: a model can reason with no control a client can
914
+ * drive.
915
+ */
916
+ thinkingControl?: ThinkingDescriptor;
917
+ /** the provider's brand mark (picker tiles); null until the backend rollout / for icon-less providers */
918
+ iconUrl?: string | null;
919
+ /** when the CALLER last ran this model (picker "Recent" ordering); null for a never-used model */
920
+ lastUsedAt?: string | null;
921
+ /** how many times the caller has run this model; null alongside lastUsedAt */
922
+ useCount?: number | null;
923
+ /**
924
+ * The model's context window in tokens, as the serving provider reports it
925
+ * — which is not always the model's headline number (a provider may serve
926
+ * a smaller window than the model supports). Null when the backend does not
927
+ * state one.
928
+ */
929
+ contextWindow?: number | null;
871
930
  }
872
931
  interface ConversationAsset {
873
932
  id: string;
@@ -1757,4 +1816,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1757
1816
  */
1758
1817
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1759
1818
 
1760
- export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, 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 NoteUpdatePayload, type PlanUpdatePayload, 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 };
1819
+ export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, 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 EffortRung, 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 NoteUpdatePayload, type PlanUpdatePayload, 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 ThinkingDescriptor, type ThinkingRungOption, 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
@@ -683,8 +683,47 @@ interface FeedbackResponse {
683
683
  comment: string | null;
684
684
  createdAt: string;
685
685
  }
686
- /** Reasoning effort a caller may request for a turn (client-side model selection). */
687
- type ReasoningEffort = "low" | "medium" | "high";
686
+ /**
687
+ * One rung on a model's thinking ladder.
688
+ *
689
+ * These strings are not ours to choose: they are verbatim what OpenAI,
690
+ * DeepSeek and Z.AI each enumerate when rejecting an invalid
691
+ * `reasoning_effort`, so renaming one means sending a value the provider 400s
692
+ * on. A given model accepts a SUBSET — read it from
693
+ * {@link ModelOption.thinkingControl}, never assume all seven.
694
+ *
695
+ * `"none"` is a real off on the providers that list it, and is distinct from
696
+ * omitting the effort entirely: omitting means "use the model's own default",
697
+ * which on some models still reasons.
698
+ */
699
+ type EffortRung = "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
700
+ /**
701
+ * A reasoning effort a caller may request. Widened from `low | medium | high`
702
+ * once the providers were probed and shown to expose seven values.
703
+ */
704
+ type ReasoningEffort = EffortRung;
705
+ /** One selectable rung, with the label every client should display for it. */
706
+ interface ThinkingRungOption {
707
+ id: EffortRung;
708
+ /** Server-owned, so two clients cannot word the same rung differently. */
709
+ label: string;
710
+ }
711
+ /**
712
+ * A model's thinking control, from `GET /v1/models`.
713
+ *
714
+ * `ladder` runs least-effort-first. That order is the menu order and the basis
715
+ * of any proportional indicator — a rung's INDEX is its strength. It contains a
716
+ * `none` rung if and only if the model can genuinely stop reasoning, so an Off
717
+ * is an ordinary rung rather than something a client synthesizes.
718
+ *
719
+ * `default` is the rung a run uses when the caller picks nothing, and is
720
+ * nullable: for the OpenAI-style family the server sends no effort at all, so
721
+ * the choice belongs to the provider and naming a rung would be a guess.
722
+ */
723
+ interface ThinkingDescriptor {
724
+ ladder: ThinkingRungOption[];
725
+ default: EffortRung | null;
726
+ }
688
727
  /**
689
728
  * The per-request model choice (client-side model selection). `provider` and
690
729
  * `model` are paired — send both or neither; when omitted, the server reuses the
@@ -865,9 +904,29 @@ interface ModelOption {
865
904
  thinking: boolean;
866
905
  tools: boolean;
867
906
  vision: boolean;
868
- thinkingMode: string;
869
- /** 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 */
870
- supportsEffort: boolean;
907
+ /**
908
+ * The model's thinking control, or absent when it has none.
909
+ *
910
+ * Its ABSENCE is the signal to render no control — that replaces a separate
911
+ * `supportsEffort` flag which had to be kept consistent with the level list
912
+ * beside it. Distinct from `thinking` above, which says only whether the
913
+ * model reasons at all: a model can reason with no control a client can
914
+ * drive.
915
+ */
916
+ thinkingControl?: ThinkingDescriptor;
917
+ /** the provider's brand mark (picker tiles); null until the backend rollout / for icon-less providers */
918
+ iconUrl?: string | null;
919
+ /** when the CALLER last ran this model (picker "Recent" ordering); null for a never-used model */
920
+ lastUsedAt?: string | null;
921
+ /** how many times the caller has run this model; null alongside lastUsedAt */
922
+ useCount?: number | null;
923
+ /**
924
+ * The model's context window in tokens, as the serving provider reports it
925
+ * — which is not always the model's headline number (a provider may serve
926
+ * a smaller window than the model supports). Null when the backend does not
927
+ * state one.
928
+ */
929
+ contextWindow?: number | null;
871
930
  }
872
931
  interface ConversationAsset {
873
932
  id: string;
@@ -1757,4 +1816,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1757
1816
  */
1758
1817
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1759
1818
 
1760
- export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, 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 NoteUpdatePayload, type PlanUpdatePayload, 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 };
1819
+ export { type ActiveJob, type AgentCapability, type AgentIdentity, type AgentInfo, type AgentStatus, type AssetCreatedPayload, type AstralformApiKeyConfig, AstralformClient, type AstralformConfig, AstralformError, type AstralformUserTokenConfig, type AttachmentStagedPayload, AuthenticationError, type BlockDeltaPayload, CONVERSATION_PAGE_SIZE, 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 EffortRung, 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 NoteUpdatePayload, type PlanUpdatePayload, 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 ThinkingDescriptor, type ThinkingRungOption, 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
@@ -578,20 +578,16 @@ var AstralformClient = class {
578
578
  */
579
579
  async getModels() {
580
580
  const raw = await this.get("/v1/models");
581
- return raw.map((m) => ({
582
- provider: m.provider,
583
- providerDisplay: m.provider_display,
584
- model: m.model,
585
- thinking: m.thinking,
586
- tools: m.tools,
587
- vision: m.vision,
588
- thinkingMode: m.thinking_mode,
589
- // Coerce so the non-optional `supportsEffort: boolean` stays honest even
590
- // against an older backend that omits `supports_effort` (→ false = safe:
591
- // the effort control is hidden). Unlike the always-present siblings above,
592
- // this field can be absent, so it's the one that needs coercion.
593
- supportsEffort: Boolean(m.supports_effort)
594
- }));
581
+ return raw.map((m) => {
582
+ const option = camelizeKeys(m);
583
+ return {
584
+ ...option,
585
+ iconUrl: option.iconUrl ?? null,
586
+ lastUsedAt: option.lastUsedAt ?? null,
587
+ useCount: option.useCount ?? null,
588
+ contextWindow: option.contextWindow ?? null
589
+ };
590
+ });
595
591
  }
596
592
  async getSkills() {
597
593
  const raw = await this.get("/v1/skills");