on main help sign in
fix: simpler
820e55eCarlos Alexandro Becker
internal/config/config.go+1−22
@@ -13,7 +13,6 @@ import (
13 "github.com/charmbracelet/catwalk/pkg/catwalk"
13 "github.com/charmbracelet/catwalk/pkg/catwalk"
14 "github.com/charmbracelet/crush/internal/csync"
14 "github.com/charmbracelet/crush/internal/csync"
15 "github.com/charmbracelet/crush/internal/env"
15 "github.com/charmbracelet/crush/internal/env"
16− "github.com/invopop/jsonschema"
17 "github.com/tidwall/sjson"
16 "github.com/tidwall/sjson"
18)
17)
19
18
@@ -46,16 +45,6 @@ const (
46 SelectedModelTypeSmall SelectedModelType = "small"
45 SelectedModelTypeSmall SelectedModelType = "small"
47)
46)
48
47
49−// JSONSchema returns the JSON schema for SelectedModelType
50−func (SelectedModelType) JSONSchema() *jsonschema.Schema {
51− return &jsonschema.Schema{
52− Type: "string",
53− Description: "Model type selection for different use cases",
54− Enum: []any{"large", "small"},
55− Default: "large",
56− }
57−}
58−
59type SelectedModel struct {
48type SelectedModel struct {
60 // The model id as used by the provider API.
49 // The model id as used by the provider API.
61 // Required.
50 // Required.
@@ -111,16 +100,6 @@ const (
111 MCPHttp MCPType = "http"
100 MCPHttp MCPType = "http"
112)
101)
113
102
114−// JSONSchema returns the JSON schema for MCPType
115−func (MCPType) JSONSchema() *jsonschema.Schema {
116− return &jsonschema.Schema{
117− Type: "string",
118− Description: "Type of MCP connection protocol",
119− Enum: []any{"stdio", "sse", "http"},
120− Default: "stdio",
121− }
122−}
123−
124type MCPConfig struct {
103type MCPConfig struct {
125 Command string `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
104 Command string `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
126 Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
105 Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
@@ -239,7 +218,7 @@ type Agent struct {
239 // This is the id of the system prompt used by the agent
218 // This is the id of the system prompt used by the agent
240 Disabled bool `json:"disabled,omitempty"`
219 Disabled bool `json:"disabled,omitempty"`
241
220
242− Model SelectedModelType `json:"model"`
221+ Model SelectedModelType `json:"model" jsonschema:"required,description=The model type to use for this agent,enum=large,enum=small,default=large"`
243
222
244 // The available tools for the agent
223 // The available tools for the agent
245 // if this is nil, all tools are available
224 // if this is nil, all tools are available
schema.json+8−12
@@ -100,8 +100,14 @@
100 "description": "Arguments to pass to the MCP server command"
100 "description": "Arguments to pass to the MCP server command"
101 },
101 },
102 "type": {
102 "type": {
103− "$ref": "#/$defs/MCPType",
103+ "type": "string",
104+ "enum": [
105+ "stdio",
106+ "sse",
107+ "http"
108+ ],
104− "description": "Type of MCP connection"
109+ "description": "Type of MCP connection",
110+ "default": "stdio"
105 },
111 },
106 "url": {
112 "url": {
107 "type": "string",
113 "type": "string",
@@ -130,16 +136,6 @@
130 "type"
136 "type"
131 ]
137 ]
132 },
138 },
133− "MCPType": {
134− "type": "string",
135− "enum": [
136− "stdio",
137− "sse",
138− "http"
139− ],
140− "description": "Type of MCP connection protocol",
141− "default": "stdio"
142− },
143 "MCPs": {
139 "MCPs": {
144 "additionalProperties": {
140 "additionalProperties": {
145 "$ref": "#/$defs/MCPConfig"
141 "$ref": "#/$defs/MCPConfig"