@fifthrevision/axle 0.28.0 → 0.30.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/models.d.ts CHANGED
@@ -115,8 +115,10 @@ declare const Models: {
115
115
  readonly QWEN3_6_FLASH: "qwen/qwen3.6-flash";
116
116
  readonly QWEN3_6_MAX_PREVIEW: "qwen/qwen3.6-max-preview";
117
117
  readonly QWEN3_6_PLUS: "qwen/qwen3.6-plus";
118
+ readonly QWEN3_7_FLASH: "qwen/qwen3.7-flash";
118
119
  readonly QWEN3_7_MAX: "qwen/qwen3.7-max";
119
120
  readonly QWEN3_7_PLUS: "qwen/qwen3.7-plus";
121
+ readonly QWEN3_8_MAX: "qwen/qwen3.8-max";
120
122
  };
121
123
  readonly ZAI: {
122
124
  readonly GLM_5_1: "zai/glm-5.1";
package/dist/models.js CHANGED
@@ -1 +1 @@
1
- const e={Anthropic:{CLAUDE_FABLE_5:`anthropic/claude-fable-5`,CLAUDE_HAIKU_4_5:`anthropic/claude-haiku-4-5`,CLAUDE_HAIKU_4_5_20251001:`anthropic/claude-haiku-4-5-20251001`,CLAUDE_OPUS_4_1:`anthropic/claude-opus-4-1`,CLAUDE_OPUS_4_1_20250805:`anthropic/claude-opus-4-1-20250805`,CLAUDE_OPUS_4_5:`anthropic/claude-opus-4-5`,CLAUDE_OPUS_4_5_20251101:`anthropic/claude-opus-4-5-20251101`,CLAUDE_OPUS_4_6:`anthropic/claude-opus-4-6`,CLAUDE_OPUS_4_7:`anthropic/claude-opus-4-7`,CLAUDE_OPUS_4_8:`anthropic/claude-opus-4-8`,CLAUDE_OPUS_5:`anthropic/claude-opus-5`,CLAUDE_SONNET_4_5:`anthropic/claude-sonnet-4-5`,CLAUDE_SONNET_4_5_20250929:`anthropic/claude-sonnet-4-5-20250929`,CLAUDE_SONNET_4_6:`anthropic/claude-sonnet-4-6`,CLAUDE_SONNET_5:`anthropic/claude-sonnet-5`},DeepSeek:{DEEPSEEK_V4_FLASH:`deepseek/deepseek-v4-flash`,DEEPSEEK_V4_PRO:`deepseek/deepseek-v4-pro`},Google:{GEMINI_2_0_FLASH:`google/gemini-2.0-flash`,GEMINI_2_0_FLASH_LITE:`google/gemini-2.0-flash-lite`,GEMINI_2_5_FLASH:`google/gemini-2.5-flash`,GEMINI_2_5_FLASH_LITE:`google/gemini-2.5-flash-lite`,GEMINI_2_5_PRO:`google/gemini-2.5-pro`,GEMINI_3_FLASH_PREVIEW:`google/gemini-3-flash-preview`,GEMINI_3_PRO_PREVIEW:`google/gemini-3-pro-preview`,GEMINI_3_1_FLASH_LITE:`google/gemini-3.1-flash-lite`,GEMINI_3_1_FLASH_LITE_PREVIEW:`google/gemini-3.1-flash-lite-preview`,GEMINI_3_1_PRO_PREVIEW:`google/gemini-3.1-pro-preview`,GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS:`google/gemini-3.1-pro-preview-customtools`,GEMINI_3_5_FLASH:`google/gemini-3.5-flash`,GEMINI_3_5_FLASH_LITE:`google/gemini-3.5-flash-lite`,GEMINI_3_6_FLASH:`google/gemini-3.6-flash`,GEMINI_FLASH_LATEST:`google/gemini-flash-latest`,GEMINI_FLASH_LITE_LATEST:`google/gemini-flash-lite-latest`,GEMMA_4_26B_A4B_IT:`google/gemma-4-26b-a4b-it`,GEMMA_4_31B_IT:`google/gemma-4-31b-it`},MiniMax:{MINIMAX_M2_7:`minimax/MiniMax-M2.7`,MINIMAX_M2_7_HIGHSPEED:`minimax/MiniMax-M2.7-highspeed`,MINIMAX_M3:`minimax/MiniMax-M3`},Mistral:{MAGISTRAL_MEDIUM_LATEST:`mistral/magistral-medium-latest`,MAGISTRAL_SMALL:`mistral/magistral-small`,MINISTRAL_3B_LATEST:`mistral/ministral-3b-latest`,MINISTRAL_8B_LATEST:`mistral/ministral-8b-latest`,MISTRAL_LARGE_LATEST:`mistral/mistral-large-latest`,MISTRAL_MEDIUM_LATEST:`mistral/mistral-medium-latest`,MISTRAL_SMALL_LATEST:`mistral/mistral-small-latest`},Moonshot:{KIMI_K2_6:`moonshotai/kimi-k2.6`,KIMI_K2_7_CODE:`moonshotai/kimi-k2.7-code`,KIMI_K2_7_CODE_HIGHSPEED:`moonshotai/kimi-k2.7-code-highspeed`,KIMI_K3:`moonshotai/kimi-k3`},OpenAI:{GPT_4_1:`openai/gpt-4.1`,GPT_4_1_MINI:`openai/gpt-4.1-mini`,GPT_4_1_NANO:`openai/gpt-4.1-nano`,GPT_4O_2024_08_06:`openai/gpt-4o-2024-08-06`,GPT_4O_2024_11_20:`openai/gpt-4o-2024-11-20`,GPT_4O_MINI:`openai/gpt-4o-mini`,GPT_5:`openai/gpt-5`,GPT_5_MINI:`openai/gpt-5-mini`,GPT_5_NANO:`openai/gpt-5-nano`,GPT_5_PRO:`openai/gpt-5-pro`,GPT_5_1:`openai/gpt-5.1`,GPT_5_2:`openai/gpt-5.2`,GPT_5_2_CHAT_LATEST:`openai/gpt-5.2-chat-latest`,GPT_5_2_PRO:`openai/gpt-5.2-pro`,GPT_5_3_CHAT_LATEST:`openai/gpt-5.3-chat-latest`,GPT_5_3_CODEX:`openai/gpt-5.3-codex`,GPT_5_3_CODEX_SPARK:`openai/gpt-5.3-codex-spark`,GPT_5_4:`openai/gpt-5.4`,GPT_5_4_MINI:`openai/gpt-5.4-mini`,GPT_5_4_NANO:`openai/gpt-5.4-nano`,GPT_5_4_PRO:`openai/gpt-5.4-pro`,GPT_5_5:`openai/gpt-5.5`,GPT_5_5_PRO:`openai/gpt-5.5-pro`,GPT_5_6:`openai/gpt-5.6`,GPT_5_6_LUNA:`openai/gpt-5.6-luna`,GPT_5_6_SOL:`openai/gpt-5.6-sol`,GPT_5_6_TERRA:`openai/gpt-5.6-terra`,O1:`openai/o1`,O1_PRO:`openai/o1-pro`,O3:`openai/o3`,O3_MINI:`openai/o3-mini`,O3_PRO:`openai/o3-pro`,O4_MINI:`openai/o4-mini`},Qwen:{QWEN3_5_122B_A10B:`qwen/qwen3.5-122b-a10b`,QWEN3_5_27B:`qwen/qwen3.5-27b`,QWEN3_5_35B_A3B:`qwen/qwen3.5-35b-a3b`,QWEN3_5_397B_A17B:`qwen/qwen3.5-397b-a17b`,QWEN3_5_9B:`qwen/qwen3.5-9b`,QWEN3_5_FLASH_02_23:`qwen/qwen3.5-flash-02-23`,QWEN3_5_PLUS_02_15:`qwen/qwen3.5-plus-02-15`,QWEN3_5_PLUS_20260420:`qwen/qwen3.5-plus-20260420`,QWEN3_6_27B:`qwen/qwen3.6-27b`,QWEN3_6_35B_A3B:`qwen/qwen3.6-35b-a3b`,QWEN3_6_FLASH:`qwen/qwen3.6-flash`,QWEN3_6_MAX_PREVIEW:`qwen/qwen3.6-max-preview`,QWEN3_6_PLUS:`qwen/qwen3.6-plus`,QWEN3_7_MAX:`qwen/qwen3.7-max`,QWEN3_7_PLUS:`qwen/qwen3.7-plus`},ZAI:{GLM_5_1:`zai/glm-5.1`,GLM_5_2:`zai/glm-5.2`}},t={[e.Anthropic.CLAUDE_FABLE_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_HAIKU_4_5]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_HAIKU_4_5_20251001]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_1]:{contextWindow:2e5,maxOutputTokens:32e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_1_20250805]:{contextWindow:2e5,maxOutputTokens:32e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_5]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_5_20251101]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_6]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_7]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_8]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_5]:{contextWindow:1e6,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_5_20250929]:{contextWindow:1e6,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_6]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.DeepSeek.DEEPSEEK_V4_FLASH]:{contextWindow:1e6,maxOutputTokens:384e3,multimodal:!1},[e.DeepSeek.DEEPSEEK_V4_PRO]:{contextWindow:1e6,maxOutputTokens:384e3,multimodal:!1},[e.Google.GEMINI_2_0_FLASH]:{contextWindow:1048576,maxOutputTokens:8192,multimodal:!0},[e.Google.GEMINI_2_0_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:8192,multimodal:!0},[e.Google.GEMINI_2_5_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_2_5_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_2_5_PRO]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_FLASH_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_PRO_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_FLASH_LITE_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_PRO_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_5_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_5_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_6_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_FLASH_LATEST]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_FLASH_LITE_LATEST]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMMA_4_26B_A4B_IT]:{contextWindow:262144,maxOutputTokens:32768,multimodal:!0},[e.Google.GEMMA_4_31B_IT]:{contextWindow:262144,maxOutputTokens:32768,multimodal:!0},[e.MiniMax.MINIMAX_M2_7]:{contextWindow:204800,maxOutputTokens:131072,multimodal:!1},[e.MiniMax.MINIMAX_M2_7_HIGHSPEED]:{contextWindow:204800,maxOutputTokens:131072,multimodal:!1},[e.MiniMax.MINIMAX_M3]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Mistral.MAGISTRAL_MEDIUM_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!1},[e.Mistral.MAGISTRAL_SMALL]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MINISTRAL_3B_LATEST]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MINISTRAL_8B_LATEST]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MISTRAL_LARGE_LATEST]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Mistral.MISTRAL_MEDIUM_LATEST]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Mistral.MISTRAL_SMALL_LATEST]:{contextWindow:256e3,maxOutputTokens:256e3,multimodal:!0},[e.Moonshot.KIMI_K2_6]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K2_7_CODE]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K2_7_CODE_HIGHSPEED]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K3]:{contextWindow:1048576,maxOutputTokens:131072,multimodal:!0},[e.OpenAI.GPT_4_1]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4_1_MINI]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4_1_NANO]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4O_2024_08_06]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_4O_2024_11_20]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_4O_MINI]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_MINI]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_NANO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_PRO]:{contextWindow:4e5,maxOutputTokens:272e3,multimodal:!0},[e.OpenAI.GPT_5_1]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_2]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_2_CHAT_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5_2_PRO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_3_CHAT_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5_3_CODEX]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_3_CODEX_SPARK]:{contextWindow:128e3,maxOutputTokens:32e3,multimodal:!0},[e.OpenAI.GPT_5_4]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_MINI]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_NANO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_PRO]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_5]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_5_PRO]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_LUNA]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_SOL]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_TERRA]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.O1]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O1_PRO]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O3]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O3_MINI]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!1},[e.OpenAI.O3_PRO]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O4_MINI]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.Qwen.QWEN3_5_122B_A10B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_27B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_35B_A3B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_5_397B_A17B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_9B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_5_FLASH_02_23]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_PLUS_02_15]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_PLUS_20260420]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_6_27B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_6_35B_A3B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_6_FLASH]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_6_MAX_PREVIEW]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!1},[e.Qwen.QWEN3_6_PLUS]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_7_MAX]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!1},[e.Qwen.QWEN3_7_PLUS]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.ZAI.GLM_5_1]:{contextWindow:2e5,maxOutputTokens:131072,multimodal:!1},[e.ZAI.GLM_5_2]:{contextWindow:1e6,maxOutputTokens:131072,multimodal:!1}};export{t as ModelInfo,e as Models};
1
+ const e={Anthropic:{CLAUDE_FABLE_5:`anthropic/claude-fable-5`,CLAUDE_HAIKU_4_5:`anthropic/claude-haiku-4-5`,CLAUDE_HAIKU_4_5_20251001:`anthropic/claude-haiku-4-5-20251001`,CLAUDE_OPUS_4_1:`anthropic/claude-opus-4-1`,CLAUDE_OPUS_4_1_20250805:`anthropic/claude-opus-4-1-20250805`,CLAUDE_OPUS_4_5:`anthropic/claude-opus-4-5`,CLAUDE_OPUS_4_5_20251101:`anthropic/claude-opus-4-5-20251101`,CLAUDE_OPUS_4_6:`anthropic/claude-opus-4-6`,CLAUDE_OPUS_4_7:`anthropic/claude-opus-4-7`,CLAUDE_OPUS_4_8:`anthropic/claude-opus-4-8`,CLAUDE_OPUS_5:`anthropic/claude-opus-5`,CLAUDE_SONNET_4_5:`anthropic/claude-sonnet-4-5`,CLAUDE_SONNET_4_5_20250929:`anthropic/claude-sonnet-4-5-20250929`,CLAUDE_SONNET_4_6:`anthropic/claude-sonnet-4-6`,CLAUDE_SONNET_5:`anthropic/claude-sonnet-5`},DeepSeek:{DEEPSEEK_V4_FLASH:`deepseek/deepseek-v4-flash`,DEEPSEEK_V4_PRO:`deepseek/deepseek-v4-pro`},Google:{GEMINI_2_0_FLASH:`google/gemini-2.0-flash`,GEMINI_2_0_FLASH_LITE:`google/gemini-2.0-flash-lite`,GEMINI_2_5_FLASH:`google/gemini-2.5-flash`,GEMINI_2_5_FLASH_LITE:`google/gemini-2.5-flash-lite`,GEMINI_2_5_PRO:`google/gemini-2.5-pro`,GEMINI_3_FLASH_PREVIEW:`google/gemini-3-flash-preview`,GEMINI_3_PRO_PREVIEW:`google/gemini-3-pro-preview`,GEMINI_3_1_FLASH_LITE:`google/gemini-3.1-flash-lite`,GEMINI_3_1_FLASH_LITE_PREVIEW:`google/gemini-3.1-flash-lite-preview`,GEMINI_3_1_PRO_PREVIEW:`google/gemini-3.1-pro-preview`,GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS:`google/gemini-3.1-pro-preview-customtools`,GEMINI_3_5_FLASH:`google/gemini-3.5-flash`,GEMINI_3_5_FLASH_LITE:`google/gemini-3.5-flash-lite`,GEMINI_3_6_FLASH:`google/gemini-3.6-flash`,GEMINI_FLASH_LATEST:`google/gemini-flash-latest`,GEMINI_FLASH_LITE_LATEST:`google/gemini-flash-lite-latest`,GEMMA_4_26B_A4B_IT:`google/gemma-4-26b-a4b-it`,GEMMA_4_31B_IT:`google/gemma-4-31b-it`},MiniMax:{MINIMAX_M2_7:`minimax/MiniMax-M2.7`,MINIMAX_M2_7_HIGHSPEED:`minimax/MiniMax-M2.7-highspeed`,MINIMAX_M3:`minimax/MiniMax-M3`},Mistral:{MAGISTRAL_MEDIUM_LATEST:`mistral/magistral-medium-latest`,MAGISTRAL_SMALL:`mistral/magistral-small`,MINISTRAL_3B_LATEST:`mistral/ministral-3b-latest`,MINISTRAL_8B_LATEST:`mistral/ministral-8b-latest`,MISTRAL_LARGE_LATEST:`mistral/mistral-large-latest`,MISTRAL_MEDIUM_LATEST:`mistral/mistral-medium-latest`,MISTRAL_SMALL_LATEST:`mistral/mistral-small-latest`},Moonshot:{KIMI_K2_6:`moonshotai/kimi-k2.6`,KIMI_K2_7_CODE:`moonshotai/kimi-k2.7-code`,KIMI_K2_7_CODE_HIGHSPEED:`moonshotai/kimi-k2.7-code-highspeed`,KIMI_K3:`moonshotai/kimi-k3`},OpenAI:{GPT_4_1:`openai/gpt-4.1`,GPT_4_1_MINI:`openai/gpt-4.1-mini`,GPT_4_1_NANO:`openai/gpt-4.1-nano`,GPT_4O_2024_08_06:`openai/gpt-4o-2024-08-06`,GPT_4O_2024_11_20:`openai/gpt-4o-2024-11-20`,GPT_4O_MINI:`openai/gpt-4o-mini`,GPT_5:`openai/gpt-5`,GPT_5_MINI:`openai/gpt-5-mini`,GPT_5_NANO:`openai/gpt-5-nano`,GPT_5_PRO:`openai/gpt-5-pro`,GPT_5_1:`openai/gpt-5.1`,GPT_5_2:`openai/gpt-5.2`,GPT_5_2_CHAT_LATEST:`openai/gpt-5.2-chat-latest`,GPT_5_2_PRO:`openai/gpt-5.2-pro`,GPT_5_3_CHAT_LATEST:`openai/gpt-5.3-chat-latest`,GPT_5_3_CODEX:`openai/gpt-5.3-codex`,GPT_5_3_CODEX_SPARK:`openai/gpt-5.3-codex-spark`,GPT_5_4:`openai/gpt-5.4`,GPT_5_4_MINI:`openai/gpt-5.4-mini`,GPT_5_4_NANO:`openai/gpt-5.4-nano`,GPT_5_4_PRO:`openai/gpt-5.4-pro`,GPT_5_5:`openai/gpt-5.5`,GPT_5_5_PRO:`openai/gpt-5.5-pro`,GPT_5_6:`openai/gpt-5.6`,GPT_5_6_LUNA:`openai/gpt-5.6-luna`,GPT_5_6_SOL:`openai/gpt-5.6-sol`,GPT_5_6_TERRA:`openai/gpt-5.6-terra`,O1:`openai/o1`,O1_PRO:`openai/o1-pro`,O3:`openai/o3`,O3_MINI:`openai/o3-mini`,O3_PRO:`openai/o3-pro`,O4_MINI:`openai/o4-mini`},Qwen:{QWEN3_5_122B_A10B:`qwen/qwen3.5-122b-a10b`,QWEN3_5_27B:`qwen/qwen3.5-27b`,QWEN3_5_35B_A3B:`qwen/qwen3.5-35b-a3b`,QWEN3_5_397B_A17B:`qwen/qwen3.5-397b-a17b`,QWEN3_5_9B:`qwen/qwen3.5-9b`,QWEN3_5_FLASH_02_23:`qwen/qwen3.5-flash-02-23`,QWEN3_5_PLUS_02_15:`qwen/qwen3.5-plus-02-15`,QWEN3_5_PLUS_20260420:`qwen/qwen3.5-plus-20260420`,QWEN3_6_27B:`qwen/qwen3.6-27b`,QWEN3_6_35B_A3B:`qwen/qwen3.6-35b-a3b`,QWEN3_6_FLASH:`qwen/qwen3.6-flash`,QWEN3_6_MAX_PREVIEW:`qwen/qwen3.6-max-preview`,QWEN3_6_PLUS:`qwen/qwen3.6-plus`,QWEN3_7_FLASH:`qwen/qwen3.7-flash`,QWEN3_7_MAX:`qwen/qwen3.7-max`,QWEN3_7_PLUS:`qwen/qwen3.7-plus`,QWEN3_8_MAX:`qwen/qwen3.8-max`},ZAI:{GLM_5_1:`zai/glm-5.1`,GLM_5_2:`zai/glm-5.2`}},t={[e.Anthropic.CLAUDE_FABLE_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_HAIKU_4_5]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_HAIKU_4_5_20251001]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_1]:{contextWindow:2e5,maxOutputTokens:32e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_1_20250805]:{contextWindow:2e5,maxOutputTokens:32e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_5]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_5_20251101]:{contextWindow:2e5,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_6]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_7]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_4_8]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_OPUS_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_5]:{contextWindow:1e6,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_5_20250929]:{contextWindow:1e6,maxOutputTokens:64e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_4_6]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Anthropic.CLAUDE_SONNET_5]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.DeepSeek.DEEPSEEK_V4_FLASH]:{contextWindow:1e6,maxOutputTokens:384e3,multimodal:!1},[e.DeepSeek.DEEPSEEK_V4_PRO]:{contextWindow:1e6,maxOutputTokens:384e3,multimodal:!1},[e.Google.GEMINI_2_0_FLASH]:{contextWindow:1048576,maxOutputTokens:8192,multimodal:!0},[e.Google.GEMINI_2_0_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:8192,multimodal:!0},[e.Google.GEMINI_2_5_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_2_5_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_2_5_PRO]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_FLASH_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_PRO_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_FLASH_LITE_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_PRO_PREVIEW]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_1_PRO_PREVIEW_CUSTOMTOOLS]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_5_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_5_FLASH_LITE]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_3_6_FLASH]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_FLASH_LATEST]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMINI_FLASH_LITE_LATEST]:{contextWindow:1048576,maxOutputTokens:65536,multimodal:!0},[e.Google.GEMMA_4_26B_A4B_IT]:{contextWindow:262144,maxOutputTokens:32768,multimodal:!0},[e.Google.GEMMA_4_31B_IT]:{contextWindow:262144,maxOutputTokens:32768,multimodal:!0},[e.MiniMax.MINIMAX_M2_7]:{contextWindow:204800,maxOutputTokens:131072,multimodal:!1},[e.MiniMax.MINIMAX_M2_7_HIGHSPEED]:{contextWindow:204800,maxOutputTokens:131072,multimodal:!1},[e.MiniMax.MINIMAX_M3]:{contextWindow:1e6,maxOutputTokens:128e3,multimodal:!0},[e.Mistral.MAGISTRAL_MEDIUM_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!1},[e.Mistral.MAGISTRAL_SMALL]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MINISTRAL_3B_LATEST]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MINISTRAL_8B_LATEST]:{contextWindow:128e3,maxOutputTokens:128e3,multimodal:!1},[e.Mistral.MISTRAL_LARGE_LATEST]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Mistral.MISTRAL_MEDIUM_LATEST]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Mistral.MISTRAL_SMALL_LATEST]:{contextWindow:256e3,maxOutputTokens:256e3,multimodal:!0},[e.Moonshot.KIMI_K2_6]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K2_7_CODE]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K2_7_CODE_HIGHSPEED]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Moonshot.KIMI_K3]:{contextWindow:1048576,maxOutputTokens:131072,multimodal:!0},[e.OpenAI.GPT_4_1]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4_1_MINI]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4_1_NANO]:{contextWindow:1047576,maxOutputTokens:32768,multimodal:!0},[e.OpenAI.GPT_4O_2024_08_06]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_4O_2024_11_20]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_4O_MINI]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_MINI]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_NANO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_PRO]:{contextWindow:4e5,maxOutputTokens:272e3,multimodal:!0},[e.OpenAI.GPT_5_1]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_2]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_2_CHAT_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5_2_PRO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_3_CHAT_LATEST]:{contextWindow:128e3,maxOutputTokens:16384,multimodal:!0},[e.OpenAI.GPT_5_3_CODEX]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_3_CODEX_SPARK]:{contextWindow:128e3,maxOutputTokens:32e3,multimodal:!0},[e.OpenAI.GPT_5_4]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_MINI]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_NANO]:{contextWindow:4e5,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_4_PRO]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_5]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_5_PRO]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_LUNA]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_SOL]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.GPT_5_6_TERRA]:{contextWindow:105e4,maxOutputTokens:128e3,multimodal:!0},[e.OpenAI.O1]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O1_PRO]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O3]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O3_MINI]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!1},[e.OpenAI.O3_PRO]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.OpenAI.O4_MINI]:{contextWindow:2e5,maxOutputTokens:1e5,multimodal:!0},[e.Qwen.QWEN3_5_122B_A10B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_27B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_35B_A3B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_5_397B_A17B]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_9B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_5_FLASH_02_23]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_PLUS_02_15]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_5_PLUS_20260420]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_6_27B]:{contextWindow:262144,maxOutputTokens:131072,multimodal:!0},[e.Qwen.QWEN3_6_35B_A3B]:{contextWindow:262144,maxOutputTokens:262144,multimodal:!0},[e.Qwen.QWEN3_6_FLASH]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_6_MAX_PREVIEW]:{contextWindow:262144,maxOutputTokens:65536,multimodal:!1},[e.Qwen.QWEN3_6_PLUS]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_7_FLASH]:{contextWindow:1e6,maxOutputTokens:65536,multimodal:!0},[e.Qwen.QWEN3_7_MAX]:{contextWindow:1e6,maxOutputTokens:131072,multimodal:!1},[e.Qwen.QWEN3_7_PLUS]:{contextWindow:1e6,maxOutputTokens:131072,multimodal:!0},[e.Qwen.QWEN3_8_MAX]:{contextWindow:1e6,maxOutputTokens:131072,multimodal:!0},[e.ZAI.GLM_5_1]:{contextWindow:2e5,maxOutputTokens:131072,multimodal:!1},[e.ZAI.GLM_5_2]:{contextWindow:1e6,maxOutputTokens:131072,multimodal:!1}};export{t as ModelInfo,e as Models};
@@ -0,0 +1 @@
1
+ const e=new Set(Object.keys({"turn:user":!0,"turn:start":!0,"turn:end":!0,"compaction:update":!0,"compaction:complete":!0,"compaction:error":!0,"part:start":!0,"text:delta":!0,"text:citation":!0,"thinking:delta":!0,"thinking:summary-delta":!0,"thinking:update":!0,"part:end":!0,"action:args-delta":!0,"action:running":!0,"action:progress":!0,"action:complete":!0,"action:error":!0,"action:child-event":!0,"annotation:start":!0,"annotation:update":!0,"annotation:end":!0,error:!0}));function t(t){return e.has(t.type)}var n=class e{_turns;constructor(e=[]){this._turns=[...e]}get turns(){return this._turns}getTurn(e){return this._turns.find(t=>t.id===e)}apply(e){return t(e)?this.applyTurnEvent(e):{handled:!1,event:e}}applyTurnEvent(t){switch(t.type){case`compaction:update`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`compaction`?{...e,...t.update.summary===void 0?{}:{summary:t.update.summary},...t.update.progress===void 0?{}:{progress:t.update.progress}}:e);case`compaction:complete`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`compaction`?{...e,status:`complete`,progress:1,...t.summary===void 0?{}:{summary:t.summary},timing:t.timing??e.timing}:e);case`compaction:error`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`compaction`?{...e,status:`error`,error:t.error,timing:t.timing??e.timing}:e);case`turn:user`:return this.replaceTurns([...this._turns,t.turn],t);case`turn:start`:{let e={id:t.turnId,owner:`agent`,parts:[],status:`streaming`,...t.timing?{timing:t.timing}:{}};return this.replaceTurns([...this._turns,e],t)}case`part:start`:return this.updateTurn(t.turnId,t,e=>({...e,parts:[...e.parts,t.part]}));case`text:delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`text`?{...e,text:e.text+t.delta}:e);case`text:citation`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`text`?{...e,citations:[...e.citations??[],t.citation]}:e);case`thinking:delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,text:(e.text??``)+t.delta}:e);case`thinking:summary-delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,summary:(e.summary??``)+t.delta}:e);case`thinking:update`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,...t.redacted===void 0?{}:{redacted:t.redacted},...t.continuity?{continuity:t.continuity}:{},...t.providerMetadata?{providerMetadata:t.providerMetadata}:{}}:e);case`part:end`:return this.updatePart(t.turnId,t.partId,t,e=>({...e,timing:t.timing??e.timing}));case`action:args-delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type!==`action`||e.kind!==`tool`?e:{...e,detail:{...e.detail,pendingArgs:t.accumulated}});case`action:running`:return this.updatePart(t.turnId,t.partId,t,e=>{if(e.type!==`action`)return e;if(e.kind===`tool`){let{pendingArgs:n,...r}=e.detail;return{...e,status:`running`,detail:t.parameters?{...r,parameters:t.parameters}:r}}return{...e,status:`running`}});case`action:progress`:return this.updatePart(t.turnId,t.partId,t,e=>{if(e.type!==`action`)return e;let n=e.detail.result,r=n?.type===`in-progress`?n.content:``;return{...e,detail:{...e.detail,result:{type:`in-progress`,content:r+t.chunk}}}});case`action:complete`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`action`?{...e,status:`complete`,detail:{...e.detail,result:t.result},timing:t.timing??e.timing}:e);case`action:error`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`action`?{...e,status:`error`,detail:{...e.detail,result:{type:`error`,error:t.error}},timing:t.timing??e.timing}:e);case`turn:end`:return this.updateTurn(t.turnId,t,e=>({...e,status:t.status,usage:t.usage,timing:t.timing??e.timing}));case`annotation:start`:return this.addAnnotation(t);case`annotation:update`:return this.replaceAnnotation(t,!1);case`annotation:end`:return this.replaceAnnotation(t,!0);case`error`:return t.turnId?this.updateTurn(t.turnId,t,e=>({...e,error:t.error})):this.handled(t);case`action:child-event`:return this.updatePart(t.turnId,t.partId,t,n=>{if(n.type!==`action`||n.kind!==`agent`)return n;let r=new e(n.detail.children);return r.apply(t.event),{...n,detail:{...n.detail,children:[...r.turns]}}});default:return this.handled(t)}}replaceTurns(e,t){return this._turns=e,this.handled(t)}updateTurn(e,t,n){let r=!1,i=this._turns.map(t=>{if(t.id!==e)return t;let i=n(t);return i===t?t:(r=!0,i)});return r?this.replaceTurns(i,t):this.handled(t)}updatePart(e,t,n,r){return this.updateTurn(e,n,e=>{let n=!1,i=e.parts.map(e=>{if(e.id!==t)return e;let i=r(e);return i===e?e:(n=!0,i)});return n?{...e,parts:i}:e})}addAnnotation(e){let t=e.target,n=r(e.annotation);return n?t.type===`turn`?this.updateTurn(t.turnId,e,e=>({...e,annotations:[...e.annotations??[],n]})):this.updatePart(t.turnId,t.partId,e,e=>({...e,annotations:[...e.annotations??[],n]})):this.handled(e)}replaceAnnotation(e,t){let n=e.target,a=r(e.annotation,t);return a?n.type===`turn`?this.updateTurn(n.turnId,e,e=>{let t=i(e.annotations,a);return t?{...e,annotations:t}:e}):this.updatePart(n.turnId,n.partId,e,e=>{let t=i(e.annotations,a);return t?{...e,annotations:t}:e}):this.handled(e)}handled(e){return{handled:!0,event:e}}};function r(e,t=!1){if(!e)return;let n=t?e.status??`complete`:e.status,r={...e,placement:e.placement??`after`};return n?{...r,status:n}:r}function i(e,t){if(!e)return;let n=!1,r=e.map(e=>e.id===t.id?(n=!0,t):e);return n?r:void 0}export{n as t};
@@ -773,38 +773,6 @@ interface ContentPartCitation {
773
773
  providerMetadata?: Record<string, unknown>;
774
774
  }
