Documentation
¶
Overview ¶
Package migration provides utilities for migrating bespoke tool layers to omniskill.
This package helps PlexusOne projects with custom tool implementations migrate to the standardized omniskill interfaces. It provides:
- AdaptTool: Wrap legacy tool types to implement skill.Tool
- AdaptSkill: Wrap legacy skill types to implement skill.Skill
- Check: Validate migration completeness
Adapters ¶
Adapters allow gradual migration by wrapping legacy types:
// Wrap a legacy tool
legacy := &MyLegacyTool{name: "search", ...}
adapted := migration.AdaptTool(legacy)
// Use in omniskill registry
skill := &skill.BaseSkill{
SkillName: "legacy",
SkillTools: []skill.Tool{adapted},
}
reg.Register(skill)
Validation ¶
The Check function validates that a registry meets omniskill standards:
issues := migration.Check(reg)
for _, issue := range issues {
fmt.Printf("[%s] %s: %s\n", issue.Severity, issue.Location, issue.Message)
}
Migration Workflow ¶
1. Wrap legacy tools with adapters 2. Register wrapped skills in omniskill registry 3. Run Check() to identify remaining issues 4. Replace adapters with native implementations 5. Run Check() again to verify completion
See docs/migration/README.md for detailed migration guide.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
// TotalIssues is the count of all issues found.
TotalIssues int
// Errors is the count of error-severity issues.
Errors int
// Warnings is the count of warning-severity issues.
Warnings int
// Infos is the count of info-severity issues.
Infos int
// AdaptedSkills is the count of skills using adapters.
AdaptedSkills int
// AdaptedTools is the count of tools using adapters.
AdaptedTools int
// Issues is the full list of issues.
Issues []Issue
}
CheckResult summarizes the check results.
func Summarize ¶
func Summarize(issues []Issue) *CheckResult
Summarize returns a summary of check results.
func (*CheckResult) HasAdapters ¶
func (r *CheckResult) HasAdapters() bool
HasAdapters returns true if any adapters are still in use.
func (*CheckResult) IsComplete ¶
func (r *CheckResult) IsComplete() bool
IsComplete returns true if there are no errors or warnings.
func (*CheckResult) String ¶
func (r *CheckResult) String() string
String returns a human-readable summary.
type Issue ¶
type Issue struct {
// Severity indicates how important this issue is.
Severity Severity
// Location identifies where the issue was found (skill/tool name).
Location string
// Message describes the issue.
Message string
// Suggestion provides guidance on how to fix the issue.
Suggestion string
}
Issue represents a migration validation issue.
type LegacyParameter ¶
LegacyParameter represents a legacy parameter definition.
type LegacySkill ¶
type LegacySkill interface {
// Name returns the skill name.
Name() string
// Tools returns the skill's tools.
Tools() []LegacyTool
}
LegacySkill is the minimal interface for legacy skill types.
type LegacySkillWithClose ¶
type LegacySkillWithClose interface {
LegacySkill
Close() error
}
LegacySkillWithClose extends LegacySkill with cleanup.
type LegacySkillWithDescription ¶
type LegacySkillWithDescription interface {
LegacySkill
Description() string
}
LegacySkillWithDescription extends LegacySkill with a description method.
type LegacySkillWithInit ¶
type LegacySkillWithInit interface {
LegacySkill
Init() error
}
LegacySkillWithInit extends LegacySkill with initialization.
type LegacyTool ¶
type LegacyTool interface {
// Name returns the tool name.
Name() string
// Execute runs the tool with the given arguments.
Execute(args map[string]any) (any, error)
}
LegacyTool is the minimal interface for legacy tool types. Tools implementing this interface can be wrapped with AdaptTool.
type LegacyToolWithDescription ¶
type LegacyToolWithDescription interface {
LegacyTool
Description() string
}
LegacyToolWithDescription extends LegacyTool with a description method.
type LegacyToolWithParameters ¶
type LegacyToolWithParameters interface {
LegacyTool
Parameters() map[string]LegacyParameter
}
LegacyToolWithParameters extends LegacyTool with parameter definitions.
type SkillAdapter ¶
type SkillAdapter struct {
// contains filtered or unexported fields
}
SkillAdapter wraps a legacy skill to implement skill.Skill.
func AdaptSkill ¶
func AdaptSkill(legacy LegacySkill) *SkillAdapter
AdaptSkill wraps a legacy skill to implement skill.Skill.
func (*SkillAdapter) Close ¶
func (a *SkillAdapter) Close() error
Close closes the skill if the legacy skill supports it.
func (*SkillAdapter) Description ¶
func (a *SkillAdapter) Description() string
Description returns the skill description.
func (*SkillAdapter) Init ¶
func (a *SkillAdapter) Init(ctx context.Context) error
Init initializes the skill if the legacy skill supports it.
func (*SkillAdapter) IsAdapted ¶
func (a *SkillAdapter) IsAdapted() bool
IsAdapted returns true, indicating this is an adapted legacy skill.
func (*SkillAdapter) Tools ¶
func (a *SkillAdapter) Tools() []skill.Tool
Tools returns the adapted tools.
func (*SkillAdapter) Version ¶
func (a *SkillAdapter) Version() string
Version returns empty string for legacy skills.
type ToolAdapter ¶
type ToolAdapter struct {
// contains filtered or unexported fields
}
ToolAdapter wraps a legacy tool to implement skill.Tool.
func AdaptTool ¶
func AdaptTool(legacy LegacyTool) *ToolAdapter
AdaptTool wraps a legacy tool to implement skill.Tool.
The adapter extracts description and parameters if the legacy tool implements the optional interfaces (LegacyToolWithDescription, LegacyToolWithParameters).
func (*ToolAdapter) Call ¶
Call runs the legacy tool. The context is ignored since legacy tools don't support cancellation.
func (*ToolAdapter) Description ¶
func (a *ToolAdapter) Description() string
Description returns the tool description.
func (*ToolAdapter) IsAdapted ¶
func (a *ToolAdapter) IsAdapted() bool
IsAdapted returns true, indicating this is an adapted legacy tool.
func (*ToolAdapter) Parameters ¶
func (a *ToolAdapter) Parameters() map[string]skill.Parameter
Parameters returns the tool parameters.