diff --git a/internal/application/service/agent_service.go b/internal/application/service/agent_service.go index aa79df0b..385a7b66 100644 --- a/internal/application/service/agent_service.go +++ b/internal/application/service/agent_service.go @@ -437,7 +437,8 @@ func (s *agentService) initializeSkillsManager( toolRegistry.RegisterTool(tools.NewReadSandboxFileTool(store)) logger.Infof(ctx, "Registered list_sandbox_files and read_sandbox_file tools") } else { - logger.Infof(ctx, "Sandbox backend does not advertise session filesystem capability; list_sandbox_files/read_sandbox_file not registered") + logger.Infof(ctx, "Sandbox backend does not advertise session filesystem capability; "+ + "list_sandbox_files/read_sandbox_file not registered") } } @@ -472,7 +473,7 @@ func registerSandboxShellTool( toolRegistry.RegisterTool(tools.NewInstallShellExecTool(executor)) logger.Infof(ctx, "Registered install-mode shell_exec tool") } else { - logger.Warnf(ctx, "Sandbox backend does not advertise install-mode shell capability; skill install cannot run") + logger.Warnf(ctx, "Sandbox backend does not advertise install-mode shell; skill install cannot run") } return } diff --git a/internal/application/service/agent_service_test.go b/internal/application/service/agent_service_test.go index 00f299ed..b4c2d94e 100644 --- a/internal/application/service/agent_service_test.go +++ b/internal/application/service/agent_service_test.go @@ -44,7 +44,9 @@ func (*fakeAgentChatModel) Chat(context.Context, []chat.Message, *chat.ChatOptio return &types.ChatResponse{}, nil } -func (m *fakeAgentChatModel) ChatStream(_ context.Context, _ []chat.Message, opts *chat.ChatOptions) (<-chan types.StreamResponse, error) { +func (m *fakeAgentChatModel) ChatStream( + _ context.Context, _ []chat.Message, opts *chat.ChatOptions, +) (<-chan types.StreamResponse, error) { m.lastToolNames = nil if opts != nil { for _, tool := range opts.Tools { @@ -72,6 +74,7 @@ func (stubSessionFileStore) EnsureSessionDir(context.Context, string, string) er func (stubSessionFileStore) ListSessionFiles(context.Context, string, string) ([]sandbox.RemoteDirEntry, error) { return nil, nil } + func (stubSessionFileStore) StatSessionFile(context.Context, string, string) (*sandbox.RemoteStatEntry, error) { return nil, nil } diff --git a/internal/application/service/tenant_skill_bundle.go b/internal/application/service/tenant_skill_bundle.go index bd314ab4..fd23bf3a 100644 --- a/internal/application/service/tenant_skill_bundle.go +++ b/internal/application/service/tenant_skill_bundle.go @@ -184,7 +184,8 @@ func parseSkillBundleVersion(manifest string) (string, error) { var metadata struct { Version string `yaml:"version"` } - if err := yaml.Unmarshal([]byte(strings.Join(lines[frontmatterStart+1:frontmatterEnd], "\n")), &metadata); err != nil { + frontmatter := strings.Join(lines[frontmatterStart+1:frontmatterEnd], "\n") + if err := yaml.Unmarshal([]byte(frontmatter), &metadata); err != nil { return "", err } return metadata.Version, nil diff --git a/internal/application/service/tenant_skill_install_test.go b/internal/application/service/tenant_skill_install_test.go index e01eacc2..4a5dea52 100644 --- a/internal/application/service/tenant_skill_install_test.go +++ b/internal/application/service/tenant_skill_install_test.go @@ -1148,6 +1148,7 @@ func (m *installSandboxManager) SessionFileStore() sandbox.SessionFileStore func (m *installSandboxManager) SessionInstallShellExecutor() sandbox.SessionInstallShellExecutor { return m } + func (m *installSandboxManager) EnsureSessionDir(context.Context, string, string) error { return nil } @@ -1441,14 +1442,18 @@ func (s *installSessionService) SetSessionOwnerID(context.Context, uint64, strin func (s *installSessionService) GetSessionsByTenant(context.Context) ([]*types.Session, error) { return nil, nil } -func (s *installSessionService) GetPagedSessionsByTenant(context.Context, *types.Pagination) (*types.PageResult, error) { +func (s *installSessionService) GetPagedSessionsByTenant( + context.Context, *types.Pagination, +) (*types.PageResult, error) { return nil, nil } func (s *installSessionService) UpdateSession(context.Context, *types.Session) error { s.fx.sessionCalls = append(s.fx.sessionCalls, "UpdateSession") return nil } -func (s *installSessionService) UpdateSessionLastRequestState(context.Context, string, *types.SessionLastRequestState) error { +func (s *installSessionService) UpdateSessionLastRequestState( + context.Context, string, *types.SessionLastRequestState, +) error { return nil } func (s *installSessionService) DeleteSession(context.Context, string) error { @@ -1472,7 +1477,9 @@ func (s *installSessionService) CountSessionsBySource(context.Context, *types.Se func (s *installSessionService) SetSessionPinned(context.Context, string, bool) (int64, error) { return 0, nil } -func (s *installSessionService) GenerateTitle(context.Context, *types.Session, []types.Message, string) (string, error) { +func (s *installSessionService) GenerateTitle( + context.Context, *types.Session, []types.Message, string, +) (string, error) { return "", nil } func (s *installSessionService) GenerateTitleAsync(context.Context, *types.Session, string, string, *event.EventBus) { diff --git a/internal/application/service/tenant_skill_service.go b/internal/application/service/tenant_skill_service.go index 00a6af9c..212e6000 100644 --- a/internal/application/service/tenant_skill_service.go +++ b/internal/application/service/tenant_skill_service.go @@ -50,6 +50,9 @@ type TenantSkillService struct { localLocks *keyedMutex } +// NewTenantSkillService wires the repositories and runtimes the install and +// remove flows share. Redis may be nil; the local lock then serialises one +// process only. func NewTenantSkillService( skillsRepo repository.TenantSkillRepository, configsRepo repository.TenantSandboxConfigRepository,