775
775
  //#endregion
776
- //#region src/messages/compaction.d.ts
777
- /**
778
- * Record of one applied compaction: when it happened. Inspection only —
779
- * records carry no message content and cannot reconstruct the pre-compaction
780
- * conversation.
781
- *
782
- * @experimental Compaction is under active design and may change in any release.
783
- */
784
- interface CompactionRecord {
785
- /** Stable record id. Shared with the compaction turn. */
786
- id: string;
787
- /** ISO timestamp for when the compaction ran. */
788
- at: string;
789
- /**
790
- * Number of messages the compaction produced — the carried-over prefix of
791
- * the active conversation. Absent on records restored from older sessions.
792
- */
793
- messageCount?: number;
794
- }
795
- /**
796
- * Validate that a compacted conversation is structurally well-formed.
797
- *
798
- * The messages must stand alone: every tool call must be answered by the
799
- * tool message(s) immediately following it — providers reject conversations
800
- * that interleave other messages between a call and its result — and every
801
- * tool result must answer a preceding call.
802
- *
803
- * @experimental Compaction is under active design and may change in any release.
804
- * @throws AxleError with code `COMPACTION_INVALID_MESSAGES`
805
- */
806
- declare function validateCompactedMessages(messages: AxleMessage[]): void;
807
- //#endregion
808
776
  //#region src/turns/types.d.ts
