refactor: migrate core import to dappco.re/go/core
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
bac5b83cbf
commit
4c6c9d7709
3 changed files with 24 additions and 15 deletions
3
go.mod
3
go.mod
|
|
@ -3,9 +3,9 @@ module forge.lthn.ai/core/mcp
|
|||
go 1.26.0
|
||||
|
||||
require (
|
||||
dappco.re/go/core v0.4.7
|
||||
forge.lthn.ai/core/api v0.1.5
|
||||
forge.lthn.ai/core/cli v0.3.7
|
||||
forge.lthn.ai/core/go v0.3.3
|
||||
forge.lthn.ai/core/go-ai v0.1.12
|
||||
forge.lthn.ai/core/go-io v0.1.7
|
||||
forge.lthn.ai/core/go-log v0.0.4
|
||||
|
|
@ -21,6 +21,7 @@ require (
|
|||
)
|
||||
|
||||
require (
|
||||
forge.lthn.ai/core/go v0.3.3 // indirect
|
||||
forge.lthn.ai/core/go-i18n v0.1.7 // indirect
|
||||
forge.lthn.ai/core/go-inference v0.1.6 // indirect
|
||||
github.com/99designs/gqlgen v0.17.88 // indirect
|
||||
|
|
|
|||
2
go.sum
2
go.sum
|
|
@ -1,3 +1,5 @@
|
|||
dappco.re/go/core v0.4.7 h1:KmIA/2lo6rl1NMtLrKqCWfMlUqpDZYH3q0/d10dTtGA=
|
||||
dappco.re/go/core v0.4.7/go.mod h1:f2/tBZ3+3IqDrg2F5F598llv0nmb/4gJVCFzM5geE4A=
|
||||
forge.lthn.ai/core/api v0.1.5 h1:NwZrcOyBjaiz5/cn0n0tnlMUodi8Or6FHMx59C7Kv2o=
|
||||
forge.lthn.ai/core/api v0.1.5/go.mod h1:PBnaWyOVXSOGy+0x2XAPUFMYJxQ2CNhppia/D06ZPII=
|
||||
forge.lthn.ai/core/cli v0.3.7 h1:1GrbaGg0wDGHr6+klSbbGyN/9sSbHvFbdySJznymhwg=
|
||||
|
|
|
|||
|
|
@ -6,30 +6,36 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"forge.lthn.ai/core/go/pkg/core"
|
||||
"dappco.re/go/core"
|
||||
"forge.lthn.ai/core/go-process"
|
||||
)
|
||||
|
||||
// newTestProcessService creates a real process.Service backed by a core.Core for CI tests.
|
||||
func newTestProcessService(t *testing.T) *process.Service {
|
||||
t.Helper()
|
||||
c, err := core.New(
|
||||
core.WithName("process", process.NewService(process.Options{})),
|
||||
)
|
||||
|
||||
c := core.New()
|
||||
raw, err := process.NewService(process.Options{})(c)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create framework core: %v", err)
|
||||
t.Fatalf("Failed to create process service: %v", err)
|
||||
}
|
||||
svc, err := core.ServiceFor[*process.Service](c, "process")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to get process service: %v", err)
|
||||
svc := raw.(*process.Service)
|
||||
|
||||
resultFrom := func(err error) core.Result {
|
||||
if err != nil {
|
||||
return core.Result{Value: err}
|
||||
}
|
||||
return core.Result{OK: true}
|
||||
}
|
||||
// Start services (calls OnStartup)
|
||||
if err := c.ServiceStartup(context.Background(), nil); err != nil {
|
||||
t.Fatalf("Failed to start core: %v", err)
|
||||
}
|
||||
t.Cleanup(func() {
|
||||
_ = c.ServiceShutdown(context.Background())
|
||||
c.Service("process", core.Service{
|
||||
OnStart: func() core.Result { return resultFrom(svc.OnStartup(context.Background())) },
|
||||
OnStop: func() core.Result { return resultFrom(svc.OnShutdown(context.Background())) },
|
||||
})
|
||||
|
||||
if r := c.ServiceStartup(context.Background(), nil); !r.OK {
|
||||
t.Fatalf("Failed to start core: %v", r.Value)
|
||||
}
|
||||
t.Cleanup(func() { c.ServiceShutdown(context.Background()) })
|
||||
return svc
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue