Rename Fantasy* types to LLM* and remove GenerateResult alias

- FantasyMessage -> LLMMessage
- FantasyUsage -> LLMUsage
- FantasyResponse -> LLMResponse
- Remove confusing GenerateResult = TurnResult alias
- Update documentation in SKILL.md
This commit is contained in:
Ed Zynda
2026-03-29 13:11:55 +03:00
parent 58caf155c1
commit 8c00682367
3 changed files with 17 additions and 21 deletions
+4 -4
View File
@@ -1223,16 +1223,16 @@ type TurnResult struct {
// TotalUsage is the aggregate token usage across all steps in the turn
// (includes tool-calling loop iterations). Nil if the provider didn't
// report usage.
TotalUsage *FantasyUsage
TotalUsage *LLMUsage
// FinalUsage is the token usage from the last API call only. Use this
// for context window fill estimation (InputTokens + OutputTokens ≈
// current context size). Nil if unavailable.
FinalUsage *FantasyUsage
FinalUsage *LLMUsage
// Messages is the full updated conversation after the turn, including
// any tool call/result messages added during the agent loop.
Messages []FantasyMessage
Messages []LLMMessage
}
// ---------------------------------------------------------------------------
@@ -1280,7 +1280,7 @@ type SubagentResult struct {
// StopReason is the LLM's finish reason for the subagent's final turn.
StopReason string
// Usage contains token usage from the subagent's run.
Usage *FantasyUsage
Usage *LLMUsage
// Elapsed is the total execution time.
Elapsed time.Duration
}
+8 -12
View File
@@ -78,10 +78,6 @@ type MCPServerConfig = config.MCPServerConfig
// AgentConfig holds configuration options for creating a new Agent.
type AgentConfig = agent.AgentConfig
// GenerateResult contains the result and conversation history from an agent
// interaction.
type GenerateResult = agent.GenerateWithLoopResult
type (
// ToolCallHandler is a function type for handling tool calls as they happen.
ToolCallHandler = agent.ToolCallHandler
@@ -130,18 +126,18 @@ type ModelsRegistry = models.ModelsRegistry
// Ollama model loading. Signature: func(fn func() error) error.
type SpinnerFunc = agent.SpinnerFunc
// ==== Fantasy Types (re-exported) ====
// ==== LLM Types (re-exported from charm.land/fantasy) ====
// FantasyMessage is the underlying message type used by the fantasy agent
// library. Re-exported so SDK users can work with fantasy types without a
// LLMMessage is the underlying message type used by the LLM agent
// library. Re-exported so SDK users can work with LLM types without a
// direct import of charm.land/fantasy.
type FantasyMessage = fantasy.Message
type LLMMessage = fantasy.Message
// FantasyUsage contains token usage information from an LLM response.
type FantasyUsage = fantasy.Usage
// LLMUsage contains token usage information from an LLM response.
type LLMUsage = fantasy.Usage
// FantasyResponse is the response type returned by the fantasy agent library.
type FantasyResponse = fantasy.Response
// LLMResponse is the response type returned by the LLM agent library.
type LLMResponse = fantasy.Response
// ==== Compaction Types (internal/compaction/) ====
+5 -5
View File
@@ -119,9 +119,9 @@ result, err := host.PromptResult(ctx, "Analyze this file")
// result.Response — assistant's text
// result.StopReason — "stop", "length", "tool-calls", "error", etc.
// result.SessionID — session UUID
// result.TotalUsage — aggregate tokens across all steps (*kit.FantasyUsage)
// result.TotalUsage — aggregate tokens across all steps (*kit.LLMUsage)
// result.FinalUsage — tokens from last API call only
// result.Messages — full updated conversation ([]kit.FantasyMessage)
// result.Messages — full updated conversation ([]kit.LLMMessage)
```
### Multimodal with file attachments
@@ -525,7 +525,7 @@ result, err := host.Subagent(ctx, kit.SubagentConfig{
},
})
// result.Response, result.Error, result.SessionID, result.StopReason
// result.Usage (*kit.FantasyUsage), result.Elapsed (time.Duration)
// result.Usage (*kit.LLMUsage), result.Elapsed (time.Duration)
```
### Subscribing to subagent events from parent
@@ -593,8 +593,8 @@ kit.Config, kit.MCPServerConfig
// Provider types
kit.ProviderConfig, kit.ProviderResult, kit.ModelInfo, kit.ModelCost, kit.ModelLimit
// Fantasy types (from charm.land/fantasy)
kit.FantasyMessage, kit.FantasyUsage, kit.FantasyResponse
// LLM types (from charm.land/fantasy)
kit.LLMMessage, kit.LLMUsage, kit.LLMResponse
// Compaction types
kit.CompactionResult, kit.CompactionOptions