summaryrefslogtreecommitdiffhomepage
path: root/internal/session
diff options
context:
space:
mode:
authorKujtim Hoxha <[email protected]>2025-04-16 20:06:23 +0200
committerKujtim Hoxha <[email protected]>2025-04-21 13:42:00 +0200
commitbbfa60c787f2ec459f1689b9a650ddbec9693ed9 (patch)
treef7f2aa31c460c8cc22ec40cc299c386277152241 /internal/session
parent76b4065f17b87a63092acfd98c997bab53700b35 (diff)
downloadopencode-bbfa60c787f2ec459f1689b9a650ddbec9693ed9.tar.gz
opencode-bbfa60c787f2ec459f1689b9a650ddbec9693ed9.zip
reimplement agent,provider and add file history
Diffstat (limited to 'internal/session')
-rw-r--r--internal/session/session.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/session/session.go b/internal/session/session.go
index 9a16224c3..019019df4 100644
--- a/internal/session/session.go
+++ b/internal/session/session.go
@@ -24,6 +24,7 @@ type Session struct {
type Service interface {
pubsub.Suscriber[Session]
Create(ctx context.Context, title string) (Session, error)
+ CreateTitleSession(ctx context.Context, parentSessionID string) (Session, error)
CreateTaskSession(ctx context.Context, toolCallID, parentSessionID, title string) (Session, error)
Get(ctx context.Context, id string) (Session, error)
List(ctx context.Context) ([]Session, error)
@@ -63,6 +64,20 @@ func (s *service) CreateTaskSession(ctx context.Context, toolCallID, parentSessi
return session, nil
}
+func (s *service) CreateTitleSession(ctx context.Context, parentSessionID string) (Session, error) {
+ dbSession, err := s.q.CreateSession(ctx, db.CreateSessionParams{
+ ID: "title-" + parentSessionID,
+ ParentSessionID: sql.NullString{String: parentSessionID, Valid: true},
+ Title: "Generate a title",
+ })
+ if err != nil {
+ return Session{}, err
+ }
+ session := s.fromDBItem(dbSession)
+ s.Publish(pubsub.CreatedEvent, session)
+ return session, nil
+}
+
func (s *service) Delete(ctx context.Context, id string) error {
session, err := s.Get(ctx, id)
if err != nil {