Files
kit/pkg/kit/types.go
T
Ed Zynda 626f1105c9 move SDK to pkg/kit, extract shared logic from cmd, relocate main to cmd/kit
Restructure the codebase so the CLI app consumes the SDK rather than
the SDK wrapping CLI internals. This eliminates the circular dependency
(sdk -> cmd -> sdk) and establishes pkg/kit as the canonical API.

Key changes:
- Create pkg/kit/ with InitConfig, SetupAgent, BuildProviderConfig
  extracted from cmd/root.go and cmd/setup.go as parameterized functions
- Move sdk/kit.go -> pkg/kit/kit.go (remove cmd import, use local calls)
- Move sdk/types.go -> pkg/kit/types.go
- Move main.go -> cmd/kit/main.go (standard Go project layout)
- cmd/root.go and cmd/setup.go now delegate to pkg/kit, injecting
  CLI-specific state (quietFlag) via the Quiet field on AgentSetupOptions
- Add setSDKDefaults() for cobra-free SDK usage (viper defaults)
- Fix .gitignore: kit -> /kit (was blocking cmd/kit/ and pkg/kit/)
- Update .goreleaser.yaml, Taskfile.yml, AGENTS.md, contribute/build.sh,
  README.md for new cmd/kit entrypoint and pkg/kit import paths
- Add plans/ with 10 detailed SDK revamp plans and Taskfile.yml
- Delete sdk/ directory entirely
2026-02-27 10:42:27 +03:00

33 lines
1.1 KiB
Go

package kit
import (
"charm.land/fantasy"
"github.com/mark3labs/kit/internal/message"
"github.com/mark3labs/kit/internal/session"
)
// Message is an alias for message.Message providing SDK users with access
// to message structures for conversation history and tool interactions.
type Message = message.Message
// ToolCall is an alias for message.ToolCall representing a tool invocation
// with its name, arguments, and result within a conversation.
type ToolCall = message.ToolCall
// ToolResult is an alias for message.ToolResult representing the result
// of executing a tool.
type ToolResult = message.ToolResult
// ConvertToFantasyMessages converts an SDK message to the underlying fantasy
// messages used by the agent for LLM interactions.
func ConvertToFantasyMessages(msg *Message) []fantasy.Message {
return msg.ToFantasyMessages()
}
// ConvertFromFantasyMessage converts a fantasy message from the agent to an SDK
// message format for use in the SDK API.
func ConvertFromFantasyMessage(msg fantasy.Message) Message {
return session.ConvertFromFantasyMessage(msg)
}