chore: checkpoint 第一版
ci / verify (push) Canceled after 0s

This commit is contained in:
Codex Local
2026-09-06 17:04:11 +08:00
parent a8cdec98d1
commit 0c2151ace9
659 changed files with 185855 additions and 554 deletions
+39 -10
View File
@@ -14,8 +14,10 @@ import (
"data-terminal-cloud/internal/deviceauth"
"data-terminal-cloud/internal/embeddingprovider"
"data-terminal-cloud/internal/idempotency"
"data-terminal-cloud/internal/memorytool"
"data-terminal-cloud/internal/outbox"
"data-terminal-cloud/internal/rtc"
"data-terminal-cloud/internal/vikingmemory"
"github.com/jackc/pgx/v5"
"github.com/jackc/pgx/v5/pgxpool"
@@ -29,21 +31,32 @@ type ServiceOptions struct {
TokenTTL time.Duration
HeartbeatInterval int
RequirePublishedRouting bool
HardwareBotID string
HardwareTransport string
SubtitleCallbackURL string
SubtitleCallbackSecret []byte
SubtitlePrimary bool
}
type Service struct {
executor *idempotency.Executor
repository *Repository
audit *audit.Repository
outbox *outbox.Store
tokens rtc.TokenIssuer
leases LeaseCache
options ServiceOptions
pool *pgxpool.Pool
embedder embeddingprovider.Provider
now func() time.Time
viking *vikingmemory.Service
executor *idempotency.Executor
repository *Repository
audit *audit.Repository
outbox *outbox.Store
tokens rtc.TokenIssuer
leases LeaseCache
options ServiceOptions
pool *pgxpool.Pool
embedder embeddingprovider.Provider
hardwareMemoryTool *memorytool.TokenSigner
hardwareMemoryToolURL string
hardwareMemoryToolTTL time.Duration
now func() time.Time
}
func (s *Service) ConfigureVikingMemory(memory *vikingmemory.Service) { s.viking = memory }
func (s *Service) ConfigureMemoryEmbedding(pool *pgxpool.Pool, provider embeddingprovider.Provider) error {
if pool == nil || provider == nil {
return errors.New("memory embedding pool and provider are required")
@@ -53,6 +66,16 @@ func (s *Service) ConfigureMemoryEmbedding(pool *pgxpool.Pool, provider embeddin
return nil
}
func (s *Service) ConfigureHardwareMemoryTool(signer *memorytool.TokenSigner, endpoint string, ttl time.Duration) error {
if signer == nil || strings.TrimSpace(endpoint) == "" || ttl <= 0 {
return errors.New("hardware memory tool signer, endpoint and TTL are required")
}
s.hardwareMemoryTool = signer
s.hardwareMemoryToolURL = strings.TrimSpace(endpoint)
s.hardwareMemoryToolTTL = ttl
return nil
}
func NewService(
executor *idempotency.Executor,
repository *Repository,
@@ -71,6 +94,12 @@ func NewService(
if options.VoiceProvider == "" {
options.VoiceProvider = "mock"
}
if options.HardwareTransport == "" {
options.HardwareTransport = "high_quality"
}
if options.HardwareTransport != "high_quality" && options.HardwareTransport != "low_load" {
return nil, errors.New("hardware agent transport must be high_quality or low_load")
}
return &Service{executor: executor, repository: repository, audit: auditRepository, outbox: outboxStore,
tokens: tokens, leases: leases, options: options, now: time.Now}, nil
}