809
777
  /**
810
778
  * Lifecycle state for a renderable turn.
@@ -976,27 +944,52 @@ interface ThinkingPart<TAnnotation extends Annotation = Annotation> {
976
944
  timing?: TimingInfo;
977
945
  }
978
946
  /**
979
- * Part marking a compaction of the model-facing conversation.
947
+ * Part recording a compaction of the model-facing conversation — ordinary,
948
+ * fallible turn work, streamed like a tool call. It lands in whatever turn
949
+ * context is natural: the head of a send's turn (`beforeTurn`), the tail
950
+ * (`afterTurn`), or its own engine-opened turn (`manual`). `part:start`
951
+ * delivers it `running`; `compaction:update` replaces transient display
952
+ * fields; `compaction:complete` / `compaction:error` settle it. A compaction
953
+ * declined by `shouldCompactOnTrigger` never appears at all.
980
954
  *
981
- * Compaction renders as an agent turn containing this single part. The turn's
982
- * `status` carries the lifecycle: `"streaming"` while the compaction callback
983
- * runs, `"complete"` once applied, `"error"` on failure. Skipped compactions
984
- * are removed from the turns, not settled.
955
+ * A settled `complete` part means the message swap applied, atomically. An
956
+ * `error` part records a failed attempt non-fatal for automatic triggers;
957
+ * the conversation continued uncompacted.
985
958
  *
986
959
  * @experimental Compaction is under active design and may change in any release.
987
960
  */
