@astralform/js 6.0.3 → 7.0.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
@@ -629,6 +629,8 @@ interface TeamSummary {
629
629
  interface TeamAgentSummary {
630
630
  id: string;
631
631
  name: string;
632
+ /** Human-readable label for pickers, when set (wire: `display_name`). Falls back to `name`. */
633
+ displayName?: string | null;
632
634
  teamId: string;
633
635
  createdAt: string;
634
636
  updatedAt: string;
@@ -681,8 +683,47 @@ interface FeedbackResponse {
681
683
  comment: string | null;
682
684
  createdAt: string;
683
685
  }
684
- /** Reasoning effort a caller may request for a turn (client-side model selection). */
685
- 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
+ }
686
727
  /**
687
728
  * The per-request model choice (client-side model selection). `provider` and
688
729
  * `model` are paired — send both or neither; when omitted, the server reuses the
@@ -863,9 +904,16 @@ interface ModelOption {
863
904
  thinking: boolean;
864
905
  tools: boolean;
865
906
  vision: boolean;
866
- thinkingMode: string;
867
- /** 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 */
868
- 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;
869
917
  }
870
918
  interface ConversationAsset {
871
919
  id: string;
@@ -1517,6 +1565,20 @@ type StreamManagerEvent = {
1517
1565
  type: "versionsReady";
1518
1566
  conversationId: string;
1519
1567
  count: number;
1568
+ } | {
1569
+ /**
1570
+ * A history replay ran to the end — emitted for EVERY restored
1571
+ * conversation, whatever its jobs' statuses. This is the signal to
1572
+ * rehydrate per-turn state (attachment chips, composer modes, goal
1573
+ * runs) from the jobs endpoint. It exists separately from
1574
+ * ``versionsReady`` because that one is completed-only by contract
1575
+ * (a version is an answer to switch to), and a conversation whose
1576
+ * only turns were stopped or failed still needs this pass — gating
1577
+ * rehydration on ``versionsReady`` left such conversations
1578
+ * permanently chip-less.
1579
+ */
1580
+ type: "restoreSettled";
1581
+ conversationId: string;
1520
1582
  };
1521
1583
  type EventHandler = (event: StreamManagerEvent) => void;
1522
1584
  declare class StreamManager {
@@ -1741,4 +1803,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1741
1803
  */
1742
1804
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1743
1805
 
1744
- 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 };
1806
+ 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
@@ -629,6 +629,8 @@ interface TeamSummary {
629
629
  interface TeamAgentSummary {
630
630
  id: string;
631
631
  name: string;
632
+ /** Human-readable label for pickers, when set (wire: `display_name`). Falls back to `name`. */
633
+ displayName?: string | null;
632
634
  teamId: string;
633
635
  createdAt: string;
634
636
  updatedAt: string;
@@ -681,8 +683,47 @@ interface FeedbackResponse {
681
683
  comment: string | null;
682
684
  createdAt: string;
683
685
  }
684
- /** Reasoning effort a caller may request for a turn (client-side model selection). */
685
- 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
+ }
686
727
  /**
687
728
  * The per-request model choice (client-side model selection). `provider` and
688
729
  * `model` are paired — send both or neither; when omitted, the server reuses the
@@ -863,9 +904,16 @@ interface ModelOption {
863
904
  thinking: boolean;
864
905
  tools: boolean;
865
906
  vision: boolean;
866
- thinkingMode: string;
867
- /** 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 */
868
- 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;
869
917
  }
870
918
  interface ConversationAsset {
871
919
  id: string;
@@ -1517,6 +1565,20 @@ type StreamManagerEvent = {
1517
1565
  type: "versionsReady";
1518
1566
  conversationId: string;
1519
1567
  count: number;
1568
+ } | {
1569
+ /**
1570
+ * A history replay ran to the end — emitted for EVERY restored
1571
+ * conversation, whatever its jobs' statuses. This is the signal to
1572
+ * rehydrate per-turn state (attachment chips, composer modes, goal
1573
+ * runs) from the jobs endpoint. It exists separately from
1574
+ * ``versionsReady`` because that one is completed-only by contract
1575
+ * (a version is an answer to switch to), and a conversation whose
1576
+ * only turns were stopped or failed still needs this pass — gating
1577
+ * rehydration on ``versionsReady`` left such conversations
1578
+ * permanently chip-less.
1579
+ */
1580
+ type: "restoreSettled";
1581
+ conversationId: string;
1520
1582
  };
1521
1583
  type EventHandler = (event: StreamManagerEvent) => void;
1522
1584
  declare class StreamManager {
@@ -1741,4 +1803,4 @@ declare function isEmbeddedResource(value: unknown): value is {
1741
1803
  */
1742
1804
  declare function parseEmbeddedResource(value: unknown): EmbeddedResource | null;
1743
1805
 
1744
- 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 };
1806
+ 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,7 @@ 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) => camelizeKeys(m));
595
582
  }
596
583
  async getSkills() {
597
584
  const raw = await this.get("/v1/skills");
@@ -2780,6 +2767,7 @@ var StreamManager = class {
2780
2767
  );
2781
2768
  }
2782
2769
  if (stopReplay()) return false;
2770
+ this.emit({ type: "restoreSettled", conversationId });
2783
2771
  const versionCount = replayableJobs.filter(
2784
2772
  (j) => j.status === "completed"
2785
2773
  ).length;