Refactor trace package structure and improve trace ID validation

- Updated trace ID validation in `TestEnterStack_RootCreation` to ensure it is at least 8 digits long.
- Changed import path for the trace package in `stack.go` for consistency.
- Removed the entire `manager.go`, `node.go`, `space.go`, `subscription.go`, `trace.go`, `local/driver.go`, `store/driver.go`, and related types and events files to streamline the trace package, focusing on essential functionality.
This commit is contained in:
Max 2025-11-18 14:09:28 +08:00
parent c02fbcb63e
commit b582f0c685
14 changed files with 17 additions and 17 deletions

View file

@ -5,7 +5,7 @@ import (
"time"
"github.com/google/uuid"
"github.com/yaoapp/yao/agent/trace"
"github.com/yaoapp/yao/trace"
)
// NewStack creates a new root stack with the given trace ID and assistant ID

View file

@ -209,9 +209,9 @@ func TestEnterStack_RootCreation(t *testing.T) {
t.Error("Expected traceID to be generated, got empty string")
}
// TraceID should be 8 digits (from trace.GenTraceID)
if len(traceID) != 8 {
t.Errorf("Expected traceID length 8, got %d", len(traceID))
// TraceID should be at least 8 digits (from trace.GenTraceID)
if len(traceID) < 8 {
t.Errorf("Expected traceID length at least 8, got %d", len(traceID))
}
if stack.TraceID != traceID {

View file

@ -24,8 +24,8 @@ import (
"sync"
"time"
"github.com/yaoapp/yao/agent/trace"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace"
"github.com/yaoapp/yao/trace/types"
)
func main() {
@ -191,8 +191,8 @@ import (
"fmt"
"time"
"github.com/yaoapp/yao/agent/trace"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace"
"github.com/yaoapp/yao/trace/types"
)
func main() {

View file

@ -3,7 +3,7 @@ package local
import (
"context"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// Driver the local disk storage driver implementation

View file

@ -7,7 +7,7 @@ import (
"time"
gonanoid "github.com/matoous/go-nanoid/v2"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// manager implements the Manager interface with unified business logic

View file

@ -4,7 +4,7 @@ import (
"fmt"
"time"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// node implements the Node interface for custom node operations

View file

@ -3,7 +3,7 @@ package trace
import (
"context"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// space implements the Space interface for custom space operations

View file

@ -3,7 +3,7 @@ package store
import (
"context"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// Driver the gou store storage driver implementation

View file

@ -1,7 +1,7 @@
package trace
import (
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/types"
)
// Subscription Operations

View file

@ -7,9 +7,9 @@ import (
"time"
gonanoid "github.com/matoous/go-nanoid/v2"
"github.com/yaoapp/yao/agent/trace/local"
"github.com/yaoapp/yao/agent/trace/store"
"github.com/yaoapp/yao/agent/trace/types"
"github.com/yaoapp/yao/trace/local"
"github.com/yaoapp/yao/trace/store"
"github.com/yaoapp/yao/trace/types"
)
// Driver types