988
961
  interface CompactionPart<TAnnotation extends Annotation = Annotation> {
989
- /** Stable part id. Shared with the compaction record. */
962
+ /** Stable part id: the compaction id (`ctx.id` in the callback). */
990
963
  id: string;
991
964
  /** Part discriminator. */
992
965
  type: "compaction";
993
- /** The applied record, present once the compaction completes. */
994
- record?: CompactionRecord;
966
+ /** Lifecycle state. */
967
+ status: "running" | "complete" | "error";
968
+ /**
969
+ * Reader-facing text for the transcript. Replaced by `compaction:update`
970
+ * while running; on `complete` the compactor's returned summary is
971
+ * authoritative. What it says is the compactor's presentation choice — it
972
+ * need not mirror the model-facing messages. If the compactor returns none,
973
+ * the latest transient summary remains; absent entirely, render a bare
974
+ * divider.
975
+ */
976
+ summary?: string;
977
+ /** Estimated completion from `0` to `1`; terminal completion sets it to `1`. */
978
+ progress?: number;
979
+ /** Terminal error message, present once the part settles `error`. */
980
+ error?: string;
995
981
  /** Annotations attached to this part. */
996
982
  annotations?: TAnnotation[];
997
983
  /** Optional timing metadata. */
998
984
  timing?: TimingInfo;
999
985
  }
