Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion agent/llmagent/agent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/sylumi/agentkit/agent/llmagent"
"github.com/sylumi/agentkit/model"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
"github.com/sylumi/agentkit/tool"
"github.com/sylumi/agentkit/tool/functiontool"
)
Expand Down Expand Up @@ -152,7 +153,7 @@ func toolCallResult(calls ...model.ToolCallPart) model.Result {

func newInvocation(t *testing.T) (session.Service, *agent.InvocationContext) {
t.Helper()
service := session.InMemoryService()
service := inmemory.New()
created, err := service.Create(t.Context(), &session.CreateRequest{AppName: "test", UserID: "user"})
if err != nil {
t.Fatal(err)
Expand Down
3 changes: 2 additions & 1 deletion cmd/launcher/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/sylumi/agentkit/agent"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
)

// Config supplies an Agent and optional services to console and web launchers.
Expand Down Expand Up @@ -35,7 +36,7 @@ func (c Config) Resolve() (Config, error) {
return Config{}, fmt.Errorf("launcher: app name and user ID must not be blank")
}
if c.SessionService == nil {
c.SessionService = session.InMemoryService()
c.SessionService = inmemory.New()
}
return c, nil
}
3 changes: 2 additions & 1 deletion cmd/launcher/console/console_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/sylumi/agentkit/cmd/launcher"
"github.com/sylumi/agentkit/model"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
)

type testAgent struct {
Expand All @@ -36,7 +37,7 @@ func TestConsoleKeepsHistoryAndCancelsWhileWaitingForInput(t *testing.T) {
yield(e, nil)
}
}}
store := session.InMemoryService()
store := inmemory.New()
cfg := launcher.Config{Agent: a, SessionService: store, AppName: "custom-app", UserID: "alice"}
var output bytes.Buffer
if err := run(t.Context(), cfg, strings.NewReader("hi\n\nagain\n"), &output); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/launcher/web/web_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/sylumi/agentkit/model"
"github.com/sylumi/agentkit/model/openaimodel"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
webui "github.com/sylumi/agentkit/web"
)

Expand Down Expand Up @@ -160,7 +161,7 @@ func TestWebUsesConfiguredServiceWithoutUI(t *testing.T) {
yield(e, nil)
}
}}
store := session.InMemoryService()
store := inmemory.New()
cfg := launcher.Config{Agent: a, SessionService: store, AppName: "custom-app", UserID: "alice"}
h, err := NewHandler(cfg, nil)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion runner/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/sylumi/agentkit/model"
"github.com/sylumi/agentkit/runner"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
"github.com/sylumi/agentkit/tool"
"github.com/sylumi/agentkit/tool/functiontool"
)
Expand Down Expand Up @@ -56,7 +57,7 @@ func (s serviceStub) AppendEvent(ctx context.Context, current session.Session, e

func createSession(t *testing.T) session.Service {
t.Helper()
s := session.InMemoryService()
s := inmemory.New()
if _, err := s.Create(t.Context(), &session.CreateRequest{AppName: "app", UserID: "user", SessionID: "session"}); err != nil {
t.Fatal(err)
}
Expand Down
7 changes: 4 additions & 3 deletions server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/sylumi/agentkit/model"
"github.com/sylumi/agentkit/server"
"github.com/sylumi/agentkit/session"
"github.com/sylumi/agentkit/session/inmemory"
"github.com/sylumi/agentkit/tool"
"github.com/sylumi/agentkit/tool/functiontool"
)
Expand All @@ -43,7 +44,7 @@ func echoAgent(ctx context.Context, inv *agent.InvocationContext) iter.Seq2[*ses

func newServer(t *testing.T, a agent.Agent) (*server.Server, session.Service) {
t.Helper()
store := session.InMemoryService()
store := inmemory.New()
s, err := server.New(server.Config{AppName: "test", Agent: a, SessionService: store})
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -88,7 +89,7 @@ func create(t *testing.T, h http.Handler) string {
}

func TestConfigAndHTTPValidation(t *testing.T) {
base := server.Config{AppName: "test", Agent: agentFunc(echoAgent), SessionService: session.InMemoryService()}
base := server.Config{AppName: "test", Agent: agentFunc(echoAgent), SessionService: inmemory.New()}
for _, mutate := range []func(*server.Config){
func(c *server.Config) { c.AppName = "" }, func(c *server.Config) { c.Agent = nil },
func(c *server.Config) { c.SessionService = nil },
Expand Down Expand Up @@ -497,7 +498,7 @@ func TestSessionSnapshotDuringRunCompletion(t *testing.T) {
readContext, cancel := context.WithCancel(t.Context())
defer cancel()
store := &snapshotStore{
Service: session.InMemoryService(), readContext: readContext,
Service: inmemory.New(), readContext: readContext,
read: make(chan struct{}), resume: make(chan struct{}),
}
started, finish, committed := make(chan struct{}), make(chan struct{}), make(chan struct{})
Expand Down
193 changes: 0 additions & 193 deletions session/inmemory.go

This file was deleted.

Loading
Loading