summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/app/interfaces.go
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-28 15:36:31 -0500
committeradamdottv <[email protected]>2025-05-28 15:36:36 -0500
commit9d7c5efb9b0b60c62aef3777b65b458a31ebbc88 (patch)
tree0f5acb5b8093d872b30178ded53df719be40cf44 /internal/tui/app/interfaces.go
parent8863a499a9e311a48d6ab8bc05d267fb2a01f060 (diff)
downloadopencode-9d7c5efb9b0b60c62aef3777b65b458a31ebbc88.tar.gz
opencode-9d7c5efb9b0b60c62aef3777b65b458a31ebbc88.zip
wip: refactoring tui
Diffstat (limited to 'internal/tui/app/interfaces.go')
-rw-r--r--internal/tui/app/interfaces.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/internal/tui/app/interfaces.go b/internal/tui/app/interfaces.go
new file mode 100644
index 000000000..9729a3bcb
--- /dev/null
+++ b/internal/tui/app/interfaces.go
@@ -0,0 +1,42 @@
+package app
+
+import (
+ "context"
+ "time"
+
+ "github.com/sst/opencode/internal/message"
+ "github.com/sst/opencode/internal/pubsub"
+ "github.com/sst/opencode/internal/session"
+)
+
+// SessionService defines the interface for session operations
+type SessionService interface {
+ Create(ctx context.Context, title string) (session.Session, error)
+ Get(ctx context.Context, id string) (session.Session, error)
+ List(ctx context.Context) ([]session.Session, error)
+ Update(ctx context.Context, id, title string) error
+ Delete(ctx context.Context, id string) error
+}
+
+// MessageService defines the interface for message operations
+type MessageService interface {
+ pubsub.Subscriber[message.Message]
+
+ GetBySession(ctx context.Context, sessionID string) ([]message.Message, error)
+ List(ctx context.Context, sessionID string) ([]message.Message, error)
+ Create(ctx context.Context, sessionID string, params message.CreateMessageParams) (message.Message, error)
+ Update(ctx context.Context, msg message.Message) (message.Message, error)
+ Delete(ctx context.Context, id string) error
+ DeleteSessionMessages(ctx context.Context, sessionID string) error
+ Get(ctx context.Context, id string) (message.Message, error)
+ ListAfter(ctx context.Context, sessionID string, timestamp time.Time) ([]message.Message, error)
+}
+
+// AgentService defines the interface for agent operations
+type AgentService interface {
+ Run(ctx context.Context, sessionID string, text string, attachments ...message.Attachment) (string, error)
+ Cancel(sessionID string) error
+ IsBusy() bool
+ IsSessionBusy(sessionID string) bool
+ CompactSession(ctx context.Context, sessionID string, force bool) error
+}