@@ -34,11 +34,31 @@ enum SystemEvent:
3434
3535 /** Hook response event */
3636 case HookResponse (
37+ hookId : String ,
3738 hookName : String ,
3839 hookEvent : String ,
3940 stdout : String ,
4041 stderr : String ,
41- exitCode : Option [Int ]
42+ output : String ,
43+ exitCode : Option [Int ],
44+ outcome : HookOutcome
45+ )
46+
47+ /** Hook execution started */
48+ case HookStarted (
49+ hookId : String ,
50+ hookName : String ,
51+ hookEvent : String
52+ )
53+
54+ /** Hook execution progress */
55+ case HookProgress (
56+ hookId : String ,
57+ hookName : String ,
58+ hookEvent : String ,
59+ stdout : String ,
60+ stderr : String ,
61+ output : String
4262 )
4363
4464object SystemEvent :
@@ -112,38 +132,67 @@ object ApiKeySource:
112132final case class McpServerStatus (
113133 name : String ,
114134 status : McpConnectionStatus ,
115- serverInfo : Option [McpServerInfo ]
135+ serverInfo : Option [McpServerInfo ],
136+ error : Option [String ] = None ,
137+ scope : Option [String ] = None ,
138+ tools : Option [List [McpToolInfo ]] = None
116139)
117140
118141object McpServerStatus :
119142 given JsonDecoder [McpServerStatus ] = DeriveJsonDecoder .gen[McpServerStatus ]
120143 given JsonEncoder [McpServerStatus ] = DeriveJsonEncoder .gen[McpServerStatus ]
121144
145+ /** MCP tool information from server status */
146+ final case class McpToolInfo (
147+ name : String ,
148+ description : Option [String ] = None ,
149+ annotations : Option [McpToolAnnotations ] = None
150+ )
151+
152+ object McpToolInfo :
153+ given JsonDecoder [McpToolInfo ] = DeriveJsonDecoder .gen[McpToolInfo ]
154+ given JsonEncoder [McpToolInfo ] = DeriveJsonEncoder .gen[McpToolInfo ]
155+
156+ /** MCP tool annotations */
157+ final case class McpToolAnnotations (
158+ readOnly : Option [Boolean ] = None ,
159+ destructive : Option [Boolean ] = None ,
160+ openWorld : Option [Boolean ] = None
161+ )
162+
163+ object McpToolAnnotations :
164+ given JsonDecoder [McpToolAnnotations ] = DeriveJsonDecoder .gen[McpToolAnnotations ]
165+ given JsonEncoder [McpToolAnnotations ] = DeriveJsonEncoder .gen[McpToolAnnotations ]
166+
122167/** MCP connection status */
123168enum McpConnectionStatus :
124169 case Connected
125170 case Failed
126171 case NeedsAuth
127172 case Pending
173+ case Disabled
128174 case Custom (value : String )
129175
130176 def toRaw : String = this match
131177 case Connected => " connected"
132178 case Failed => " failed"
133- case NeedsAuth => " needs_auth "
179+ case NeedsAuth => " needs-auth "
134180 case Pending => " pending"
181+ case Disabled => " disabled"
135182 case Custom (v) => v
136183
137184object McpConnectionStatus :
138185 given JsonEncoder [McpConnectionStatus ] = JsonEncoder [String ].contramap(_.toRaw)
139186 given JsonDecoder [McpConnectionStatus ] = JsonDecoder [String ].map(fromString)
140187
141188 def fromString (s : String ): McpConnectionStatus = s match
142- case " connected" => Connected
143- case " failed" => Failed
144- case " needs_auth" => NeedsAuth
145- case " pending" => Pending
146- case other => Custom (other)
189+ case " connected" => Connected
190+ case " failed" => Failed
191+ case " needs-auth" => NeedsAuth
192+ case " needs_auth" => NeedsAuth // Legacy format support
193+ case " pending" => Pending
194+ case " disabled" => Disabled
195+ case other => Custom (other)
147196
148197/** MCP server information */
149198final case class McpServerInfo (
@@ -164,3 +213,26 @@ final case class PluginInfo(
164213object PluginInfo :
165214 given JsonDecoder [PluginInfo ] = DeriveJsonDecoder .gen[PluginInfo ]
166215 given JsonEncoder [PluginInfo ] = DeriveJsonEncoder .gen[PluginInfo ]
216+
217+ /** Hook outcome values */
218+ enum HookOutcome :
219+ case Success
220+ case Error
221+ case Cancelled
222+ case Custom (value : String )
223+
224+ def toRaw : String = this match
225+ case Success => " success"
226+ case Error => " error"
227+ case Cancelled => " cancelled"
228+ case Custom (v) => v
229+
230+ object HookOutcome :
231+ given JsonEncoder [HookOutcome ] = JsonEncoder [String ].contramap(_.toRaw)
232+ given JsonDecoder [HookOutcome ] = JsonDecoder [String ].map(fromString)
233+
234+ def fromString (s : String ): HookOutcome = s match
235+ case " success" => Success
236+ case " error" => Error
237+ case " cancelled" => Cancelled
238+ case other => Custom (other)
0 commit comments