Checkpoint commit covering concurrent work across several archie-core-abg epics to avoid losing in-progress state: - Memory manager (18.7-18.16): background sync pipeline, prefetch with timeout, memory-write notification, threat scanning, shutdown drain with abandoned-write tracking, frozen snapshot pattern. Wired ScanContent and NotifyMemoryToolWrite into HandleToolCall so scanning and notification actually apply to writes, not just exist as unused primitives. - Fixed a literal unresolved merge-conflict that had been committed to internal/memory/scrubber/scrubber.go. - Tool provider/registry, MCP client/transport (stdio, HTTP, SSE), multimodal results, disclosure. - Pairing device auth store, rate limiting. - Gateway compression, session store, tasks. - Various workflow, plugin host, and agentexec updates.
77 lines
2.0 KiB
Go
77 lines
2.0 KiB
Go
// Package memory adapts the memory manager to the typed tool-provider family.
|
|
package memory
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
corememory "github.com/samcharles93/archie-core/internal/memory"
|
|
"github.com/samcharles93/archie-core/internal/plugin"
|
|
"github.com/samcharles93/archie-core/internal/tools"
|
|
)
|
|
|
|
// Provider exposes a memory manager's executable tool schemas.
|
|
type Provider struct {
|
|
manager *corememory.Manager
|
|
}
|
|
|
|
// New creates a memory tool provider.
|
|
func New(manager *corememory.Manager) *Provider {
|
|
return &Provider{manager: manager}
|
|
}
|
|
|
|
// Manifest declares the adapter's tool capability.
|
|
func (p *Provider) Manifest() plugin.Manifest {
|
|
return plugin.Manifest{
|
|
ID: "memory.tools",
|
|
Name: "Memory tools",
|
|
Version: "1.0.0",
|
|
APIVersion: plugin.HostAPIVersion,
|
|
Capabilities: []plugin.CapabilityKind{"tools"},
|
|
}
|
|
}
|
|
|
|
// Start is a no-op because the composition root owns memory initialization.
|
|
func (p *Provider) Start(ctx context.Context) error {
|
|
if err := ctx.Err(); err != nil {
|
|
return err
|
|
}
|
|
if p.manager == nil {
|
|
return errors.New("memory tool provider manager is nil")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Discover returns executable memory tools.
|
|
func (p *Provider) Discover(ctx context.Context) ([]tools.ToolEntry, error) {
|
|
if err := ctx.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
if p.manager == nil {
|
|
return nil, errors.New("memory tool provider manager is nil")
|
|
}
|
|
return p.manager.GetToolSchemas(), nil
|
|
}
|
|
|
|
// Health reports whether a manager is configured.
|
|
func (p *Provider) Health(context.Context) plugin.Health {
|
|
if p.manager == nil {
|
|
return plugin.Health{
|
|
Status: plugin.HealthUnhealthy,
|
|
Message: "memory manager is not configured",
|
|
}
|
|
}
|
|
if p.manager.HasShutdown() {
|
|
return plugin.Health{
|
|
Status: plugin.HealthUnhealthy,
|
|
Message: "memory manager is shut down",
|
|
}
|
|
}
|
|
return plugin.Health{Status: plugin.HealthHealthy}
|
|
}
|
|
|
|
// Stop is a no-op because the daemon owns memory shutdown.
|
|
func (p *Provider) Stop(context.Context) error {
|
|
return nil
|
|
}
|