986
+ /** Transient fields to apply to a running compaction part. */
987
+ interface CompactionUpdate {
988
+ /** Replacement reader-facing summary or status text. */
989
+ summary?: string;
990
+ /** Estimated completion from `0` to `1`. */
991
+ progress?: number;
992
+ }
1000
993
  /**
1001
994
  * Shared fields for tool, subagent, and provider-managed actions.
1002
995
  *
@@ -1075,8 +1068,6 @@ type ActionResult = {
1075
1068
  //#endregion
1076
1069
  //#region src/turns/events.d.ts
1077
1070
  type AnnotationTarget = {
1078
- type: "session";
1079
- } | {
1080
1071
  type: "turn";
1081
1072
  turnId: string;
1082
1073
  } | {
@@ -1098,11 +1089,6 @@ type AnnotationEvent<TAnnotation extends Annotation = Annotation> = {
1098
1089
  annotation: TAnnotation;
1099
1090
  };
1100
1091
  type TurnEvent<TAnnotation extends Annotation = Annotation> = {
1101
- type: "session:restore";
1102
- turns: Turn<TAnnotation>[];
1103
- sessionAnnotations?: TAnnotation[];
1104
- config?: Record<string, unknown>;
1105
- } | {
1106
1092
  type: "turn:user";
1107
1093
  turn: Turn<TAnnotation>;
1108
1094
  } | {
@@ -1116,14 +1102,21 @@ type TurnEvent<TAnnotation extends Annotation = Annotation> = {
1116
1102
  usage: Stats;
1117
1103
  timing?: TimingInfo;
1118
1104
  } | {
1119
- type: "compaction:start";
1120
- id: string;
1105
+ type: "compaction:update";
1106
+ turnId: string;
1107
+ partId: string;
1108
+ update: CompactionUpdate;
1109
+ } | {
1110
+ type: "compaction:complete";
1111
+ turnId: string;
1112
+ partId: string;
1113
+ summary?: string;
1121
1114
  timing?: TimingInfo;
1122
1115
  } | {
1123
- type: "compaction:end";
1124
- id: string;
1125
- outcome: "complete" | "skipped" | "error";
1126
- record?: CompactionRecord;
1116
+ type: "compaction:error";
1117
+ turnId: string;
1118
+ partId: string;
1119
+ error: string;
1127
1120
  timing?: TimingInfo;
1128
1121
  } | {
1129
1122
  type: "part:start";
@@ -1269,31 +1262,63 @@ interface ProviderTool {
1269
1262
  }
1270
1263
  type ToolDefinition = Pick<ExecutableTool, "name" | "description" | "schema">;
1271
1264
  //#endregion
1272
- //#region src/turns/accumulator.d.ts
1273
- interface TurnAccumulatorState<TAnnotation extends Annotation = Annotation> {
1274
- turns: Turn<TAnnotation>[];
1275
- sessionAnnotations?: TAnnotation[];
1265
+ //#region src/messages/compaction.d.ts
1266
+ /**
1267
+ * Stamp a compactor attaches to its output messages via `MessageMetadata`
1268
+ * under the `axleCompaction` key. Providers ignore metadata, so the stamp
1269
+ * rides inside `messages` through snapshot/restore. It is a compactor-side
1270
+ * convention: a compactor recognizes its own prior output on the next run
1271
+ * (so summaries are never re-quoted), and the shared id correlates a message
1272
+ * with the `CompactionPart` that produced it. The engine does not read
1273
+ * stamps — the part's reader-facing summary is returned directly from the
1274
+ * compaction callback.
1275
+ *
1276
+ * @experimental Compaction is under active design and may change in any release.
1277
+ */
1278
+ interface CompactionStamp {
1279
+ /** The compaction id, provided to the callback as `ctx.id`. */
1280
+ id: string;
1281
+ /** What this message carries: the summary itself, or appended recent context. */
1282
+ role: "summary" | "appendix";
1276
1283
  }
