Skip to content

Commit 62caf2f

Browse files
committed
chore: remove sdk parts
1 parent 5359026 commit 62caf2f

File tree

5 files changed

+19
-95
lines changed

5 files changed

+19
-95
lines changed

lib/httpapi/handler.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77
"github.com/danielgtaylor/huma/v2/sse"
88
)
99

10-
// InteractionHandler defines the interface that all interaction modes must implement
11-
type InteractionHandler interface {
10+
// AgentHandler defines the interface that all interaction modes must implement
11+
type AgentHandler interface {
1212
GetStatus(ctx context.Context, input *struct{}) (*types.StatusResponse, error)
1313
CreateMessage(ctx context.Context, input *types.MessageRequest) (*types.MessageResponse, error)
1414
GetMessages(ctx context.Context, input *struct{}) (*types.MessagesResponse, error)
15-
SubscribeConversations(ctx context.Context, input *struct{}, send sse.Sender)
1615
SubscribeEvents(ctx context.Context, input *struct{}, send sse.Sender)
17-
//StartSnapshotLoop(ctx context.Context)
16+
// SubscribeConversations Was Initially SubscribeScreen, tbd whether we want to expose this in SDK mode TODO 1
17+
SubscribeConversations(ctx context.Context, input *struct{}, send sse.Sender)
1818
}

lib/httpapi/server.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ import (
2929

3030
// Server represents the HTTP server
3131
type Server struct {
32-
router chi.Router
33-
api huma.API
34-
port int
35-
srv *http.Server
36-
logger *slog.Logger
37-
agentType msgfmt.AgentType
38-
chatBasePath string
39-
InteractionHandler InteractionHandler
32+
router chi.Router
33+
api huma.API
34+
port int
35+
srv *http.Server
36+
logger *slog.Logger
37+
agentType msgfmt.AgentType
38+
chatBasePath string
39+
AgentHandler AgentHandler
4040
}
4141

4242
func (s *Server) GetOpenAPI() string {
@@ -202,9 +202,9 @@ func NewServer(ctx context.Context, config ServerConfig) (*Server, error) {
202202

203203
// Get the appropriate Interaction Handler
204204
if config.InteractionType == types.CLIInteractionType {
205-
s.InteractionHandler = cli.NewCLIHandler(ctx, config.Process, config.AgentType)
205+
s.AgentHandler = cli.NewCLIHandler(ctx, config.Process, config.AgentType)
206206
} else if config.InteractionType == types.SDKInteractionType {
207-
s.InteractionHandler = sdk.NewSDKHandler(ctx)
207+
s.AgentHandler = sdk.NewSDKHandler(ctx)
208208
} else {
209209
return nil, xerrors.Errorf("")
210210
}
@@ -257,17 +257,17 @@ func hostAuthorizationMiddleware(allowedHosts []string, badHostHandler http.Hand
257257
// registerRoutes sets up all API endpoints
258258
func (s *Server) registerRoutes() {
259259
// GET /status endpoint
260-
huma.Get(s.api, "/status", s.InteractionHandler.GetStatus, func(o *huma.Operation) {
260+
huma.Get(s.api, "/status", s.AgentHandler.GetStatus, func(o *huma.Operation) {
261261
o.Description = "Returns the current status of the agent."
262262
})
263263

264264
// GET /messages endpoint
265-
huma.Get(s.api, "/messages", s.InteractionHandler.GetMessages, func(o *huma.Operation) {
265+
huma.Get(s.api, "/messages", s.AgentHandler.GetMessages, func(o *huma.Operation) {
266266
o.Description = "Returns a list of messages representing the conversation history with the agent."
267267
})
268268

269269
// POST /message endpoint
270-
huma.Post(s.api, "/message", s.InteractionHandler.CreateMessage, func(o *huma.Operation) {
270+
huma.Post(s.api, "/message", s.AgentHandler.CreateMessage, func(o *huma.Operation) {
271271
o.Description = "Send a message to the agent. For messages of type 'user', the agent's status must be 'stable' for the operation to complete successfully. Otherwise, this endpoint will return an error."
272272
})
273273

@@ -282,7 +282,7 @@ func (s *Server) registerRoutes() {
282282
// Mapping of event type name to Go struct for that event.
283283
"message_update": types.MessageUpdateBody{},
284284
"status_change": types.StatusChangeBody{},
285-
}, s.InteractionHandler.SubscribeEvents)
285+
}, s.AgentHandler.SubscribeEvents)
286286

287287
sse.Register(s.api, huma.Operation{
288288
OperationID: "subscribeScreen",
@@ -292,7 +292,7 @@ func (s *Server) registerRoutes() {
292292
Hidden: true,
293293
}, map[string]any{
294294
"screen": types.ScreenUpdateBody{},
295-
}, s.InteractionHandler.SubscribeConversations)
295+
}, s.AgentHandler.SubscribeConversations)
296296

297297
s.router.Handle("/", http.HandlerFunc(s.redirectToChat))
298298

lib/sdk/agents/claude/claude.go

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/sdk/conversation.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/sdk/sdk_handler.go

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)