1284
+ /**
1285
+ * Read a message's compaction stamp, if it has a well-formed one.
1286
+ *
1287
+ * @experimental Compaction is under active design and may change in any release.
1288
+ */
1289
+ declare function getCompactionStamp(message: AxleMessage): CompactionStamp | undefined;
1290
+ /**
1291
+ * Validate that a compacted conversation is structurally well-formed.
1292
+ *
1293
+ * The messages must stand alone: every tool call must be answered by the
1294
+ * tool message(s) immediately following it — providers reject conversations
1295
+ * that interleave other messages between a call and its result — and every
1296
+ * tool result must answer a preceding call.
1297
+ *
1298
+ * @experimental Compaction is under active design and may change in any release.
1299
+ * @throws AxleError with code `COMPACTION_INVALID_MESSAGES`
1300
+ */
1301
+ declare function validateCompactedMessages(messages: AxleMessage[]): void;
1302
+ //#endregion
1303
+ //#region src/turns/transcript.d.ts
1277
1304
  type UnknownEvent = {
1278
1305
  type: string;
1279
1306
  };
1280
- type AccumulatableEvent<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> = TurnEvent<TAnnotation> | THostEvent;
1281
- type TurnAccumulatorResult<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> = {
1307
+ type TranscriptInput<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> = TurnEvent<TAnnotation> | THostEvent;
1308
+ type TranscriptApplyResult<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> = {
1282
1309
  handled: true;
1283
- state: TurnAccumulatorState<TAnnotation>;
1284
1310
  event: TurnEvent<TAnnotation>;
1285
1311
  } | {
1286
1312
  handled: false;
1287
- state: TurnAccumulatorState<TAnnotation>;
1288
1313
  event: THostEvent;
1289
1314
  };
1290
- declare class TurnAccumulator<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> {
1291
- private _state;
1292
- constructor(init?: TurnAccumulatorState<TAnnotation>);
1293
- get state(): TurnAccumulatorState<TAnnotation>;
1294
- apply(event: AccumulatableEvent<TAnnotation, THostEvent>): TurnAccumulatorResult<TAnnotation, THostEvent>;
1315
+ declare class Transcript<TAnnotation extends Annotation = Annotation, THostEvent extends UnknownEvent = UnknownEvent> {
1316
+ private _turns;
1317
+ constructor(turns?: readonly Turn<TAnnotation>[]);
1318
+ get turns(): readonly Turn<TAnnotation>[];
1319
+ getTurn(turnId: string): Turn<TAnnotation> | undefined;
1320
+ apply(event: TranscriptInput<TAnnotation, THostEvent>): TranscriptApplyResult<TAnnotation, THostEvent>;
1295
1321
  private applyTurnEvent;
1296
- private replaceState;
1297
1322
  private replaceTurns;
1298
1323
  private updateTurn;
1299
1324
  private updatePart;
@@ -1302,4 +1327,4 @@ declare class TurnAccumulator<TAnnotation extends Annotation = Annotation, THost
1302
1327
  private handled;
1303
1328
  }
1304
1329
  //#endregion
1305
- export { ToolResultPart as $, TurnMetadata as A, SpanResult as At, Citation as B, ProviderToolAction as C, LLMRequest as Ct, TimingInfo as D, SpanData as Dt, ThinkingPart as E, Span as Et, AxleAssistantMessage as F, TraceWriter as Ft, ContentPartFile as G, CitationSource as H, AxleMessage as I, ContentPartThinking as J, ContentPartProviderTool as K, AxleToolCallMessage as L, TurnStatus as M, SpanType as Mt, CompactionRecord as N, TokenUsage as Nt, ToolAction as O, SpanEvent as Ot, validateCompactedMessages as P, ToolResult as Pt, ThinkingContinuity as Q, AxleToolCallResult as R, FilePart as S, EventLevel as St, TextPart as T, LLMResult as Tt, ContentPart as U, CitationOutputSpan as V, ContentPartCitation as W, DocumentLocator as X, ContentPartToolCall as Y, MessageMetadata as Z, Annotation as _, ResolvedFileSource as _t, UnknownEvent as a, ModelResult as at, CitationPart as b, TokenStats as bt, ToolContext as c, ResolvedProviderTool as ct, ToolRegistry as d, FileInfo as dt, AIProvider as et, AnnotationEvent as f, FileKind as ft, ActionResult as g, FileResolver as gt, ActionPart as h, FileResolveRequest as ht, TurnAccumulatorState as i, ModelError as it, TurnPart as j, SpanStatus as jt, Turn as k, SpanOptions as kt, ToolDefinition as l, ToolChoice as lt, TurnEvent as m, FileResolveFormat as mt, TurnAccumulator as n, AxleStopReason as nt, ExecutableTool as o, ProviderClientOptions as ot, AnnotationTarget as p, FileProviderId as pt, ContentPartText as q, TurnAccumulatorResult as r, ContextUsage as rt, ProviderTool as s, ProviderOptions as st, AccumulatableEvent as t, AxleModelRequestOptions as tt, ToolProgressChunk as u, DeferredFileInfo as ut, AnnotationPlacement as v, loadFileContent as vt, SubagentAction as w, LLMResponse as wt, CompactionPart as x, UsageEntry as xt, AnnotationStatus as y, Stats as yt, AxleUserMessage as z };
1330
+ export { ThinkingContinuity as $, TimingInfo as A, SpanOptions as At, AxleUserMessage as B, CompactionPart as C, EventLevel as Ct, SubagentAction as D, Span as Dt, ProviderToolAction as E, LLMResult as Et, TurnStatus as F, ToolResult as Ft, ContentPartCitation as G, CitationOutputSpan as H, AxleAssistantMessage as I, TraceWriter as It, ContentPartText as J, ContentPartFile as K, AxleMessage as L, Turn as M, SpanStatus as Mt, TurnMetadata as N, SpanType as Nt, TextPart as O, SpanData as Ot, TurnPart as P, TokenUsage as Pt, MessageMetadata as Q, AxleToolCallMessage as R, CitationPart as S, UsageEntry as St, FilePart as T, LLMResponse as Tt, CitationSource as U, Citation as V, ContentPart as W, ContentPartToolCall as X, ContentPartThinking as Y, DocumentLocator as Z, ActionPart as _, FileResolver as _t, CompactionStamp as a, ModelError as at, AnnotationPlacement as b, Stats as bt, ExecutableTool as c, ProviderOptions as ct, ToolDefinition as d, DeferredFileInfo as dt, ToolResultPart as et, ToolProgressChunk as f, FileInfo as ft, TurnEvent as g, FileResolveRequest as gt, AnnotationTarget as h, FileResolveFormat as ht, UnknownEvent as i, ContextUsage as it, ToolAction as j, SpanResult as jt, ThinkingPart as k, SpanEvent as kt, ProviderTool as l, ResolvedProviderTool as lt, AnnotationEvent as m, FileProviderId as mt, TranscriptApplyResult as n, AxleModelRequestOptions as nt, getCompactionStamp as o, ModelResult as ot, ToolRegistry as p, FileKind as pt, ContentPartProviderTool as q, TranscriptInput as r, AxleStopReason as rt, validateCompactedMessages as s, ProviderClientOptions as st, Transcript as t, AIProvider as tt, ToolContext as u, ToolChoice as ut, ActionResult as v, ResolvedFileSource as vt, CompactionUpdate as w, LLMRequest as wt, AnnotationStatus as x, TokenStats as xt, Annotation as y, loadFileContent as yt, AxleToolCallResult as z };
package/dist/ui.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as TurnMetadata, B as Citation, C as ProviderToolAction, D as TimingInfo, E as ThinkingPart, H as CitationSource, M as TurnStatus, N as CompactionRecord, O as ToolAction, Q as ThinkingContinuity, S as FilePart, T as TextPart, V as CitationOutputSpan, X as DocumentLocator, _ as Annotation, a as UnknownEvent, b as CitationPart, bt as TokenStats, dt as FileInfo, f as AnnotationEvent, g as ActionResult, h as ActionPart, i as TurnAccumulatorState, j as TurnPart, k as Turn, m as TurnEvent, n as TurnAccumulator, p as AnnotationTarget, r as TurnAccumulatorResult, t as AccumulatableEvent, v as AnnotationPlacement, w as SubagentAction, x as CompactionPart, xt as UsageEntry, y as AnnotationStatus, yt as Stats } from "./accumulator-e_1Eq0jB.js";
2
- export { type AccumulatableEvent, type ActionPart, type ActionResult, type Annotation, type AnnotationEvent, type AnnotationPlacement, type AnnotationStatus, type AnnotationTarget, type Citation, type CitationOutputSpan, type CitationPart, type CitationSource, type CompactionPart, type CompactionRecord, type DocumentLocator, type FileInfo, type FilePart, type ProviderToolAction, type Stats, type SubagentAction, type TextPart, type ThinkingContinuity, type ThinkingPart, type TimingInfo, type TokenStats, type ToolAction, type Turn, TurnAccumulator, type TurnAccumulatorResult, type TurnAccumulatorState, type TurnEvent, type TurnMetadata, type TurnPart, type TurnStatus, type UnknownEvent, type UsageEntry };
1
+ import { $ as ThinkingContinuity, A as TimingInfo, C as CompactionPart, D as SubagentAction, E as ProviderToolAction, F as TurnStatus, H as CitationOutputSpan, M as Turn, N as TurnMetadata, O as TextPart, P as TurnPart, S as CitationPart, St as UsageEntry, T as FilePart, U as CitationSource, V as Citation, Z as DocumentLocator, _ as ActionPart, a as CompactionStamp, b as AnnotationPlacement, bt as Stats, ft as FileInfo, g as TurnEvent, h as AnnotationTarget, i as UnknownEvent, j as ToolAction, k as ThinkingPart, m as AnnotationEvent, n as TranscriptApplyResult, r as TranscriptInput, t as Transcript, v as ActionResult, w as CompactionUpdate, x as AnnotationStatus, xt as TokenStats, y as Annotation } from "./transcript-D69LP3XR.js";
2
+ export { type ActionPart, type ActionResult, type Annotation, type AnnotationEvent, type AnnotationPlacement, type AnnotationStatus, type AnnotationTarget, type Citation, type CitationOutputSpan, type CitationPart, type CitationSource, type CompactionPart, type CompactionStamp, type CompactionUpdate, type DocumentLocator, type FileInfo, type FilePart, type ProviderToolAction, type Stats, type SubagentAction, type TextPart, type ThinkingContinuity, type ThinkingPart, type TimingInfo, type TokenStats, type ToolAction, Transcript, type TranscriptApplyResult, type TranscriptInput, type Turn, type TurnEvent, type TurnMetadata, type TurnPart, type TurnStatus, type UnknownEvent, type UsageEntry };
package/dist/ui.js CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./accumulator-BQuyGJN_.js";export{e as TurnAccumulator};
1
+ import{t as e}from"./transcript-BzpiXJtU.js";export{e as Transcript};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fifthrevision/axle",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/johncch/axle.git"
@@ -1 +0,0 @@
1
- const e=new Set(Object.keys({"session:restore":!0,"turn:user":!0,"turn:start":!0,"turn:end":!0,"compaction:start":!0,"compaction:end":!0,"part:start":!0,"text:delta":!0,"text:citation":!0,"thinking:delta":!0,"thinking:summary-delta":!0,"thinking:update":!0,"part:end":!0,"action:args-delta":!0,"action:running":!0,"action:progress":!0,"action:complete":!0,"action:error":!0,"action:child-event":!0,"annotation:start":!0,"annotation:update":!0,"annotation:end":!0,error:!0}));function t(t){return e.has(t.type)}var n=class e{_state;constructor(e){this._state={turns:e?.turns??[],sessionAnnotations:e?.sessionAnnotations}}get state(){return this._state}apply(e){return t(e)?this.applyTurnEvent(e):{handled:!1,state:this._state,event:e}}applyTurnEvent(t){switch(t.type){case`session:restore`:return this.replaceState({turns:t.turns??[],sessionAnnotations:t.sessionAnnotations},t);case`turn:user`:return this.replaceTurns([...this._state.turns,t.turn],t);case`turn:start`:{let e={id:t.turnId,owner:`agent`,parts:[],status:`streaming`,...t.timing?{timing:t.timing}:{}};return this.replaceTurns([...this._state.turns,e],t)}case`compaction:start`:{let e={id:t.id,owner:`agent`,parts:[{id:t.id,type:`compaction`}],status:`streaming`,...t.timing?{timing:t.timing}:{}};return this.replaceTurns([...this._state.turns,e],t)}case`compaction:end`:{if(t.outcome===`skipped`){let e=this._state.turns.filter(e=>e.id!==t.id);return e.length===this._state.turns.length?this.handled(t):this.replaceTurns(e,t)}let e=t.outcome===`complete`?`complete`:`error`,n=!1,r=this._state.turns.map(r=>r.id===t.id?(n=!0,{...r,status:e,parts:r.parts.map(e=>e.type===`compaction`&&t.record?{...e,record:t.record}:e),timing:t.timing??r.timing}):r);return n?this.replaceTurns(r,t):this.handled(t)}case`part:start`:return this.updateTurn(t.turnId,t,e=>({...e,parts:[...e.parts,t.part]}));case`text:delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`text`?{...e,text:e.text+t.delta}:e);case`text:citation`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`text`?{...e,citations:[...e.citations??[],t.citation]}:e);case`thinking:delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,text:(e.text??``)+t.delta}:e);case`thinking:summary-delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,summary:(e.summary??``)+t.delta}:e);case`thinking:update`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`thinking`?{...e,...t.redacted===void 0?{}:{redacted:t.redacted},...t.continuity?{continuity:t.continuity}:{},...t.providerMetadata?{providerMetadata:t.providerMetadata}:{}}:e);case`part:end`:return this.updatePart(t.turnId,t.partId,t,e=>({...e,timing:t.timing??e.timing}));case`action:args-delta`:return this.updatePart(t.turnId,t.partId,t,e=>e.type!==`action`||e.kind!==`tool`?e:{...e,detail:{...e.detail,pendingArgs:t.accumulated}});case`action:running`:return this.updatePart(t.turnId,t.partId,t,e=>{if(e.type!==`action`)return e;if(e.kind===`tool`){let{pendingArgs:n,...r}=e.detail;return{...e,status:`running`,detail:t.parameters?{...r,parameters:t.parameters}:r}}return{...e,status:`running`}});case`action:progress`:return this.updatePart(t.turnId,t.partId,t,e=>{if(e.type!==`action`)return e;let n=e.detail.result,r=n?.type===`in-progress`?n.content:``;return{...e,detail:{...e.detail,result:{type:`in-progress`,content:r+t.chunk}}}});case`action:complete`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`action`?{...e,status:`complete`,detail:{...e.detail,result:t.result},timing:t.timing??e.timing}:e);case`action:error`:return this.updatePart(t.turnId,t.partId,t,e=>e.type===`action`?{...e,status:`error`,detail:{...e.detail,result:{type:`error`,error:t.error}},timing:t.timing??e.timing}:e);case`turn:end`:return this.updateTurn(t.turnId,t,e=>({...e,status:t.status,usage:t.usage,timing:t.timing??e.timing}));case`annotation:start`:return this.addAnnotation(t);case`annotation:update`:return this.replaceAnnotation(t,!1);case`annotation:end`:return this.replaceAnnotation(t,!0);case`error`:return t.turnId?this.updateTurn(t.turnId,t,e=>({...e,error:t.error})):this.handled(t);case`action:child-event`:return this.updatePart(t.turnId,t.partId,t,n=>{if(n.type!==`action`||n.kind!==`agent`)return n;let r=new e({turns:n.detail.children}).apply(t.event);return{...n,detail:{...n.detail,children:r.state.turns}}});default:return this.handled(t)}}replaceState(e,t){return this._state=e,this.handled(t)}replaceTurns(e,t){return this.replaceState({...this._state,turns:e},t)}updateTurn(e,t,n){let r=!1,i=this._state.turns.map(t=>{if(t.id!==e)return t;let i=n(t);return i===t?t:(r=!0,i)});return r?this.replaceTurns(i,t):this.handled(t)}updatePart(e,t,n,r){return this.updateTurn(e,n,e=>{let n=!1,i=e.parts.map(e=>{if(e.id!==t)return e;let i=r(e);return i===e?e:(n=!0,i)});return n?{...e,parts:i}:e})}addAnnotation(e){let t=e.target,n=r(e.annotation);return n?t.type===`session`?this.replaceState({...this._state,sessionAnnotations:[...this._state.sessionAnnotations??[],n]},e):t.type===`turn`?this.updateTurn(t.turnId,e,e=>({...e,annotations:[...e.annotations??[],n]})):this.updatePart(t.turnId,t.partId,e,e=>({...e,annotations:[...e.annotations??[],n]})):this.handled(e)}replaceAnnotation(e,t){let n=e.target,a=r(e.annotation,t);if(!a)return this.handled(e);if(n.type===`session`){let t=i(this._state.sessionAnnotations,a);return t?this.replaceState({...this._state,sessionAnnotations:t},e):this.handled(e)}return n.type===`turn`?this.updateTurn(n.turnId,e,e=>{let t=i(e.annotations,a);return t?{...e,annotations:t}:e}):this.updatePart(n.turnId,n.partId,e,e=>{let t=i(e.annotations,a);return t?{...e,annotations:t}:e})}handled(e){return{handled:!0,state:this._state,event:e}}};function r(e,t=!1){if(!e)return;let n=t?e.status??`complete`:e.status,r={...e,placement:e.placement??`after`};return n?{...r,status:n}:r}function i(e,t){if(!e)return;let n=!1,r=e.map(e=>e.id===t.id?(n=!0,t):e);return n?r:void 0}export{n as t};