nowledgemem

package module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 11 Imported by: 0

README

Nowledge Mem Go SDK

Go client library for the Nowledge Mem REST API.

Installation

go get github.com/lib-x/nowledgemem-go

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    mem "github.com/lib-x/nowledgemem-go"
)

func main() {
    // Create client (defaults to http://127.0.0.1:14242)
    client := mem.NewClient()

    // Or with custom base URL
    // client := mem.NewClient(mem.WithBaseURL("http://my-host:14242"))

    ctx := context.Background()

    // Health check
    health, err := client.Health.Check(ctx)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Status:", health.Status)

    // List memories
    resp, err := client.Memories.List(ctx, &mem.ListMemoriesParams{
        Limit: 10,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, m := range resp.Memories {
        fmt.Printf("- %s: %s\n", m.ID, m.Title)
    }

    // Create a memory
    created, err := client.Memories.Create(ctx, &mem.CreateMemoryRequest{
        Content: "This is a test memory",
        Title:   strPtr("Test"),
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println("Created:", created.Memory.ID)

    // Search memories
    results, err := client.Memories.Search(ctx, &mem.SearchMemoriesRequest{
        Query: "test",
        Limit: 5,
    })
    if err != nil {
        log.Fatal(err)
    }
    for _, r := range results.Results {
        fmt.Printf("- %s (score: %.2f)\n", r.Title, r.Score)
    }

    // List threads
    threads, err := client.Threads.List(ctx, &mem.ListThreadsParams{Limit: 10})
    if err != nil {
        log.Fatal(err)
    }
    for _, t := range threads.Threads {
        fmt.Printf("- %s: %s\n", t.ID, t.Title)
    }

    // Browse Nowledge FS
    entries, err := client.FS.List(ctx, "/", 0, "")
    if err != nil {
        log.Fatal(err)
    }
    for _, e := range entries.Entries {
        fmt.Printf("  %s %s\n", e.Type, e.Name)
    }
}

func strPtr(s string) *string { return &s }

Services

Service Description
client.Memories CRUD, search, bulk operations, favorites, labels
client.Threads Thread management, search, session import
client.Spaces Space profiles and configuration
client.Labels Label CRUD
client.Entities Knowledge graph entities
client.Sources Library sources, ingestion, multipart file/folder upload
client.Health Health check, checkpoint
client.FS Path-based tree browsing (ls, cat, stat, find, grep, recall, write, delete)
client.Agent Background Intelligence triggers
client.Events Server-sent events stream
client.Graph Graph analysis, augmentation, orphans

Configuration

// Custom base URL
client := mem.NewClient(mem.WithBaseURL("http://192.168.1.100:14242"))

// Remote deployment with nmem API key
client := mem.NewRemoteClient("https://example.com/remote-api", os.Getenv("NMEM_API_KEY"))

// Equivalent explicit options:
// client := mem.NewClient(
//     mem.WithBaseURL("https://example.com/remote-api"),
//     mem.WithAPIKey(os.Getenv("NMEM_API_KEY")),
// )

// Custom HTTP client
client := mem.NewClient(mem.WithHTTPClient(&http.Client{Timeout: 60 * time.Second}))

// Custom timeout
client := mem.NewClient(mem.WithTimeout(60 * time.Second))

// Always close when done to release idle connections
defer client.Close()

NewClient() targets the local unauthenticated API by default. NewRemoteClient and WithAPIKey are for remote deployments and send the key as both Authorization: Bearer nmem_xxxx and nmem_api_key=nmem_xxxx.

Error Handling

The SDK returns *mem.APIError for API errors:

resp, err := client.Memories.Get(ctx, "nonexistent", "")
if err != nil {
    if apiErr, ok := err.(*mem.APIError); ok {
        fmt.Println("API error:", apiErr.Detail[0].Msg)
    }
}

License

MIT

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AINowAutoApprove added in v0.2.0

type AINowAutoApprove struct {
	Enabled bool `json:"enabled"`
}

AINowAutoApprove is the response for GET /agent/ai-now/sessions/{id}/auto-approve.

type AINowAutoApproveRequest added in v0.2.0

type AINowAutoApproveRequest struct {
	Enabled bool `json:"enabled"`
}

AINowAutoApproveRequest is the request for POST /agent/ai-now/sessions/{id}/auto-approve.

type AINowEvent added in v0.2.0

type AINowEvent struct {
	ID        string `json:"id"`
	EventType string `json:"event_type"`
	Content   string `json:"content,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowEvent represents an AI Now session event.

type AINowFileReadRequest added in v0.2.0

type AINowFileReadRequest struct {
	Path string `json:"path"`
}

AINowFileReadRequest is the request for POST /agent/ai-now/sessions/{id}/files/read.

type AINowFileReadResponse added in v0.2.0

type AINowFileReadResponse struct {
	Content string `json:"content"`
}

AINowFileReadResponse is the response for POST /agent/ai-now/sessions/{id}/files/read.

type AINowMessage added in v0.2.0

type AINowMessage struct {
	ID        string `json:"id"`
	Role      string `json:"role"`
	Content   string `json:"content"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowMessage represents an AI Now session message.

type AINowMessageRequest added in v0.2.0

type AINowMessageRequest struct {
	Content string `json:"content"`
}

AINowMessageRequest is the request for POST /agent/ai-now/sessions/{id}/messages.

type AINowPermissionRequest added in v0.2.0

type AINowPermissionRequest struct {
	Approved bool   `json:"approved"`
	Reason   string `json:"reason,omitempty"`
}

AINowPermissionRequest is the request for POST /agent/ai-now/sessions/{id}/permissions/{request_id}.

type AINowPromptRequest added in v0.2.0

type AINowPromptRequest struct {
	Prompt string `json:"prompt"`
}

AINowPromptRequest is the request for POST /agent/ai-now/sessions/{id}/prompt.

type AINowPromptResponse added in v0.2.0

type AINowPromptResponse struct {
	Response string `json:"response"`
}

AINowPromptResponse is the response for POST /agent/ai-now/sessions/{id}/prompt.

type AINowSession added in v0.2.0

type AINowSession struct {
	ID        string `json:"id"`
	Status    string `json:"status"`
	CreatedAt string `json:"created_at,omitempty"`
}

AINowSession represents an AI Now session.

type AINowSkillPromptRequest added in v0.2.0

type AINowSkillPromptRequest struct {
	SkillID string `json:"skill_id"`
	Prompt  string `json:"prompt,omitempty"`
}

AINowSkillPromptRequest is the request for POST /agent/ai-now/skill-prompts.

type AINowSkillPromptResponse added in v0.2.0

type AINowSkillPromptResponse struct {
	Response string `json:"response"`
}

AINowSkillPromptResponse is the response for POST /agent/ai-now/skill-prompts.

type APIError

type APIError struct {
	StatusCode int           `json:"-"`
	Status     string        `json:"-"`
	Body       string        `json:"-"`
	Detail     []ErrorDetail `json:"detail"`
}

APIError represents an error response from the API.

func (*APIError) Error

func (e *APIError) Error() string

type AdminService added in v0.2.0

type AdminService struct {
	// contains filtered or unexported fields
}

AdminService handles admin operations.

func (*AdminService) CheckUpgrade added in v0.2.0

func (s *AdminService) CheckUpgrade(ctx context.Context) (*UpgradeInfo, error)

CheckUpgrade checks for available upgrades.

func (*AdminService) DownloadUpgrade added in v0.2.0

func (s *AdminService) DownloadUpgrade(ctx context.Context) error

DownloadUpgrade downloads an available upgrade.

func (*AdminService) InstallUpgrade added in v0.2.0

func (s *AdminService) InstallUpgrade(ctx context.Context) error

InstallUpgrade installs a downloaded upgrade.

type AgentService

type AgentService struct {
	// contains filtered or unexported fields
}

AgentService handles Background Intelligence operations.

func (*AgentService) CancelAINowSession added in v0.2.0

func (s *AgentService) CancelAINowSession(ctx context.Context, sessionID string) error

CancelAINowSession cancels an AI Now session.

func (*AgentService) CloseAINowSession added in v0.2.0

func (s *AgentService) CloseAINowSession(ctx context.Context, sessionID string) error

CloseAINowSession closes an AI Now session.

func (*AgentService) CreateAINowSession added in v0.2.0

func (s *AgentService) CreateAINowSession(ctx context.Context, req *CreateAINowSessionRequest) (*AINowSession, error)

CreateAINowSession creates a new AI Now session.

func (*AgentService) CreateGraphIntelligenceSession added in v0.2.0

func (s *AgentService) CreateGraphIntelligenceSession(ctx context.Context) (*GraphIntelligenceSession, error)

CreateGraphIntelligenceSession creates a new graph intelligence session.

func (*AgentService) DeleteAINowSession added in v0.2.0

func (s *AgentService) DeleteAINowSession(ctx context.Context, sessionID string) error

DeleteAINowSession deletes an AI Now session.

func (*AgentService) GetAINowAutoApprove added in v0.2.0

func (s *AgentService) GetAINowAutoApprove(ctx context.Context, sessionID string) (*AINowAutoApprove, error)

GetAINowAutoApprove returns auto-approve status for an AI Now session.

func (*AgentService) GetAINowSession added in v0.2.0

func (s *AgentService) GetAINowSession(ctx context.Context, sessionID string) (*AINowSession, error)

GetAINowSession returns a specific AI Now session.

func (*AgentService) GetAINowSessionEvents added in v0.2.0

func (s *AgentService) GetAINowSessionEvents(ctx context.Context, sessionID string) ([]AINowEvent, error)

GetAINowSessionEvents returns events for an AI Now session.

func (*AgentService) GetAINowSessionMessages added in v0.2.0

func (s *AgentService) GetAINowSessionMessages(ctx context.Context, sessionID string) ([]AINowMessage, error)

GetAINowSessionMessages returns messages for an AI Now session.

func (*AgentService) GetAINowSessions added in v0.2.0

func (s *AgentService) GetAINowSessions(ctx context.Context, limit int) ([]AINowSession, error)

GetAINowSessions returns AI Now sessions.

func (*AgentService) GetEvolves added in v0.2.0

func (s *AgentService) GetEvolves(ctx context.Context) ([]EvolutionEdge, error)

GetEvolves returns EVOLVES relationships between memories.

func (*AgentService) GetGraphIntelligenceSession added in v0.2.0

func (s *AgentService) GetGraphIntelligenceSession(ctx context.Context, sessionID string) (*GraphIntelligenceSession, error)

GetGraphIntelligenceSession returns a graph intelligence session.

func (*AgentService) GetGraphIntelligenceStatus added in v0.2.0

func (s *AgentService) GetGraphIntelligenceStatus(ctx context.Context) (*GraphIntelligenceStatus, error)

GetGraphIntelligenceStatus returns graph intelligence status.

func (*AgentService) GetKnowledgeProcessingStatus added in v0.2.0

func (s *AgentService) GetKnowledgeProcessingStatus(ctx context.Context) (*KnowledgeProcessingStatus, error)

GetKnowledgeProcessingStatus returns knowledge processing settings and status.

func (*AgentService) PromptAINowSession added in v0.2.0

func (s *AgentService) PromptAINowSession(ctx context.Context, sessionID string, req *AINowPromptRequest) (*AINowPromptResponse, error)

PromptAINowSession sends a prompt to an AI Now session.

func (*AgentService) ReadAINowSessionFile added in v0.2.0

func (s *AgentService) ReadAINowSessionFile(ctx context.Context, sessionID string, req *AINowFileReadRequest) (*AINowFileReadResponse, error)

ReadAINowSessionFile reads a file from an AI Now session.

func (*AgentService) RequestAINowPermission added in v0.2.0

func (s *AgentService) RequestAINowPermission(ctx context.Context, sessionID, requestID string, req *AINowPermissionRequest) error

RequestAINowPermission requests permission in an AI Now session.

func (*AgentService) SendAINowSessionMessage added in v0.2.0

func (s *AgentService) SendAINowSessionMessage(ctx context.Context, sessionID string, req *AINowMessageRequest) (*AINowMessage, error)

SendAINowSessionMessage sends a message to an AI Now session.

func (*AgentService) SendAINowSkillPrompt added in v0.2.0

func (s *AgentService) SendAINowSkillPrompt(ctx context.Context, req *AINowSkillPromptRequest) (*AINowSkillPromptResponse, error)

SendAINowSkillPrompt sends a skill prompt to AI Now.

func (*AgentService) SendGraphIntelligenceMessage added in v0.2.0

SendGraphIntelligenceMessage sends a message to graph intelligence.

func (*AgentService) SetAINowAutoApprove added in v0.2.0

func (s *AgentService) SetAINowAutoApprove(ctx context.Context, sessionID string, req *AINowAutoApproveRequest) error

SetAINowAutoApprove sets auto-approve for an AI Now session.

func (*AgentService) Status

func (s *AgentService) Status(ctx context.Context) (*AgentStatus, error)

Status returns the agent's current status.

func (*AgentService) TriggerCommunityDetection

func (s *AgentService) TriggerCommunityDetection(ctx context.Context) error

TriggerCommunityDetection triggers community detection on the knowledge graph.

func (*AgentService) TriggerCrystallization

func (s *AgentService) TriggerCrystallization(ctx context.Context) error

TriggerCrystallization triggers a crystallization review.

func (*AgentService) TriggerDailyBriefing

func (s *AgentService) TriggerDailyBriefing(ctx context.Context) error

TriggerDailyBriefing triggers a daily briefing.

func (*AgentService) TriggerDecayRefresh

func (s *AgentService) TriggerDecayRefresh(ctx context.Context) error

TriggerDecayRefresh triggers a decay score refresh.

func (*AgentService) TriggerInsightDetection

func (s *AgentService) TriggerInsightDetection(ctx context.Context) error

TriggerInsightDetection triggers proactive insight detection.

func (*AgentService) TriggerKGExtraction

func (s *AgentService) TriggerKGExtraction(ctx context.Context, req *KGExtractionRequest) error

TriggerKGExtraction triggers knowledge graph extraction.

func (*AgentService) TriggerMemoryCompaction

func (s *AgentService) TriggerMemoryCompaction(ctx context.Context) error

TriggerMemoryCompaction triggers a memory compaction review.

func (*AgentService) UpdateAINowSession added in v0.2.0

func (s *AgentService) UpdateAINowSession(ctx context.Context, sessionID string, req map[string]any) error

UpdateAINowSession updates an AI Now session.

type AgentStatus

type AgentStatus struct {
	Running         bool   `json:"running"`
	CurrentTask     string `json:"current_task,omitempty"`
	LastRunAt       string `json:"last_run_at,omitempty"`
	NextScheduledAt string `json:"next_scheduled_at,omitempty"`
}

AgentStatus is the response body for GET /agent/status.

type AppendMessagesResponse

type AppendMessagesResponse struct {
	Thread   Thread          `json:"thread"`
	Messages []ThreadMessage `json:"messages"`
}

AppendMessagesResponse is the response for POST /threads/{id}/append.

type AugmentationJob

type AugmentationJob struct {
	ID        string         `json:"id"`
	JobType   string         `json:"job_type"`
	Status    string         `json:"status"`
	Progress  float64        `json:"progress"`
	StartedAt string         `json:"started_at,omitempty"`
	EndedAt   string         `json:"ended_at,omitempty"`
	Error     string         `json:"error,omitempty"`
	Params    map[string]any `json:"params,omitempty"`
}

AugmentationJob represents an augmentation job.

type AugmentationState

type AugmentationState struct {
	Running    bool             `json:"running"`
	CurrentJob *AugmentationJob `json:"current_job,omitempty"`
	LastRun    string           `json:"last_run,omitempty"`
}

AugmentationState is the response body for GET /graph/augmentation/state.

type BatchIngestRequest

type BatchIngestRequest struct {
	FilePaths []string `json:"file_paths"`
	SpaceID   string   `json:"space_id,omitempty"`
}

BatchIngestRequest is the request body for POST /sources/ingest/batch.

type BatchIngestResponse

type BatchIngestResponse struct {
	Sources []Source `json:"sources"`
	Failed  []string `json:"failed,omitempty"`
}

BatchIngestResponse is the response body for POST /sources/ingest/batch.

type BulkDeleteRequest

type BulkDeleteRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	SpaceID   string   `json:"space_id,omitempty"`
}

BulkDeleteRequest is the request for POST /memories/bulk/delete.

type BulkDeleteResponse

type BulkDeleteResponse struct {
	Deleted int `json:"deleted"`
	Failed  int `json:"failed"`
}

BulkDeleteResponse is the response for POST /memories/bulk/delete.

type BulkMovePreviewRequest

type BulkMovePreviewRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	FromSpace string   `json:"from_space,omitempty"`
	ToSpace   string   `json:"to_space"`
}

BulkMovePreviewRequest is the request for POST /memories/bulk/move/preview.

type BulkMovePreviewResponse

type BulkMovePreviewResponse struct {
	WillMove  int      `json:"will_move"`
	Conflicts []string `json:"conflicts,omitempty"`
}

BulkMovePreviewResponse is the response for POST /memories/bulk/move/preview.

type BulkMoveRequest

type BulkMoveRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	FromSpace string   `json:"from_space,omitempty"`
	ToSpace   string   `json:"to_space"`
}

BulkMoveRequest is the request for POST /memories/bulk/move.

type BulkMoveResponse

type BulkMoveResponse struct {
	Moved  int `json:"moved"`
	Failed int `json:"failed"`
}

BulkMoveResponse is the response for POST /memories/bulk/move.

type Capabilities added in v0.2.0

type Capabilities struct {
	Version       string          `json:"version"`
	Features      map[string]bool `json:"features,omitempty"`
	SpacesEnabled bool            `json:"spaces_enabled,omitempty"`
}

Capabilities is the response for GET /capabilities.

type CapabilitiesService added in v0.2.0

type CapabilitiesService struct {
	// contains filtered or unexported fields
}

CapabilitiesService handles server capabilities.

func (*CapabilitiesService) Get added in v0.2.0

Get returns server capabilities — unauthenticated, used by clients to adapt UI.

type CleanupOrphansResponse

type CleanupOrphansResponse struct {
	Removed int `json:"removed"`
}

CleanupOrphansResponse is the response body for DELETE /graph/orphans.

type Client

type Client struct {

	// Services provides access to API resource operations.
	Memories      *MemoriesService
	Threads       *ThreadsService
	Spaces        *SpacesService
	Labels        *LabelsService
	Entities      *EntitiesService
	Sources       *SourcesService
	Health        *HealthService
	FS            *FSService
	Agent         *AgentService
	Graph         *GraphService
	GraphVis      *GraphVisService
	Distillation  *DistillationService
	KG            *KGService
	Communities   *CommunitiesService
	Events        *EventsService
	Data          *DataService
	Storage       *StorageService
	Settings      *SettingsService
	Models        *ModelsService
	SearchIndex   *SearchIndexService
	Embeddings    *EmbeddingsService
	Feed          *FeedService
	WorkingMemory *WorkingMemoryService
	Library       *LibraryService
	Capabilities  *CapabilitiesService
	Admin         *AdminService
	Favorites     *FavoritesService
	ContentStore  *ContentStoreService
	// contains filtered or unexported fields
}

Client is the Nowledge Mem API client.

Create a client with NewClient:

client := nowledgemem.NewClient()
client := nowledgemem.NewClient(nowledgemem.WithBaseURL("http://host:14242"))

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new Nowledge Mem API client.

Example
package main

import (
	"context"
	"fmt"
	"log"

	mem "github.com/lib-x/nowledgemem-go"
)

func main() {
	// Create a client with default settings (http://127.0.0.1:14242)
	client := mem.NewClient()
	defer client.Close()

	ctx := context.Background()

	// Health check
	health, err := client.Health.Check(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Status:", health.Status)

	// List memories
	resp, err := client.Memories.List(ctx, &mem.ListMemoriesParams{
		Limit: 5,
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, m := range resp.Memories {
		fmt.Printf("- %s: %s\n", m.ID, m.Title)
	}
}
Example (WithOptions)
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	mem "github.com/lib-x/nowledgemem-go"
)

func main() {
	// Create a client with custom base URL and timeout
	client := mem.NewClient(
		mem.WithBaseURL("http://192.168.1.100:14242"),
		mem.WithTimeout(60*time.Second),
	)
	defer client.Close()

	ctx := context.Background()

	// Create a memory
	created, err := client.Memories.Create(ctx, &mem.CreateMemoryRequest{
		Content: "Remember to review the API design",
		Title:   strPtr("API Review"),
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("Created memory:", created.Memory.ID)

	// Search memories
	results, err := client.Memories.Search(ctx, &mem.SearchMemoriesRequest{
		Query: "API design",
		Limit: 5,
	})
	if err != nil {
		log.Fatal(err)
	}
	for _, r := range results.Results {
		fmt.Printf("- %s (score: %.2f)\n", r.Title, r.Score)
	}
}

func strPtr(s string) *string { return &s }

func NewRemoteClient added in v0.3.1

func NewRemoteClient(rawURL, apiKey string, opts ...Option) *Client

NewRemoteClient creates a client for a remote Nowledge Mem deployment.

Remote deployments use a base URL such as "https://host/remote-api" and an nmem API key. The key is sent as both Authorization: Bearer nmem_xxxx and nmem_api_key=nmem_xxxx.

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

BaseURL returns the client's base URL.

func (*Client) Close

func (c *Client) Close()

Close closes idle HTTP connections. Call this when done with the client.

type CommunitiesService added in v0.2.0

type CommunitiesService struct {
	// contains filtered or unexported fields
}

CommunitiesService handles community operations.

func (*CommunitiesService) Get added in v0.2.0

func (s *CommunitiesService) Get(ctx context.Context, communityID string) (*CommunityDetail, error)

Get returns community details including entities and sample memories.

func (*CommunitiesService) GetRecentMemories added in v0.2.0

func (s *CommunitiesService) GetRecentMemories(ctx context.Context, communityID string, limit int) ([]MemoryListItem, error)

GetRecentMemories returns recent memories in a community.

func (*CommunitiesService) GetRelated added in v0.2.0

func (s *CommunitiesService) GetRelated(ctx context.Context, communityID string, limit int) ([]Community, error)

GetRelated returns related communities.

func (*CommunitiesService) GetSubgraph added in v0.2.0

func (s *CommunitiesService) GetSubgraph(ctx context.Context, communityID string) (*GraphData, error)

GetSubgraph returns the subgraph for a community.

func (*CommunitiesService) List added in v0.2.0

func (s *CommunitiesService) List(ctx context.Context, limit int) ([]Community, error)

List returns knowledge communities with AI summaries.

type Community

type Community struct {
	ID           string   `json:"id"`
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Size         int      `json:"size"`
	SampleMemIDs []string `json:"sample_mem_ids,omitempty"`
}

Community represents a knowledge community.

type CommunityDetail added in v0.2.0

type CommunityDetail struct {
	ID             string           `json:"id"`
	Name           string           `json:"name"`
	Description    string           `json:"description,omitempty"`
	Size           int              `json:"size"`
	SampleMemIDs   []string         `json:"sample_mem_ids,omitempty"`
	Entities       []Entity         `json:"entities,omitempty"`
	SampleMemories []MemoryListItem `json:"sample_memories,omitempty"`
}

CommunityDetail holds detailed community info.

type ContentStoreInfo

type ContentStoreInfo struct {
	State                       string `json:"state"`
	DBPath                      string `json:"db_path"`
	SQLiteReady                 bool   `json:"sqlite_ready"`
	SchemaVersion               int    `json:"schema_version"`
	SchemaMinSupportedVersion   int    `json:"schema_min_supported_version"`
	SchemaMigrationCount        int    `json:"schema_migration_count"`
	ThreadMessageOwner          string `json:"thread_message_owner"`
	CutoverReady                bool   `json:"cutover_ready"`
	CutoverCompleted            bool   `json:"cutover_completed"`
	LegacyGraphCleanupCompleted bool   `json:"legacy_graph_cleanup_completed"`
	SQLiteMessageCount          int    `json:"sqlite_message_count"`
	SQLiteThreadCount           int    `json:"sqlite_thread_count"`
	SQLiteAnchorCount           int    `json:"sqlite_anchor_count"`
	LegacyKuzuMessageCount      int    `json:"legacy_kuzu_message_count"`
	LastError                   string `json:"last_error"`
	UpdatedAt                   string `json:"updated_at"`
}

ContentStoreInfo holds content store status.

type ContentStoreMigrationStatus added in v0.2.0

type ContentStoreMigrationStatus struct {
	State                       string `json:"state"`
	DBPath                      string `json:"db_path"`
	SQLiteReady                 bool   `json:"sqlite_ready"`
	SchemaVersion               int    `json:"schema_version"`
	SchemaMinSupportedVersion   int    `json:"schema_min_supported_version"`
	SchemaMigrationCount        int    `json:"schema_migration_count"`
	ThreadMessageOwner          string `json:"thread_message_owner"`
	CutoverReady                bool   `json:"cutover_ready"`
	CutoverCompleted            bool   `json:"cutover_completed"`
	LegacyGraphCleanupCompleted bool   `json:"legacy_graph_cleanup_completed"`
	SQLiteMessageCount          int    `json:"sqlite_message_count"`
	SQLiteThreadCount           int    `json:"sqlite_thread_count"`
	SQLiteAnchorCount           int    `json:"sqlite_anchor_count"`
	LegacyKuzuMessageCount      int    `json:"legacy_kuzu_message_count"`
	LastError                   string `json:"last_error"`
	UpdatedAt                   string `json:"updated_at"`
}

ContentStoreMigrationStatus is the response for GET /content-store/migration/status.

type ContentStoreService added in v0.2.0

type ContentStoreService struct {
	// contains filtered or unexported fields
}

ContentStoreService handles content store migration operations.

func (*ContentStoreService) CleanupLegacyGraph added in v0.2.0

func (s *ContentStoreService) CleanupLegacyGraph(ctx context.Context) error

CleanupLegacyGraph cleans up the legacy thread message graph.

func (*ContentStoreService) CopyAll added in v0.2.0

func (s *ContentStoreService) CopyAll(ctx context.Context) error

CopyAll copies all legacy thread messages into SQLite.

func (*ContentStoreService) CopyBatch added in v0.2.0

func (s *ContentStoreService) CopyBatch(ctx context.Context, batchSize int) error

CopyBatch copies one bounded legacy Kuzu Message page into SQLite.

func (*ContentStoreService) Cutover added in v0.2.0

func (s *ContentStoreService) Cutover(ctx context.Context) error

Cutover performs the content store cutover.

func (*ContentStoreService) GetMigrationStatus added in v0.2.0

func (s *ContentStoreService) GetMigrationStatus(ctx context.Context) (*ContentStoreMigrationStatus, error)

GetMigrationStatus returns the current migration status.

func (*ContentStoreService) MigrateAnchors added in v0.2.0

func (s *ContentStoreService) MigrateAnchors(ctx context.Context) error

MigrateAnchors migrates thread message anchors.

func (*ContentStoreService) MigrateThroughCutover added in v0.2.0

func (s *ContentStoreService) MigrateThroughCutover(ctx context.Context) error

MigrateThroughCutover migrates thread messages through cutover.

func (*ContentStoreService) Verify added in v0.2.0

func (s *ContentStoreService) Verify(ctx context.Context) error

Verify verifies the content store migration.

type CreateAINowSessionRequest added in v0.2.0

type CreateAINowSessionRequest struct {
	Prompt  string `json:"prompt,omitempty"`
	Context string `json:"context,omitempty"`
}

CreateAINowSessionRequest is the request for POST /agent/ai-now/sessions.

type CreateEmbeddingsRequest added in v0.2.0

type CreateEmbeddingsRequest struct {
	Model          string `json:"model,omitempty"`
	Input          any    `json:"input"`
	EncodingFormat string `json:"encoding_format,omitempty"`
	Dimensions     *int   `json:"dimensions,omitempty"`
	User           string `json:"user,omitempty"`
	InputType      string `json:"input_type,omitempty"`
}

CreateEmbeddingsRequest is the request for POST /v1/embeddings.

type CreateEmbeddingsResponse added in v0.2.0

type CreateEmbeddingsResponse struct {
	Object string          `json:"object"`
	Data   []EmbeddingData `json:"data"`
	Model  string          `json:"model"`
	Usage  EmbeddingUsage  `json:"usage"`
}

CreateEmbeddingsResponse is the response for POST /v1/embeddings.

type CreateLabelRequest

type CreateLabelRequest struct {
	Name        string `json:"name"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
}

CreateLabelRequest is the request body for POST /labels.

type CreateMemoryRequest

type CreateMemoryRequest struct {
	ID              *string        `json:"id,omitempty"`
	Content         string         `json:"content"`
	Title           *string        `json:"title,omitempty"`
	SourceThreadID  *string        `json:"source_thread_id,omitempty"`
	SourceMsgRange  map[string]int `json:"source_message_range,omitempty"`
	Source          *string        `json:"source,omitempty"`
	Importance      *float64       `json:"importance,omitempty"`
	Confidence      *float64       `json:"confidence,omitempty"`
	Labels          []string       `json:"labels,omitempty"`
	SpaceID         *string        `json:"space_id,omitempty"`
	Metadata        map[string]any `json:"metadata,omitempty"`
	EventStart      *string        `json:"event_start,omitempty"`
	EventEnd        *string        `json:"event_end,omitempty"`
	TemporalContext *string        `json:"temporal_context,omitempty"`
	UnitType        *string        `json:"unit_type,omitempty"`
}

CreateMemoryRequest is the request body for POST /memories.

type CreateMemoryResponse

type CreateMemoryResponse struct {
	Memory               Memory   `json:"memory"`
	ExtractedEntities    []Entity `json:"extracted_entities,omitempty"`
	AssignedLabels       []string `json:"assigned_labels,omitempty"`
	CreatedRelationships int      `json:"created_relationships,omitempty"`
	Action               string   `json:"action,omitempty"`
	Warnings             []string `json:"warnings,omitempty"`
}

CreateMemoryResponse is the response body for POST /memories.

type CreateSpaceRequest

type CreateSpaceRequest struct {
	Name                 string `json:"name"`
	Description          string `json:"description,omitempty"`
	Icon                 string `json:"icon,omitempty"`
	Instructions         string `json:"instructions,omitempty"`
	DefaultRetrievalMode string `json:"defaultRetrievalMode,omitempty"`
}

CreateSpaceRequest is the request body for POST /spaces.

type CreateThreadRequest

type CreateThreadRequest struct {
	ThreadID     string                 `json:"thread_id"`
	Title        *string                `json:"title,omitempty"`
	Messages     []MessageCreateRequest `json:"messages"`
	Participants []string               `json:"participants,omitempty"`
	Source       *string                `json:"source,omitempty"`
	SpaceID      string                 `json:"space_id,omitempty"`
	Project      *string                `json:"project,omitempty"`
	Workspace    *string                `json:"workspace,omitempty"`
	ToolVersion  *string                `json:"tool_version,omitempty"`
	ImportDate   *string                `json:"import_date,omitempty"`
	Metadata     map[string]any         `json:"metadata,omitempty"`
}

CreateThreadRequest is the request body for POST /threads.

type CreateThreadResponse

type CreateThreadResponse struct {
	Thread                  Thread          `json:"thread"`
	Messages                []ThreadMessage `json:"messages,omitempty"`
	CreatedRelationships    int             `json:"created_relationships,omitempty"`
	AutoGeneratedSummary    string          `json:"auto_generated_summary,omitempty"`
	ExtractedMemories       []Memory        `json:"extracted_memories,omitempty"`
	AutoExtractionPerformed bool            `json:"auto_extraction_performed,omitempty"`
}

CreateThreadResponse is the response body for POST /threads.

type DataExportRequest added in v0.2.0

type DataExportRequest struct {
	ExportPath         string `json:"export_path"`
	Compress           bool   `json:"compress,omitempty"`
	Overwrite          bool   `json:"overwrite,omitempty"`
	IncludeMemories    *bool  `json:"include_memories,omitempty"`
	IncludeThreads     *bool  `json:"include_threads,omitempty"`
	IncludeMessages    *bool  `json:"include_messages,omitempty"`
	IncludeEntities    *bool  `json:"include_entities,omitempty"`
	IncludeLabels      *bool  `json:"include_labels,omitempty"`
	IncludeSources     *bool  `json:"include_sources,omitempty"`
	IncludeCommunities *bool  `json:"include_communities,omitempty"`
}

DataExportRequest is the request for POST /data/export.

type DataExportResponse added in v0.2.0

type DataExportResponse struct {
	Path      string `json:"path"`
	SizeBytes int64  `json:"size_bytes"`
	ItemCount int    `json:"item_count"`
}

DataExportResponse is the response for POST /data/export.

type DataImportRequest added in v0.2.0

type DataImportRequest struct {
	ImportPath string `json:"import_path"`
	Overwrite  bool   `json:"overwrite,omitempty"`
}

DataImportRequest is the request for POST /data/import.

type DataImportResponse added in v0.2.0

type DataImportResponse struct {
	JobID   string `json:"job_id"`
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

DataImportResponse is the response for POST /data/import.

type DataImportStatus added in v0.2.0

type DataImportStatus struct {
	JobID    string  `json:"job_id"`
	Status   string  `json:"status"`
	Progress float64 `json:"progress"`
	Imported int     `json:"imported"`
	Skipped  int     `json:"skipped"`
	Failed   int     `json:"failed"`
	Message  string  `json:"message,omitempty"`
}

DataImportStatus is the response for GET /data/import/status/{job_id}.

type DataService added in v0.2.0

type DataService struct {
	// contains filtered or unexported fields
}

DataService handles data export/import operations.

func (*DataService) Checkpoint added in v0.2.0

func (s *DataService) Checkpoint(ctx context.Context) error

Checkpoint forces a database checkpoint.

func (*DataService) DownloadExport added in v0.2.0

func (s *DataService) DownloadExport(ctx context.Context, req *DataExportRequest) ([]byte, error)

DownloadExport creates and downloads a ZIP export.

func (*DataService) Export added in v0.2.0

Export exports a portable data bundle to a server-side path.

func (*DataService) Import added in v0.2.0

Import imports data from a server-side export path.

func (*DataService) ImportStatus added in v0.2.0

func (s *DataService) ImportStatus(ctx context.Context, jobID string) (*DataImportStatus, error)

ImportStatus checks status of a data import job.

func (*DataService) UploadImport added in v0.2.0

func (s *DataService) UploadImport(ctx context.Context, req *UploadImportRequest) (*DataImportResponse, error)

UploadImport uploads a ZIP export from web and remote clients. file is the ZIP file content, filename is the name of the file.

type DeleteMemoryParams

type DeleteMemoryParams struct {
	CascadeDelete bool   `json:"cascade_delete,omitempty"`
	SpaceID       string `json:"space_id,omitempty"`
}

DeleteMemoryParams are query parameters for DELETE /memories/{id}.

type DeleteMemoryResponse

type DeleteMemoryResponse struct {
	Message              string `json:"message"`
	DeletedRelationships int    `json:"deleted_relationships,omitempty"`
	DeletedEntities      int    `json:"deleted_entities,omitempty"`
}

DeleteMemoryResponse is the response body for DELETE /memories/{id}.

type DiscoveredSession added in v0.2.0

type DiscoveredSession struct {
	Path      string `json:"path"`
	Source    string `json:"source"`
	Project   string `json:"project,omitempty"`
	SessionID string `json:"session_id,omitempty"`
	Title     string `json:"title,omitempty"`
	Messages  int    `json:"messages"`
	Date      string `json:"date,omitempty"`
}

DiscoveredSession represents a discovered conversation session.

type DistillPlanRequest added in v0.2.0

type DistillPlanRequest struct {
	ThreadID string  `json:"thread_id"`
	SpaceID  *string `json:"space_id,omitempty"`
}

DistillPlanRequest is the request for POST /memories/distill/plan.

type DistillPlanResponse added in v0.2.0

type DistillPlanResponse struct {
	Plan string `json:"plan"`
}

DistillPlanResponse is the response for POST /memories/distill/plan.

type DistillPreviewRequest added in v0.2.0

type DistillPreviewRequest struct {
	ThreadID               string  `json:"thread_id"`
	ThreadTitle            *string `json:"thread_title,omitempty"`
	ThreadContent          *string `json:"thread_content,omitempty"`
	DistillationType       *string `json:"distillation_type,omitempty"`
	ExtractionLevel        *string `json:"extraction_level,omitempty"`
	SelectedMessageIndices []int   `json:"selected_message_indices,omitempty"`
	PreferredLanguage      *string `json:"preferred_language,omitempty"`
	SpaceID                *string `json:"space_id,omitempty"`
}

DistillPreviewRequest is the request for POST /memories/distill/preview.

type DistillPreviewResponse added in v0.2.0

type DistillPreviewResponse struct {
	ProposedMemories []ProposedMemory `json:"proposed_memories"`
	CacheKey         string           `json:"cache_key,omitempty"`
}

DistillPreviewResponse is the response for POST /memories/distill/preview.

type DistillRequest added in v0.2.0

type DistillRequest struct {
	ThreadID               string  `json:"thread_id"`
	ThreadTitle            *string `json:"thread_title,omitempty"`
	ThreadContent          *string `json:"thread_content,omitempty"`
	DistillationType       *string `json:"distillation_type,omitempty"`
	ExtractionLevel        *string `json:"extraction_level,omitempty"`
	CacheKey               *string `json:"cache_key,omitempty"`
	SelectedMessageIndices []int   `json:"selected_message_indices,omitempty"`
	PreferredLanguage      *string `json:"preferred_language,omitempty"`
	ForceDistill           bool    `json:"force_distill,omitempty"`
	SpaceID                *string `json:"space_id,omitempty"`
}

DistillRequest is the request for POST /memories/distill.

type DistillResponse added in v0.2.0

type DistillResponse struct {
	CreatedMemories []Memory `json:"created_memories"`
	Skipped         bool     `json:"skipped,omitempty"`
	SkipReason      string   `json:"skip_reason,omitempty"`
}

DistillResponse is the response for POST /memories/distill.

type DistillScheduleRequest added in v0.2.0

type DistillScheduleRequest struct {
	ThreadID string  `json:"thread_id"`
	SpaceID  *string `json:"space_id,omitempty"`
}

DistillScheduleRequest is the request for POST /memories/distill/schedule.

type DistillScheduleResponse added in v0.2.0

type DistillScheduleResponse struct {
	Scheduled bool   `json:"scheduled"`
	JobID     string `json:"job_id,omitempty"`
}

DistillScheduleResponse is the response for POST /memories/distill/schedule.

type DistillationService added in v0.2.0

type DistillationService struct {
	// contains filtered or unexported fields
}

DistillationService handles memory distillation from threads.

func (*DistillationService) Distill added in v0.2.0

Distill creates memories from thread content after distillation.

func (*DistillationService) Plan added in v0.2.0

Plan creates a distillation plan.

func (*DistillationService) Preview added in v0.2.0

Preview previews distillation results without creating memories.

func (*DistillationService) Schedule added in v0.2.0

Schedule schedules a distillation job.

func (*DistillationService) Triage added in v0.2.0

Triage performs a lightweight check: does this conversation have save-worthy content?

type EmbeddingData added in v0.2.0

type EmbeddingData struct {
	Object    string    `json:"object"`
	Embedding []float64 `json:"embedding"`
	Index     int       `json:"index"`
}

EmbeddingData is a single embedding result.

type EmbeddingModel added in v0.2.0

type EmbeddingModel struct {
	ID      string `json:"id"`
	Object  string `json:"object"`
	OwnedBy string `json:"owned_by"`
}

EmbeddingModel represents an available embedding model.

type EmbeddingModelStatus added in v0.2.0

type EmbeddingModelStatus struct {
	Installed bool   `json:"installed"`
	Ready     bool   `json:"ready"`
	ModelPath string `json:"model_path,omitempty"`
	Version   string `json:"version,omitempty"`
}

EmbeddingModelStatus is the response for GET /models/bge-m3/status.

type EmbeddingUsage added in v0.2.0

type EmbeddingUsage struct {
	PromptTokens int `json:"prompt_tokens"`
	TotalTokens  int `json:"total_tokens"`
}

EmbeddingUsage tracks token usage.

type EmbeddingsService added in v0.2.0

type EmbeddingsService struct {
	// contains filtered or unexported fields
}

EmbeddingsService handles OpenAI-compatible embedding operations.

func (*EmbeddingsService) CreateEmbeddings added in v0.2.0

CreateEmbeddings generates embeddings using the local model.

func (*EmbeddingsService) ListModels added in v0.2.0

func (s *EmbeddingsService) ListModels(ctx context.Context) ([]EmbeddingModel, error)

ListModels lists available models.

type EntitiesService

type EntitiesService struct {
	// contains filtered or unexported fields
}

EntitiesService handles entity operations.

func (*EntitiesService) GetRelationships

func (s *EntitiesService) GetRelationships(ctx context.Context, entityID string) (*EntityRelationships, error)

GetRelationships returns all connected entities and memories for an entity.

func (*EntitiesService) List

func (s *EntitiesService) List(ctx context.Context, params *ListEntitiesParams) ([]Entity, error)

List returns entities with optional filtering.

func (*EntitiesService) ListWithStats

func (s *EntitiesService) ListWithStats(ctx context.Context, params *ListEntitiesParams) ([]EntityWithStats, error)

ListWithStats returns entities sorted by mention count with stats.

type Entity

type Entity struct {
	ID                 string         `json:"id"`
	NodeType           string         `json:"node_type,omitempty"`
	CreatedAt          *time.Time     `json:"created_at,omitempty"`
	UpdatedAt          *time.Time     `json:"updated_at,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
	Name               string         `json:"name"`
	EntityType         string         `json:"entity_type,omitempty"`
	Description        string         `json:"description,omitempty"`
	Aliases            []string       `json:"aliases,omitempty"`
	Confidence         float64        `json:"confidence,omitempty"`
	EntityCreated      string         `json:"entity_created,omitempty"`
	EntityEnded        string         `json:"entity_ended,omitempty"`
	TemporalPrecision  string         `json:"temporal_precision,omitempty"`
	TemporalConfidence float64        `json:"temporal_confidence,omitempty"`
	TemporalContext    string         `json:"temporal_context,omitempty"`
}

Entity represents an entity node in the knowledge graph.

type EntityRelationships

type EntityRelationships struct {
	Entity          Entity           `json:"entity"`
	RelatedEntities []Entity         `json:"related_entities,omitempty"`
	RelatedMemories []MemoryListItem `json:"related_memories,omitempty"`
}

EntityRelationships holds an entity's connected nodes.

type EntityWithStats

type EntityWithStats struct {
	Entity       Entity `json:"entity"`
	MentionCount int    `json:"mention_count"`
}

EntityWithStats wraps an Entity with mention count.

type ErrorDetail

type ErrorDetail struct {
	Loc   []string       `json:"loc"`
	Msg   string         `json:"msg"`
	Type  string         `json:"type"`
	Input any            `json:"input,omitempty"`
	Ctx   map[string]any `json:"ctx,omitempty"`
}

ErrorDetail is a single validation error.

type EventsService added in v0.3.0

type EventsService struct {
	// contains filtered or unexported fields
}

EventsService handles server-sent event streams.

func (*EventsService) Stream added in v0.3.0

func (s *EventsService) Stream(ctx context.Context) (*http.Response, error)

Stream opens the real-time server-sent events stream.

The caller owns the returned response body and must close it.

type EvolutionEdge added in v0.2.0

type EvolutionEdge struct {
	SourceID string `json:"source_id"`
	TargetID string `json:"target_id"`
	EdgeType string `json:"edge_type"`
}

EvolutionEdge represents an EVOLVES relationship.

type ExportRawRequest added in v0.2.0

type ExportRawRequest struct {
	Path   string `json:"path"`
	Format string `json:"format,omitempty"`
}

ExportRawRequest is the request for POST /threads/conversations/export-raw.

type FSCatResponse

type FSCatResponse struct {
	Path        string         `json:"path"`
	Body        string         `json:"body"`
	Frontmatter map[string]any `json:"frontmatter,omitempty"`
	TotalLines  int            `json:"total_lines,omitempty"`
}

FSCatResponse is the response body for GET /fs/cat.

type FSDeleteRequest

type FSDeleteRequest struct {
	Path string `json:"path"`
}

FSDeleteRequest is the request body for POST /fs/delete.

type FSEntry

type FSEntry struct {
	Path  string `json:"path"`
	Name  string `json:"name"`
	Type  string `json:"type"`
	Size  int64  `json:"size,omitempty"`
	IsDir bool   `json:"is_dir,omitempty"`
}

FSEntry represents a file/directory in the Nowledge FS tree.

type FSGrepMatch

type FSGrepMatch struct {
	Path string `json:"path"`
	Line int    `json:"line"`
	Text string `json:"text"`
}

FSGrepMatch represents a single grep match.

type FSGrepResponse

type FSGrepResponse struct {
	Matches []FSGrepMatch `json:"matches"`
}

FSGrepResponse is the response body for GET /fs/grep.

type FSListResponse

type FSListResponse struct {
	Entries []FSEntry `json:"entries"`
	Cursor  string    `json:"cursor,omitempty"`
	HasMore bool      `json:"has_more,omitempty"`
}

FSListResponse is the response body for GET /fs/ls.

type FSSearchResponse

type FSSearchResponse struct {
	Paths []string `json:"paths"`
}

FSSearchResponse is the response body for GET /fs/find, /fs/recall.

type FSService

type FSService struct {
	// contains filtered or unexported fields
}

FSService handles Nowledge FS operations (path-based tree browsing).

func (*FSService) Cat

func (s *FSService) Cat(ctx context.Context, path string, line, lines int) (*FSCatResponse, error)

Cat reads a rendered file body and frontmatter.

func (*FSService) CatString

func (s *FSService) CatString(ctx context.Context, path string) (string, error)

CatString is a convenience method that returns just the body text.

func (*FSService) Delete

func (s *FSService) Delete(ctx context.Context, path string) error

Delete deletes a file at the given path.

func (*FSService) Find

func (s *FSService) Find(ctx context.Context, path, fileType, label string) (*FSSearchResponse, error)

Find performs structural search (type, label, date, mention constraints).

func (*FSService) Grep

func (s *FSService) Grep(ctx context.Context, path, query string) (*FSGrepResponse, error)

Grep performs literal exact-string search.

func (*FSService) List

func (s *FSService) List(ctx context.Context, path string, limit int, cursor string) (*FSListResponse, error)

List lists a directory in the FS tree.

func (*FSService) LsPaths

func (s *FSService) LsPaths(ctx context.Context, path string) ([]string, error)

LsPaths is a convenience method that returns just the entry paths.

func (*FSService) Recall

func (s *FSService) Recall(ctx context.Context, path, query string, k int) (*FSSearchResponse, error)

Recall performs semantic search that returns paths.

func (*FSService) Stat

func (s *FSService) Stat(ctx context.Context, path string) (*FSStatResponse, error)

Stat reads metadata without loading the body.

func (*FSService) Write

func (s *FSService) Write(ctx context.Context, path, body string) error

Write updates a file at the given path.

type FSStatResponse

type FSStatResponse struct {
	Path      string         `json:"path"`
	Type      string         `json:"type"`
	Size      int64          `json:"size"`
	CreatedAt string         `json:"created_at,omitempty"`
	UpdatedAt string         `json:"updated_at,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

FSStatResponse is the response body for GET /fs/stat.

type FSWriteRequest

type FSWriteRequest struct {
	Path string `json:"path"`
	Body string `json:"body"`
}

FSWriteRequest is the request body for POST /fs/write.

type FavoritesService added in v0.2.0

type FavoritesService struct {
	// contains filtered or unexported fields
}

FavoritesService handles favorites operations.

func (*FavoritesService) GetFavoriteMemories added in v0.2.0

func (s *FavoritesService) GetFavoriteMemories(ctx context.Context) ([]MemoryListItem, error)

GetFavoriteMemories returns all favorite memories.

func (*FavoritesService) GetFavoriteThreads added in v0.2.0

func (s *FavoritesService) GetFavoriteThreads(ctx context.Context) ([]ThreadListItem, error)

GetFavoriteThreads returns all favorite threads.

type FeedEvent added in v0.2.0

type FeedEvent struct {
	ID        string         `json:"id"`
	EventType string         `json:"event_type"`
	Severity  string         `json:"severity"`
	Title     string         `json:"title"`
	Body      string         `json:"body,omitempty"`
	Resolved  bool           `json:"resolved"`
	CreatedAt string         `json:"created_at,omitempty"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

FeedEvent represents a feed event.

type FeedEventsParams added in v0.2.0

type FeedEventsParams struct {
	Limit          int    `json:"limit,omitempty"`
	Offset         int    `json:"offset,omitempty"`
	Severity       string `json:"severity,omitempty"`
	EventType      string `json:"event_type,omitempty"`
	UnresolvedOnly bool   `json:"unresolved_only,omitempty"`
	LastNDays      int    `json:"last_n_days,omitempty"`
	DateFrom       string `json:"date_from,omitempty"`
	DateTo         string `json:"date_to,omitempty"`
	Source         string `json:"source,omitempty"`
}

FeedEventsParams are parameters for GET /agent/feed/events.

type FeedInputStreamRequest added in v0.3.0

type FeedInputStreamRequest struct {
	Content  string `json:"content"`
	Source   string `json:"source,omitempty"`
	Persist  *bool  `json:"persist,omitempty"`
	ThreadID string `json:"thread_id,omitempty"`
	SpaceID  string `json:"space_id,omitempty"`
}

FeedInputStreamRequest is the request for POST /agent/feed/input/stream.

type FeedService added in v0.2.0

type FeedService struct {
	// contains filtered or unexported fields
}

FeedService handles feed event operations.

func (*FeedService) DeleteEvent added in v0.2.0

func (s *FeedService) DeleteEvent(ctx context.Context, eventID string) error

DeleteEvent soft-deletes a feed event.

func (*FeedService) GetEvents added in v0.2.0

func (s *FeedService) GetEvents(ctx context.Context, params *FeedEventsParams) ([]FeedEvent, error)

GetEvents returns feed events with filtering.

func (*FeedService) PersistQuestion added in v0.2.0

func (s *FeedService) PersistQuestion(ctx context.Context, req *PersistQuestionRequest) error

PersistQuestion persists a question and agent response as a feed event.

func (*FeedService) ResolveEvent added in v0.2.0

func (s *FeedService) ResolveEvent(ctx context.Context, eventID string, req *ResolveEventRequest) error

ResolveEvent resolves an action-required event.

func (*FeedService) RetryEvent added in v0.2.0

func (s *FeedService) RetryEvent(ctx context.Context, eventID string) error

RetryEvent retries a failed background task.

func (*FeedService) StreamInput added in v0.3.0

func (s *FeedService) StreamInput(ctx context.Context, req *FeedInputStreamRequest) (*http.Response, error)

StreamInput streams agent processing of feed input.

The caller owns the returned response body and must close it.

type FolderIngestResponse added in v0.3.0

type FolderIngestResponse struct {
	FolderName      string                 `json:"folder_name"`
	TotalIngested   int                    `json:"total_ingested"`
	TotalDuplicates int                    `json:"total_duplicates"`
	TotalErrors     int                    `json:"total_errors"`
	Results         []IngestSourceResponse `json:"results,omitempty"`
	Message         string                 `json:"message,omitempty"`
}

FolderIngestResponse is the response for folder upload and summary endpoints.

type FolderUploadFile added in v0.3.0

type FolderUploadFile struct {
	File         io.Reader `json:"-"`
	Filename     string    `json:"filename,omitempty"`
	RelativePath string    `json:"relative_path,omitempty"`
}

FolderUploadFile is one file in a multipart folder upload.

type GraphAnalysis

type GraphAnalysis struct {
	NodeCount        int                `json:"node_count"`
	EdgeCount        int                `json:"edge_count"`
	CommunityCount   int                `json:"community_count"`
	Communities      []Community        `json:"communities,omitempty"`
	CentralityScores map[string]float64 `json:"centrality_scores,omitempty"`
}

GraphAnalysis is the response body for GET /graph/analysis.

type GraphData added in v0.2.0

type GraphData struct {
	Nodes               []GraphNode      `json:"nodes"`
	Edges               []GraphEdge      `json:"edges"`
	Communities         []map[string]any `json:"communities,omitempty"`
	CommunityHulls      []map[string]any `json:"community_hulls,omitempty"`
	VisualizationConfig map[string]any   `json:"visualization_config,omitempty"`
	Metadata            map[string]any   `json:"metadata,omitempty"`
}

GraphData is the visualization-ready graph response.

type GraphEdge added in v0.2.0

type GraphEdge struct {
	ID             string         `json:"id"`
	Source         string         `json:"source"`
	Target         string         `json:"target"`
	EdgeType       string         `json:"edge_type"`
	Weight         float64        `json:"weight,omitempty"`
	Label          string         `json:"label,omitempty"`
	RelevanceScore float64        `json:"relevance_score,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
}

GraphEdge represents an edge in the graph visualization.

type GraphExpandParams added in v0.2.0

type GraphExpandParams struct {
	Depth   int    `json:"depth,omitempty"`
	Limit   int    `json:"limit,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

GraphExpandParams are parameters for graph expand.

type GraphExploreParams added in v0.2.0

type GraphExploreParams struct {
	MemoryIDs string `json:"memory_ids"`
	Depth     int    `json:"depth,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	SpaceID   string `json:"space_id,omitempty"`
}

GraphExploreParams are parameters for graph explore.

type GraphHealthResponse

type GraphHealthResponse struct {
	Status    string `json:"status"`
	AlgoReady bool   `json:"algo_ready"`
}

GraphHealthResponse is the response body for GET /graph/health.

type GraphIntelligenceMessageRequest added in v0.2.0

type GraphIntelligenceMessageRequest struct {
	SessionID string `json:"session_id"`
	Message   string `json:"message"`
}

GraphIntelligenceMessageRequest is the request for POST /agent/graph-intelligence/message.

type GraphIntelligenceMessageResponse added in v0.2.0

type GraphIntelligenceMessageResponse struct {
	Response  string `json:"response"`
	SessionID string `json:"session_id"`
}

GraphIntelligenceMessageResponse is the response for POST /agent/graph-intelligence/message.

type GraphIntelligenceSession added in v0.2.0

type GraphIntelligenceSession struct {
	SessionID string `json:"session_id"`
	Status    string `json:"status"`
}

GraphIntelligenceSession is a graph intelligence session.

type GraphIntelligenceStatus added in v0.2.0

type GraphIntelligenceStatus struct {
	Running   bool   `json:"running"`
	SessionID string `json:"session_id,omitempty"`
}

GraphIntelligenceStatus is the response for GET /agent/graph-intelligence/status.

type GraphLivePreview added in v0.2.0

type GraphLivePreview struct {
	Node  GraphNode   `json:"node"`
	Edges []GraphEdge `json:"edges"`
}

GraphLivePreview is a live preview for a node.

type GraphLivePreviewGraphParams added in v0.3.0

type GraphLivePreviewGraphParams struct {
	NodeIDs      []string `json:"node_ids"`
	LimitPerSeed int      `json:"limit_per_seed,omitempty"`
	SpaceID      string   `json:"space_id,omitempty"`
}

GraphLivePreviewGraphParams are parameters for GET /graph/live-preview.

type GraphNode added in v0.2.0

type GraphNode struct {
	ID            string         `json:"id"`
	Label         string         `json:"label"`
	NodeType      string         `json:"node_type"`
	NodeSubtype   string         `json:"node_subtype,omitempty"`
	Size          float64        `json:"size,omitempty"`
	Color         string         `json:"color,omitempty"`
	Community     string         `json:"community,omitempty"`
	Importance    float64        `json:"importance,omitempty"`
	HopCount      int            `json:"hop_count,omitempty"`
	PagerankScore float64        `json:"pagerank_score,omitempty"`
	ThreadID      string         `json:"thread_id,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

GraphNode represents a node in the graph visualization.

type GraphOverview added in v0.2.0

type GraphOverview struct {
	NodeCount      int     `json:"node_count"`
	EdgeCount      int     `json:"edge_count"`
	CommunityCount int     `json:"community_count"`
	MemoryCount    int     `json:"memory_count"`
	EntityCount    int     `json:"entity_count"`
	ThreadCount    int     `json:"thread_count"`
	AvgDegree      float64 `json:"avg_degree"`
}

GraphOverview is the response for GET /graph/overview.

type GraphSampleParams added in v0.2.0

type GraphSampleParams struct {
	Limit   int    `json:"limit,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

GraphSampleParams are parameters for graph sample.

type GraphSearchParams added in v0.2.0

type GraphSearchParams struct {
	Query           string   `json:"query"`
	Limit           int      `json:"limit,omitempty"`
	Depth           int      `json:"depth,omitempty"`
	NodeTypes       []string `json:"node_types,omitempty"`
	EdgeTypes       []string `json:"edge_types,omitempty"`
	IncludeMetadata *bool    `json:"include_metadata,omitempty"`
	SpaceID         string   `json:"space_id,omitempty"`
}

GraphSearchParams are parameters for graph search.

type GraphService

type GraphService struct {
	// contains filtered or unexported fields
}

GraphService handles knowledge graph operations.

func (*GraphService) Analysis

func (s *GraphService) Analysis(ctx context.Context) (*GraphAnalysis, error)

Analysis returns comprehensive graph analysis including community and centrality metrics.

func (*GraphService) AugmentationState

func (s *GraphService) AugmentationState(ctx context.Context) (*AugmentationState, error)

AugmentationState returns current augmentation status and parameters.

func (*GraphService) CleanupOrphans

func (s *GraphService) CleanupOrphans(ctx context.Context) (*CleanupOrphansResponse, error)

CleanupOrphans removes orphaned entities from the graph.

func (*GraphService) FindOrphans

func (s *GraphService) FindOrphans(ctx context.Context) ([]Entity, error)

FindOrphans finds entities with no relationships.

func (*GraphService) Health

Health checks graph analysis service and algo extensions.

func (*GraphService) JobStatus

func (s *GraphService) JobStatus(ctx context.Context, jobID string) (*AugmentationJob, error)

JobStatus checks progress of a specific augmentation job.

func (*GraphService) ListJobs

func (s *GraphService) ListJobs(ctx context.Context, limit int) ([]AugmentationJob, error)

ListJobs lists recent augmentation jobs.

func (*GraphService) StartAugmentation

func (s *GraphService) StartAugmentation(ctx context.Context, req *StartAugmentationRequest) (*AugmentationJob, error)

StartAugmentation starts a background job (community detection, PageRank).

type GraphVisService added in v0.2.0

type GraphVisService struct {
	// contains filtered or unexported fields
}

GraphVisService handles graph visualization operations.

func (*GraphVisService) ExpandNode added in v0.2.0

func (s *GraphVisService) ExpandNode(ctx context.Context, nodeID string, params *GraphExpandParams) (*GraphData, error)

ExpandNode expands neighbors of a specific node.

func (*GraphVisService) ExploreGraph added in v0.2.0

func (s *GraphVisService) ExploreGraph(ctx context.Context, params *GraphExploreParams) (*GraphData, error)

ExploreGraph builds a neighborhood around one or more memory IDs with depth traversal.

func (*GraphVisService) Explorer added in v0.3.0

func (s *GraphVisService) Explorer(ctx context.Context) ([]byte, error)

Explorer returns the interactive graph explorer HTML.

func (*GraphVisService) GetCommunityMembers added in v0.2.0

func (s *GraphVisService) GetCommunityMembers(ctx context.Context, communityID string, limit int) (*GraphData, error)

GetCommunityMembers returns members of a specific community.

func (*GraphVisService) GetLivePreview added in v0.2.0

func (s *GraphVisService) GetLivePreview(ctx context.Context, nodeID string) (*GraphLivePreview, error)

GetLivePreview returns a live preview for a node.

func (*GraphVisService) GetLivePreviewGraph added in v0.3.0

func (s *GraphVisService) GetLivePreviewGraph(ctx context.Context, params *GraphLivePreviewGraphParams) (*GraphData, error)

GetLivePreviewGraph gets a compact merged graph for one or more seed nodes.

func (*GraphVisService) GetNodeDetails added in v0.2.0

func (s *GraphVisService) GetNodeDetails(ctx context.Context, nodeID string) (*GraphNode, error)

GetNodeDetails returns detailed information about a specific node.

func (*GraphVisService) GetOverview added in v0.2.0

func (s *GraphVisService) GetOverview(ctx context.Context) (*GraphOverview, error)

GetOverview returns a high-level graph overview.

func (*GraphVisService) SampleGraph added in v0.2.0

func (s *GraphVisService) SampleGraph(ctx context.Context, params *GraphSampleParams) (*GraphData, error)

SampleGraph gets a representative sample of graph data for visualization.

func (*GraphVisService) SearchGraph added in v0.2.0

func (s *GraphVisService) SearchGraph(ctx context.Context, params *GraphSearchParams) (*GraphData, error)

SearchGraph finds relevant content and builds visualization-ready graph data.

func (*GraphVisService) ShortestPath added in v0.2.0

func (s *GraphVisService) ShortestPath(ctx context.Context, sourceID, targetID string) (*GraphData, error)

ShortestPath finds the shortest path between two nodes.

type HealthCheck

type HealthCheck struct {
	Status                    string            `json:"status"`
	Version                   string            `json:"version"`
	Timestamp                 *time.Time        `json:"timestamp,omitempty"`
	DatabaseConnected         bool              `json:"database_connected"`
	ServicesReady             bool              `json:"services_ready"`
	BufferPoolExhausted       bool              `json:"buffer_pool_exhausted"`
	BufferPoolAutoEscalatedMB int               `json:"buffer_pool_auto_escalated_mb"`
	BufferPoolCurrentMB       int               `json:"buffer_pool_current_mb"`
	BufferPoolNextStartMB     int               `json:"buffer_pool_next_start_mb"`
	BufferPoolRestartRequired bool              `json:"buffer_pool_restart_required"`
	BufferPoolRestartReason   string            `json:"buffer_pool_restart_reason"`
	BufferPoolAutoMode        bool              `json:"buffer_pool_auto_mode"`
	BufferPoolSource          string            `json:"buffer_pool_source"`
	BufferPoolAutoFloorMB     int               `json:"buffer_pool_auto_floor_mb"`
	BufferPoolAutoCapMB       int               `json:"buffer_pool_auto_cap_mb"`
	PluginUpdates             []PluginUpdate    `json:"plugin_updates,omitempty"`
	ContentStore              *ContentStoreInfo `json:"content_store,omitempty"`
}

HealthCheck is the response body for GET /health.

type HealthService

type HealthService struct {
	// contains filtered or unexported fields
}

HealthService handles health check operations.

func (*HealthService) Check

func (s *HealthService) Check(ctx context.Context) (*HealthCheck, error)

Check performs a health check.

func (*HealthService) ForceCheckpoint

func (s *HealthService) ForceCheckpoint(ctx context.Context) error

ForceCheckpoint forces a database checkpoint to flush WAL to disk.

type ImportConfig added in v0.2.0

type ImportConfig struct {
	AutoImport   bool     `json:"auto_import"`
	Sources      []string `json:"sources,omitempty"`
	ExcludePaths []string `json:"exclude_paths,omitempty"`
}

ImportConfig is the response for GET /threads/import-config.

type ImportConversationRequest added in v0.2.0

type ImportConversationRequest struct {
	Path    string `json:"path"`
	SpaceID string `json:"space_id,omitempty"`
}

ImportConversationRequest is the request for POST /threads/conversations/import.

type ImportConversationResponse added in v0.2.0

type ImportConversationResponse struct {
	Thread   Thread `json:"thread"`
	Imported bool   `json:"imported"`
}

ImportConversationResponse is the response for POST /threads/conversations/import.

type ImportThreadsRequest added in v0.2.0

type ImportThreadsRequest struct {
	Content string `json:"content"`
	Format  string `json:"format,omitempty"`
	Source  string `json:"source,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

ImportThreadsRequest is the request for POST /threads/import.

type ImportThreadsResponse added in v0.2.0

type ImportThreadsResponse struct {
	Threads  []Thread `json:"threads"`
	Imported int      `json:"imported"`
	Skipped  int      `json:"skipped"`
}

ImportThreadsResponse is the response for POST /threads/import.

type IngestByPathRequest

type IngestByPathRequest struct {
	FilePath string `json:"file_path"`
	SpaceID  string `json:"space_id,omitempty"`
}

IngestByPathRequest is the request body for POST /sources/ingest/file-path.

type IngestFileRequest

type IngestFileRequest struct {
	File        io.Reader `json:"-"`
	Filename    string    `json:"-"`
	UserComment string    `json:"user_comment,omitempty"`
	Labels      string    `json:"labels,omitempty"`
	Metadata    string    `json:"metadata,omitempty"`
	SpaceID     string    `json:"space_id,omitempty"`
}

IngestFileRequest is the multipart request body for POST /sources/ingest/file.

type IngestFolderSummaryRequest added in v0.2.0

type IngestFolderSummaryRequest struct {
	FolderName        string         `json:"folder_name"`
	AccumulatedTotals map[string]any `json:"accumulated_totals"`
	SpaceID           string         `json:"space_id,omitempty"`
}

IngestFolderSummaryRequest is the request for POST /sources/ingest/folder-summary.

type IngestFolderUploadRequest added in v0.2.0

type IngestFolderUploadRequest struct {
	Files             []FolderUploadFile `json:"-"`
	FolderName        string             `json:"folder_name"`
	FileManifest      string             `json:"file_manifest,omitempty"`
	UserComment       string             `json:"user_comment,omitempty"`
	Labels            string             `json:"labels,omitempty"`
	SpaceID           string             `json:"space_id,omitempty"`
	EmitFeedEvent     *bool              `json:"emit_feed_event,omitempty"`
	AccumulatedTotals string             `json:"accumulated_totals,omitempty"`
}

IngestFolderUploadRequest is the multipart request for POST /sources/ingest/folder-upload.

type IngestSourceResponse added in v0.3.0

type IngestSourceResponse struct {
	SourceID       string `json:"source_id"`
	OriginalName   string `json:"original_name"`
	LifecycleState string `json:"lifecycle_state"`
	IsDuplicate    bool   `json:"is_duplicate"`
	Message        string `json:"message,omitempty"`
}

IngestSourceResponse is one source ingestion result.

type IngestURLRequest

type IngestURLRequest struct {
	URL     string `json:"url"`
	SpaceID string `json:"space_id,omitempty"`
}

IngestURLRequest is the request body for POST /sources/ingest/url.

type KGApplyRequest added in v0.2.0

type KGApplyRequest struct {
	Entities      []Entity     `json:"entities,omitempty"`
	Relationships []KGRelation `json:"relationships,omitempty"`
}

KGApplyRequest is the request for POST /memories/{id}/extract-kg/apply.

type KGApplyResponse added in v0.2.0

type KGApplyResponse struct {
	CreatedEntities      int `json:"created_entities"`
	CreatedRelationships int `json:"created_relationships"`
}

KGApplyResponse is the response for POST /memories/{id}/extract-kg/apply.

type KGExtractionRequest

type KGExtractionRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	Scope     string   `json:"scope,omitempty"`
}

KGExtractionRequest is the request body for POST /agent/trigger/kg-extraction.

type KGPreviewResponse added in v0.2.0

type KGPreviewResponse struct {
	Entities      []Entity     `json:"entities"`
	Relationships []KGRelation `json:"relationships"`
}

KGPreviewResponse is the response for POST /memories/{id}/extract-kg/preview.

type KGRelation added in v0.2.0

type KGRelation struct {
	SourceID   string  `json:"source_id"`
	TargetID   string  `json:"target_id"`
	RelType    string  `json:"rel_type"`
	Confidence float64 `json:"confidence,omitempty"`
}

KGRelation represents a relationship between entities.

type KGService added in v0.2.0

type KGService struct {
	// contains filtered or unexported fields
}

KGService handles knowledge graph extraction from memories.

func (*KGService) ApplyExtraction added in v0.2.0

func (s *KGService) ApplyExtraction(ctx context.Context, memoryID string, req *KGApplyRequest) (*KGApplyResponse, error)

ApplyExtraction saves extracted entities and relationships to the graph database.

func (*KGService) PreviewExtraction added in v0.2.0

func (s *KGService) PreviewExtraction(ctx context.Context, memoryID string) (*KGPreviewResponse, error)

PreviewExtraction previews KG extraction for a memory before applying.

type KnowledgeProcessingStatus added in v0.2.0

type KnowledgeProcessingStatus struct {
	Enabled bool   `json:"enabled"`
	Status  string `json:"status"`
	LastRun string `json:"last_run,omitempty"`
	NextRun string `json:"next_run,omitempty"`
}

KnowledgeProcessingStatus is the response for GET /agent/knowledge-processing/status.

type Label

type Label struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
	UsageCount  int    `json:"usage_count,omitempty"`
}

Label represents a label/tag.

type LabelsService

type LabelsService struct {
	// contains filtered or unexported fields
}

LabelsService handles label operations.

func (*LabelsService) Create

func (s *LabelsService) Create(ctx context.Context, req *CreateLabelRequest) (*Label, error)

Create creates a new label.

func (*LabelsService) Delete

func (s *LabelsService) Delete(ctx context.Context, labelID string) error

Delete deletes a label and all its relationships.

func (*LabelsService) Get

func (s *LabelsService) Get(ctx context.Context, labelID string) (*Label, error)

Get returns a specific label by ID.

func (*LabelsService) List

func (s *LabelsService) List(ctx context.Context, params *ListLabelsParams) ([]Label, error)

List returns all labels with usage counts.

func (*LabelsService) Update

func (s *LabelsService) Update(ctx context.Context, labelID string, req *UpdateLabelRequest) (*Label, error)

Update updates an existing label.

type LibraryService added in v0.2.0

type LibraryService struct {
	// contains filtered or unexported fields
}

LibraryService handles library/wiki operations.

func (*LibraryService) ExportWiki added in v0.2.0

func (s *LibraryService) ExportWiki(ctx context.Context, format string) ([]byte, error)

ExportWiki exports wiki pages in the specified format.

func (*LibraryService) ExportWikiSummary added in v0.2.0

func (s *LibraryService) ExportWikiSummary(ctx context.Context) ([]byte, error)

ExportWikiSummary exports wiki summary.

func (*LibraryService) GetCrystalSourceMemories added in v0.2.0

func (s *LibraryService) GetCrystalSourceMemories(ctx context.Context, crystalID string, limit int) ([]MemoryListItem, error)

GetCrystalSourceMemories returns source memories for a crystal.

func (*LibraryService) GetWikiIndex added in v0.2.0

func (s *LibraryService) GetWikiIndex(ctx context.Context) (*WikiIndex, error)

GetWikiIndex returns the wiki index.

func (*LibraryService) GetWikiPageByCrystal added in v0.2.0

func (s *LibraryService) GetWikiPageByCrystal(ctx context.Context, crystalID string) (*WikiPage, error)

GetWikiPageByCrystal returns a wiki page for a crystal.

func (*LibraryService) GetWikiPageByEntity added in v0.2.0

func (s *LibraryService) GetWikiPageByEntity(ctx context.Context, idOrName string) (*WikiPage, error)

GetWikiPageByEntity returns a wiki page for an entity.

func (*LibraryService) GetWikiPageByTopic added in v0.2.0

func (s *LibraryService) GetWikiPageByTopic(ctx context.Context, communityID string) (*WikiPage, error)

GetWikiPageByTopic returns a wiki page for a topic/community.

type ListEntitiesParams

type ListEntitiesParams struct {
	Limit        int    `json:"limit,omitempty"`
	EntityType   string `json:"entity_type,omitempty"`
	IncludeStats bool   `json:"include_stats,omitempty"`
}

ListEntitiesParams are query parameters for GET /entities.

type ListLabelsParams

type ListLabelsParams struct {
	Limit     int    `json:"limit,omitempty"`
	OrderBy   string `json:"order_by,omitempty"`
	OrderDesc bool   `json:"order_desc,omitempty"`
}

ListLabelsParams are query parameters for GET /labels.

type ListMemoriesParams

type ListMemoriesParams struct {
	Limit         int     `json:"limit,omitempty"`
	Offset        int     `json:"offset,omitempty"`
	State         string  `json:"state,omitempty"`
	ImportanceMin float64 `json:"importance_min,omitempty"`
	SpaceID       string  `json:"space_id,omitempty"`
	IsCrystal     *bool   `json:"is_crystal,omitempty"`
}

ListMemoriesParams are query parameters for GET /memories.

type ListMemoriesResponse

type ListMemoriesResponse struct {
	Memories   []MemoryListItem `json:"memories"`
	Pagination Pagination       `json:"pagination"`
}

ListMemoriesResponse is the response body for GET /memories.

type ListSourcesParams

type ListSourcesParams struct {
	Limit          int    `json:"limit,omitempty"`
	Offset         int    `json:"offset,omitempty"`
	SourceType     string `json:"source_type,omitempty"`
	LifecycleState string `json:"lifecycle_state,omitempty"`
	SpaceID        string `json:"space_id,omitempty"`
}

ListSourcesParams are query parameters for GET /sources.

type ListSourcesResponse

type ListSourcesResponse struct {
	Sources []Source `json:"sources"`
	Total   int      `json:"total"`
}

ListSourcesResponse is the response body for GET /sources.

type ListSpacesResponse

type ListSpacesResponse struct {
	Enabled bool    `json:"enabled"`
	Spaces  []Space `json:"spaces"`
}

ListSpacesResponse is the response body for GET /spaces.

type ListThreadsParams

type ListThreadsParams struct {
	Limit   int    `json:"limit,omitempty"`
	Offset  int    `json:"offset,omitempty"`
	Source  string `json:"source,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

ListThreadsParams are query parameters for GET /threads.

type ListThreadsResponse

type ListThreadsResponse struct {
	Threads    []ThreadListItem `json:"threads"`
	Pagination Pagination       `json:"pagination"`
}

ListThreadsResponse is the response body for GET /threads.

type LoadedModel added in v0.2.0

type LoadedModel struct {
	ModelType string `json:"model_type"`
	Device    string `json:"device"`
	MemoryMB  int    `json:"memory_mb"`
}

LoadedModel represents a model loaded in memory.

type MemoriesService

type MemoriesService struct {
	// contains filtered or unexported fields
}

MemoriesService handles memory CRUD operations.

func (*MemoriesService) AssignLabel

func (s *MemoriesService) AssignLabel(ctx context.Context, memoryID, labelID string) error

AssignLabel assigns a label to a memory.

func (*MemoriesService) BulkDelete

BulkDelete deletes selected memories.

func (*MemoriesService) BulkMove

BulkMove moves selected memories into another space.

func (*MemoriesService) BulkMovePreview

BulkMovePreview previews a bulk move between spaces.

func (*MemoriesService) Create

Create creates a new memory with automatic entity extraction.

func (*MemoriesService) Delete

func (s *MemoriesService) Delete(ctx context.Context, memoryID string, params *DeleteMemoryParams) (*DeleteMemoryResponse, error)

Delete deletes a memory and optionally its relationships.

func (*MemoriesService) Export

func (s *MemoriesService) Export(ctx context.Context, memoryID, format string) ([]byte, error)

Export exports a memory in the specified format (markdown, json, etc).

func (*MemoriesService) Get

func (s *MemoriesService) Get(ctx context.Context, memoryID string, spaceID string) (*MemoryListItem, error)

Get retrieves a specific memory by ID.

func (*MemoriesService) GetLabels

func (s *MemoriesService) GetLabels(ctx context.Context, memoryID string) ([]Label, error)

GetLabels returns labels assigned to a memory.

func (*MemoriesService) GetReindexStatus added in v0.2.0

func (s *MemoriesService) GetReindexStatus(ctx context.Context) (*MemoryReindexStatus, error)

GetReindexStatus returns status of memories needing reindex.

func (*MemoriesService) List

List returns memories with filtering and pagination.

func (*MemoriesService) Reindex added in v0.2.0

Reindex reindexes multiple memories or all needing reindex.

func (*MemoriesService) RemoveLabel

func (s *MemoriesService) RemoveLabel(ctx context.Context, memoryID, labelID string) error

RemoveLabel removes a label from a memory.

func (*MemoriesService) Search

Search performs a hybrid search across memories.

func (*MemoriesService) ToggleFavorite

func (s *MemoriesService) ToggleFavorite(ctx context.Context, memoryID string) (*ToggleFavoriteResponse, error)

ToggleFavorite toggles favorite status for a memory.

func (*MemoriesService) Update

func (s *MemoriesService) Update(ctx context.Context, memoryID string, updates map[string]any) (*MemoryListItem, error)

Update updates memory properties like importance, title, and content.

type Memory

type Memory struct {
	ID                 string         `json:"id"`
	NodeType           string         `json:"node_type,omitempty"`
	CreatedAt          *time.Time     `json:"created_at,omitempty"`
	UpdatedAt          *time.Time     `json:"updated_at,omitempty"`
	Metadata           map[string]any `json:"metadata,omitempty"`
	Content            string         `json:"content"`
	Title              string         `json:"title,omitempty"`
	Importance         float64        `json:"importance,omitempty"`
	Confidence         float64        `json:"confidence,omitempty"`
	PagerankScore      float64        `json:"pagerank_score,omitempty"`
	Embedding          []float64      `json:"embedding,omitempty"`
	SourceRange        map[string]int `json:"source_range,omitempty"`
	Source             string         `json:"source,omitempty"`
	SpaceID            string         `json:"space_id,omitempty"`
	SemanticField      string         `json:"semantic_field,omitempty"`
	ReindexNeeded      bool           `json:"reindex_needed,omitempty"`
	LastReindexedAt    *time.Time     `json:"last_reindexed_at,omitempty"`
	LastAccessedAt     *time.Time     `json:"last_accessed_at,omitempty"`
	AccessCount        int            `json:"access_count,omitempty"`
	Appearances        int            `json:"appearances,omitempty"`
	Clicks             int            `json:"clicks,omitempty"`
	TotalDwellTimeMs   int            `json:"total_dwell_time_ms,omitempty"`
	LastClickedAt      *time.Time     `json:"last_clicked_at,omitempty"`
	DecayScoreCached   float64        `json:"decay_score_cached,omitempty"`
	TemporalContext    string         `json:"temporal_context,omitempty"`
	TemporalType       string         `json:"temporal_type,omitempty"`
	EventStart         string         `json:"event_start,omitempty"`
	EventEnd           string         `json:"event_end,omitempty"`
	TemporalPrecision  string         `json:"temporal_precision,omitempty"`
	TemporalConfidence float64        `json:"temporal_confidence,omitempty"`
	UnitType           string         `json:"unit_type,omitempty"`
	IsLatest           bool           `json:"is_latest,omitempty"`
	Version            int            `json:"version,omitempty"`
	IsCrystal          bool           `json:"is_crystal,omitempty"`
	CrystalTitle       string         `json:"crystal_title,omitempty"`
	SourceUnitCount    int            `json:"source_unit_count,omitempty"`
	ExtractionMethod   string         `json:"extraction_method,omitempty"`
	LastEvaluatedAt    *time.Time     `json:"last_evaluated_at,omitempty"`
	ReviewStatus       string         `json:"review_status,omitempty"`
}

Memory represents a memory node in the knowledge base.

type MemoryListItem

type MemoryListItem struct {
	ID           string         `json:"id"`
	Title        string         `json:"title,omitempty"`
	Content      string         `json:"content,omitempty"`
	Source       string         `json:"source,omitempty"`
	Time         string         `json:"time,omitempty"`
	Rating       float64        `json:"rating,omitempty"`
	LabelIDs     []string       `json:"label_ids,omitempty"`
	IsFavorite   bool           `json:"is_favorite,omitempty"`
	SourceThread *SourceThread  `json:"source_thread,omitempty"`
	Confidence   float64        `json:"confidence,omitempty"`
	SpaceID      string         `json:"space_id,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
}

MemoryListItem is the summary view returned by list endpoints.

type MemoryReindexStatus added in v0.2.0

type MemoryReindexStatus struct {
	Total        int `json:"total"`
	NeedsReindex int `json:"needs_reindex"`
}

MemoryReindexStatus is the response for GET /memories/reindex/status.

type MessageCreateRequest

type MessageCreateRequest struct {
	Content string `json:"content"`
	Role    string `json:"role"`
}

MessageCreateRequest is a message in a create-thread request.

type ModelMemoryStatus added in v0.2.0

type ModelMemoryStatus struct {
	Loaded []LoadedModel `json:"loaded"`
}

ModelMemoryStatus is the response for GET /models/memory-status.

type ModelsService added in v0.2.0

type ModelsService struct {
	// contains filtered or unexported fields
}

ModelsService handles embedding model operations.

func (*ModelsService) GetEmbeddingModelStatus added in v0.2.0

func (s *ModelsService) GetEmbeddingModelStatus(ctx context.Context) (*EmbeddingModelStatus, error)

GetEmbeddingModelStatus checks the search embedding model status.

func (*ModelsService) GetMemoryStatus added in v0.2.0

func (s *ModelsService) GetMemoryStatus(ctx context.Context) (*ModelMemoryStatus, error)

GetMemoryStatus returns which models are currently loaded in memory.

func (*ModelsService) InstallEmbeddingModel added in v0.2.0

func (s *ModelsService) InstallEmbeddingModel(ctx context.Context) error

InstallEmbeddingModel downloads and installs the search embedding model.

func (*ModelsService) UnloadModel added in v0.2.0

func (s *ModelsService) UnloadModel(ctx context.Context, modelType string) error

UnloadModel manually unloads a model from memory.

type Option

type Option func(*Client)

Option configures the client.

func WithAPIKey added in v0.3.1

func WithAPIKey(apiKey string) Option

WithAPIKey sets the Nowledge Mem remote API key for every request.

Remote deployments commonly require both Authorization: Bearer nmem_xxxx and nmem_api_key=nmem_xxxx query authentication. This option sends both.

func WithBaseURL

func WithBaseURL(rawURL string) Option

WithBaseURL overrides the default base URL.

func WithBearerToken added in v0.3.1

func WithBearerToken(token string) Option

WithBearerToken sets an Authorization: Bearer token header for every request.

Pass the raw token value, for example "nmem_xxxx". If the value already starts with "Bearer ", the prefix is stripped and normalized.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient overrides the default HTTP client.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout overrides the default HTTP timeout.

type Pagination

type Pagination struct {
	Limit   int  `json:"limit"`
	Offset  int  `json:"offset"`
	Total   int  `json:"total"`
	HasMore bool `json:"has_more"`
}

Pagination holds pagination metadata.

type ParseContentRequest added in v0.2.0

type ParseContentRequest struct {
	Content string `json:"content"`
	Format  string `json:"format,omitempty"`
}

ParseContentRequest is the request for POST /threads/parse.

type ParseContentResponse added in v0.2.0

type ParseContentResponse struct {
	Messages []ThreadMessage `json:"messages"`
}

ParseContentResponse is the response for POST /threads/parse.

type PersistQuestionRequest added in v0.2.0

type PersistQuestionRequest struct {
	Question string `json:"question"`
	Response string `json:"response"`
	Source   string `json:"source,omitempty"`
}

PersistQuestionRequest is the request for POST /agent/feed/input/persist-question.

type PluginUpdate

type PluginUpdate struct {
	ID               string `json:"id"`
	Name             string `json:"name"`
	InstalledVersion string `json:"installed_version"`
	AvailableVersion string `json:"available_version"`
}

PluginUpdate represents an available plugin update.

type PreviewConversationRequest added in v0.2.0

type PreviewConversationRequest struct {
	Path string `json:"path"`
}

PreviewConversationRequest is the request for POST /threads/conversations/preview.

type PreviewConversationResponse added in v0.2.0

type PreviewConversationResponse struct {
	Preview  string `json:"preview"`
	Title    string `json:"title,omitempty"`
	Messages int    `json:"messages"`
}

PreviewConversationResponse is the response for POST /threads/conversations/preview.

type ProposedMemory added in v0.2.0

type ProposedMemory struct {
	Content    string   `json:"content"`
	Title      string   `json:"title,omitempty"`
	Importance float64  `json:"importance,omitempty"`
	Confidence float64  `json:"confidence,omitempty"`
	Labels     []string `json:"labels,omitempty"`
	UnitType   string   `json:"unit_type,omitempty"`
}

ProposedMemory is a memory proposed by distillation preview.

type ReindexRequest added in v0.2.0

type ReindexRequest struct {
	MemoryIDs []string `json:"memory_ids,omitempty"`
	All       bool     `json:"all,omitempty"`
}

ReindexRequest is the request for POST /memories/reindex.

type ReindexResponse added in v0.2.0

type ReindexResponse struct {
	Queued  int `json:"queued"`
	Skipped int `json:"skipped"`
}

ReindexResponse is the response for POST /memories/reindex.

type ReindexStatus added in v0.2.0

type ReindexStatus struct {
	Total      int `json:"total"`
	NeedsIndex int `json:"needs_index"`
}

ReindexStatus is the response for GET /search-index/reindex/status.

type ResolveEventRequest added in v0.2.0

type ResolveEventRequest struct {
	Resolution     string         `json:"resolution,omitempty"`
	GraphMutations map[string]any `json:"graph_mutations,omitempty"`
}

ResolveEventRequest is the request for POST /agent/feed/events/{id}/resolve.

type SaveSessionRequest added in v0.2.0

type SaveSessionRequest struct {
	SessionID string                 `json:"session_id"`
	Title     string                 `json:"title,omitempty"`
	Source    string                 `json:"source,omitempty"`
	Project   string                 `json:"project,omitempty"`
	Messages  []MessageCreateRequest `json:"messages"`
	SpaceID   string                 `json:"space_id,omitempty"`
}

SaveSessionRequest is the request for POST /threads/sessions/save.

type SaveSessionResponse added in v0.2.0

type SaveSessionResponse struct {
	Thread  Thread `json:"thread"`
	Created bool   `json:"created"`
}

SaveSessionResponse is the response for POST /threads/sessions/save.

type SearchIndexService added in v0.2.0

type SearchIndexService struct {
	// contains filtered or unexported fields
}

SearchIndexService handles search index operations.

func (*SearchIndexService) GetReindexStatus added in v0.2.0

func (s *SearchIndexService) GetReindexStatus(ctx context.Context) (*ReindexStatus, error)

GetReindexStatus returns status of memories needing reindex.

func (*SearchIndexService) GetStatus added in v0.2.0

GetStatus returns status of LanceDB and hybrid search.

func (*SearchIndexService) Reindex added in v0.2.0

func (s *SearchIndexService) Reindex(ctx context.Context) error

Reindex rebuilds the search index from the database.

type SearchIndexStatus added in v0.2.0

type SearchIndexStatus struct {
	Ready       bool   `json:"ready"`
	IndexType   string `json:"index_type"`
	VectorCount int    `json:"vector_count"`
	IndexPath   string `json:"index_path,omitempty"`
}

SearchIndexStatus is the response for GET /search-index/status.

type SearchMemoriesRequest

type SearchMemoriesRequest struct {
	Query      string   `json:"query"`
	SpaceID    string   `json:"space_id,omitempty"`
	Limit      int      `json:"limit,omitempty"`
	Offset     int      `json:"offset,omitempty"`
	Labels     []string `json:"labels,omitempty"`
	SourceType string   `json:"source_type,omitempty"`
}

SearchMemoriesRequest is the request body for POST /memories/search.

type SearchMemoriesResponse

type SearchMemoriesResponse struct {
	Results []SearchResult `json:"results"`
	Total   int            `json:"total"`
	Query   string         `json:"query"`
}

SearchMemoriesResponse is the response body for POST /memories/search.

type SearchResult

type SearchResult struct {
	ID      string  `json:"id"`
	Title   string  `json:"title,omitempty"`
	Content string  `json:"content,omitempty"`
	Score   float64 `json:"score"`
	SpaceID string  `json:"space_id,omitempty"`
	Source  string  `json:"source,omitempty"`
}

SearchResult is a single search result.

type SettingsService added in v0.2.0

type SettingsService struct {
	// contains filtered or unexported fields
}

SettingsService handles settings operations.

func (*SettingsService) GetProfile added in v0.2.0

func (s *SettingsService) GetProfile(ctx context.Context) (*UserProfile, error)

GetProfile returns user profile, aliases, context, and preferred language.

type Source

type Source struct {
	ID             string         `json:"id"`
	SourceType     string         `json:"source_type,omitempty"`
	OriginalName   string         `json:"original_name,omitempty"`
	MimeType       string         `json:"mime_type,omitempty"`
	FilePath       string         `json:"file_path,omitempty"`
	ParsedPath     string         `json:"parsed_path,omitempty"`
	SourceURL      string         `json:"source_url,omitempty"`
	SHA256         string         `json:"sha256,omitempty"`
	SizeBytes      int64          `json:"size_bytes,omitempty"`
	Version        int            `json:"version,omitempty"`
	SpaceID        string         `json:"space_id,omitempty"`
	LifecycleState string         `json:"lifecycle_state,omitempty"`
	ChunkCount     int            `json:"chunk_count,omitempty"`
	MemoryCount    int            `json:"memory_count,omitempty"`
	SectionTree    string         `json:"section_tree,omitempty"`
	Summary        string         `json:"summary,omitempty"`
	ErrorMessage   string         `json:"error_message,omitempty"`
	CreatedAt      string         `json:"created_at,omitempty"`
	UpdatedAt      string         `json:"updated_at,omitempty"`
	Metadata       map[string]any `json:"metadata,omitempty"`
	LabelIDs       []string       `json:"label_ids,omitempty"`
}

Source represents a library source (file, URL, etc.).

type SourceThread

type SourceThread struct {
	ID      string `json:"id"`
	Title   string `json:"title,omitempty"`
	SpaceID string `json:"space_id,omitempty"`
}

SourceThread is a lightweight thread reference attached to a memory.

type SourcesService

type SourcesService struct {
	// contains filtered or unexported fields
}

SourcesService handles source/library operations.

func (*SourcesService) AssignLabel added in v0.2.0

func (s *SourcesService) AssignLabel(ctx context.Context, sourceID, labelID string) error

AssignLabel assigns a label to a source.

func (*SourcesService) BatchIngest

BatchIngest ingests a batch of files.

func (*SourcesService) Delete

func (s *SourcesService) Delete(ctx context.Context, sourceID string) error

Delete deletes a source and its search index records.

func (*SourcesService) Extract added in v0.2.0

func (s *SourcesService) Extract(ctx context.Context, sourceID string) error

Extract triggers knowledge extraction from a source.

func (*SourcesService) Get

func (s *SourcesService) Get(ctx context.Context, sourceID string) (*Source, error)

Get returns source detail with related memories and revision chain.

func (*SourcesService) GetContent

func (s *SourcesService) GetContent(ctx context.Context, sourceID string) (string, error)

GetContent reads the parsed markdown content of a source.

func (*SourcesService) GetImage added in v0.2.0

func (s *SourcesService) GetImage(ctx context.Context, sourceID, filename string) ([]byte, error)

GetImage serves an extracted image from a source.

func (*SourcesService) GetLabels added in v0.2.0

func (s *SourcesService) GetLabels(ctx context.Context, sourceID string) ([]Label, error)

GetLabels returns labels assigned to a source.

func (*SourcesService) GetRawFile added in v0.2.0

func (s *SourcesService) GetRawFile(ctx context.Context, sourceID string) ([]byte, error)

GetRawFile serves the raw source file for native preview.

func (*SourcesService) IngestByPath

func (s *SourcesService) IngestByPath(ctx context.Context, req *IngestByPathRequest) (*Source, error)

IngestByPath ingests a file by local filesystem path.

func (*SourcesService) IngestFile

IngestFile ingests a file through the full source pipeline.

func (*SourcesService) IngestFolderSummary added in v0.2.0

IngestFolderSummary returns a summary of a folder before ingestion.

func (*SourcesService) IngestFolderUpload added in v0.2.0

IngestFolderUpload uploads a folder preserving relative paths.

func (*SourcesService) IngestURL

func (s *SourcesService) IngestURL(ctx context.Context, req *IngestURLRequest) (*Source, error)

IngestURL fetches a URL and ingests through the source pipeline.

func (*SourcesService) List

List returns sources with optional filtering and pagination.

func (*SourcesService) Refetch added in v0.2.0

func (s *SourcesService) Refetch(ctx context.Context, sourceID string) (*Source, error)

Refetch re-fetches a URL source's content and re-parse.

func (*SourcesService) RemoveLabel added in v0.2.0

func (s *SourcesService) RemoveLabel(ctx context.Context, sourceID, labelID string) error

RemoveLabel removes a label from a source.

func (*SourcesService) Search

func (s *SourcesService) Search(ctx context.Context, query string, limit int) ([]Source, error)

Search performs full-text search across source names and content.

func (*SourcesService) Update

func (s *SourcesService) Update(ctx context.Context, sourceID string, req *UpdateSourceRequest) (*Source, error)

Update updates source lifecycle state.

func (*SourcesService) UpdateContent added in v0.2.0

func (s *SourcesService) UpdateContent(ctx context.Context, sourceID, content string) error

UpdateContent updates the parsed markdown content of a source.

type Space

type Space struct {
	ID                   string      `json:"id"`
	Key                  string      `json:"key,omitempty"`
	Name                 string      `json:"name,omitempty"`
	Aliases              []string    `json:"aliases,omitempty"`
	Description          string      `json:"description,omitempty"`
	Icon                 string      `json:"icon,omitempty"`
	Instructions         string      `json:"instructions,omitempty"`
	SharedSpaceIDs       []string    `json:"sharedSpaceIds,omitempty"`
	DefaultRetrievalMode string      `json:"defaultRetrievalMode,omitempty"`
	Usage                *SpaceUsage `json:"usage,omitempty"`
	Observed             bool        `json:"observed,omitempty"`
	HasProfile           bool        `json:"hasProfile,omitempty"`
}

Space represents a space profile.

type SpaceUsage

type SpaceUsage struct {
	Memories         int  `json:"memories"`
	Threads          int  `json:"threads"`
	Sources          int  `json:"sources"`
	HasWorkingMemory bool `json:"hasWorkingMemory"`
}

SpaceUsage holds usage statistics for a space.

type SpacesConfigRequest added in v0.2.0

type SpacesConfigRequest struct {
	Enabled bool `json:"enabled"`
}

SpacesConfigRequest is the request for POST /spaces/config.

type SpacesService

type SpacesService struct {
	// contains filtered or unexported fields
}

SpacesService handles space operations.

func (*SpacesService) Create

func (s *SpacesService) Create(ctx context.Context, req *CreateSpaceRequest) (*Space, error)

Create creates a space profile.

func (*SpacesService) Delete

func (s *SpacesService) Delete(ctx context.Context, spaceID string) error

Delete removes an empty space profile.

func (*SpacesService) Get

func (s *SpacesService) Get(ctx context.Context, spaceID string) (*Space, error)

Get reads one space profile by name, alias, or hidden key.

func (*SpacesService) List

List returns the shared space roster.

func (*SpacesService) Roster added in v0.3.0

Roster returns the shared space roster.

func (*SpacesService) Update

func (s *SpacesService) Update(ctx context.Context, spaceID string, req *UpdateSpaceRequest) (*Space, error)

Update updates a space profile.

func (*SpacesService) UpdateConfig added in v0.2.0

func (s *SpacesService) UpdateConfig(ctx context.Context, req *SpacesConfigRequest) error

UpdateConfig enables or disables spaces at the product level.

type StartAugmentationRequest

type StartAugmentationRequest struct {
	JobType string         `json:"job_type"`
	Params  map[string]any `json:"params,omitempty"`
}

StartAugmentationRequest is the request body for POST /graph/augmentation/start.

type StorageInfo added in v0.2.0

type StorageInfo struct {
	GraphDBBytes     int64 `json:"graph_db_bytes"`
	SearchIndexBytes int64 `json:"search_index_bytes"`
	TotalBytes       int64 `json:"total_bytes"`
}

StorageInfo is the response for GET /storage/info.

type StorageService added in v0.2.0

type StorageService struct {
	// contains filtered or unexported fields
}

StorageService handles storage operations.

func (*StorageService) Info added in v0.2.0

func (s *StorageService) Info(ctx context.Context) (*StorageInfo, error)

Info returns on-disk sizes for the database and search index.

func (*StorageService) Optimize added in v0.2.0

func (s *StorageService) Optimize(ctx context.Context) error

Optimize compacts search index and flushes database changes.

type Thread

type Thread struct {
	ID           string         `json:"id"`
	NodeType     string         `json:"node_type,omitempty"`
	CreatedAt    *time.Time     `json:"created_at,omitempty"`
	UpdatedAt    *time.Time     `json:"updated_at,omitempty"`
	Metadata     map[string]any `json:"metadata,omitempty"`
	ThreadID     string         `json:"thread_id"`
	Title        string         `json:"title,omitempty"`
	Summary      string         `json:"summary,omitempty"`
	MessageCount int            `json:"message_count,omitempty"`
	Participants []string       `json:"participants,omitempty"`
	Source       string         `json:"source,omitempty"`
	SpaceID      string         `json:"space_id,omitempty"`
	Project      string         `json:"project,omitempty"`
	Workspace    string         `json:"workspace,omitempty"`
	ToolVersion  string         `json:"tool_version,omitempty"`
	ImportDate   *time.Time     `json:"import_date,omitempty"`
}

Thread represents a conversation thread.

type ThreadBulkDeleteSelectionRequest added in v0.2.0

type ThreadBulkDeleteSelectionRequest struct {
	ThreadIDs []string `json:"thread_ids,omitempty"`
	SpaceID   string   `json:"space_id,omitempty"`
}

ThreadBulkDeleteSelectionRequest is the request for POST /threads/bulk/delete.

type ThreadBulkMovePreviewRequest added in v0.2.0

type ThreadBulkMovePreviewRequest struct {
	ThreadIDs []string `json:"thread_ids,omitempty"`
	FromSpace string   `json:"from_space,omitempty"`
	ToSpace   string   `json:"to_space"`
}

ThreadBulkMovePreviewRequest is the request for POST /threads/bulk/move/preview.

type ThreadBulkMovePreviewResponse added in v0.2.0

type ThreadBulkMovePreviewResponse struct {
	WillMove  int      `json:"will_move"`
	Conflicts []string `json:"conflicts,omitempty"`
}

ThreadBulkMovePreviewResponse is the response for POST /threads/bulk/move/preview.

type ThreadBulkMoveRequest added in v0.2.0

type ThreadBulkMoveRequest struct {
	ThreadIDs []string `json:"thread_ids,omitempty"`
	FromSpace string   `json:"from_space,omitempty"`
	ToSpace   string   `json:"to_space"`
}

ThreadBulkMoveRequest is the request for POST /threads/bulk/move.

type ThreadBulkMoveResponse added in v0.2.0

type ThreadBulkMoveResponse struct {
	Moved  int `json:"moved"`
	Failed int `json:"failed"`
}

ThreadBulkMoveResponse is the response for POST /threads/bulk/move.

type ThreadCoverage added in v0.2.0

type ThreadCoverage struct {
	ThreadID      string  `json:"thread_id"`
	MessageCount  int     `json:"message_count"`
	MemoryCount   int     `json:"memory_count"`
	CoverageRatio float64 `json:"coverage_ratio"`
	UncoveredMsgs int     `json:"uncovered_msgs"`
}

ThreadCoverage is the response for GET /threads/{id}/coverage.

type ThreadListItem

type ThreadListItem struct {
	ID         string `json:"id"`
	Title      string `json:"title,omitempty"`
	Summary    string `json:"summary,omitempty"`
	Source     string `json:"source,omitempty"`
	Messages   int    `json:"messages,omitempty"`
	Date       string `json:"date,omitempty"`
	IsFavorite bool   `json:"is_favorite,omitempty"`
	SpaceID    string `json:"space_id,omitempty"`
}

ThreadListItem is the summary view returned by list endpoints.

type ThreadMessage

type ThreadMessage struct {
	ID         string         `json:"id"`
	NodeType   string         `json:"node_type,omitempty"`
	CreatedAt  *time.Time     `json:"created_at,omitempty"`
	UpdatedAt  *time.Time     `json:"updated_at,omitempty"`
	Metadata   map[string]any `json:"metadata,omitempty"`
	Content    string         `json:"content"`
	Role       string         `json:"role"`
	OrderIndex int            `json:"order_index,omitempty"`
	Timestamp  *time.Time     `json:"timestamp,omitempty"`
	TokenCount int            `json:"token_count,omitempty"`
}

ThreadMessage represents a single message in a thread.

type ThreadSource added in v0.2.0

type ThreadSource struct {
	Source string `json:"source"`
	Count  int    `json:"count"`
}

ThreadSource represents a thread source.

type ThreadSummary

type ThreadSummary struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	Summary string `json:"summary"`
}

ThreadSummary is a lightweight thread summary.

type ThreadsService

type ThreadsService struct {
	// contains filtered or unexported fields
}

ThreadsService handles thread operations.

func (*ThreadsService) AppendMessages

func (s *ThreadsService) AppendMessages(ctx context.Context, threadID string, messages []MessageCreateRequest) (*AppendMessagesResponse, error)

AppendMessages appends messages to an existing thread.

func (*ThreadsService) BulkDelete

func (s *ThreadsService) BulkDelete(ctx context.Context, threadIDs []string) (*BulkDeleteResponse, error)

BulkDelete deletes multiple threads at once using POST (preferred over DELETE with body).

func (*ThreadsService) BulkDeleteSelection added in v0.2.0

BulkDeleteSelection deletes selected threads using a selector.

func (*ThreadsService) BulkMove added in v0.2.0

BulkMove moves selected threads into another space.

func (*ThreadsService) BulkMovePreview added in v0.2.0

BulkMovePreview previews a bulk move between spaces.

func (*ThreadsService) Create

Create creates a new thread with messages.

func (*ThreadsService) Delete

func (s *ThreadsService) Delete(ctx context.Context, threadID string) error

Delete deletes a thread and optionally its extracted memories.

func (*ThreadsService) DiscoverSessions added in v0.2.0

func (s *ThreadsService) DiscoverSessions(ctx context.Context) ([]DiscoveredSession, error)

DiscoverSessions scans for conversation files from AI assistants.

func (*ThreadsService) Export added in v0.2.0

func (s *ThreadsService) Export(ctx context.Context, threadID, format string) ([]byte, error)

Export exports a thread in various formats.

func (*ThreadsService) ExportRaw added in v0.2.0

func (s *ThreadsService) ExportRaw(ctx context.Context, req *ExportRawRequest) ([]byte, error)

ExportRaw exports a raw conversation file as markdown or JSON without importing.

func (*ThreadsService) Get

func (s *ThreadsService) Get(ctx context.Context, threadID string) (*Thread, error)

Get retrieves a thread with messages and pagination.

func (*ThreadsService) GetCoverage added in v0.2.0

func (s *ThreadsService) GetCoverage(ctx context.Context, threadID string) (*ThreadCoverage, error)

GetCoverage returns a coverage report for debugging.

func (*ThreadsService) GetImportConfig added in v0.2.0

func (s *ThreadsService) GetImportConfig(ctx context.Context) (*ImportConfig, error)

GetImportConfig returns the current import configuration.

func (*ThreadsService) GetSources added in v0.2.0

func (s *ThreadsService) GetSources(ctx context.Context) ([]ThreadSource, error)

GetSources returns thread sources.

func (*ThreadsService) GetWatcherStatus added in v0.2.0

func (s *ThreadsService) GetWatcherStatus(ctx context.Context) (*WatcherStatus, error)

GetWatcherStatus returns the status of the session watcher.

func (*ThreadsService) HideProject added in v0.2.0

func (s *ThreadsService) HideProject(ctx context.Context, project string) error

HideProject hides a project from the browse view.

func (*ThreadsService) HideSession added in v0.2.0

func (s *ThreadsService) HideSession(ctx context.Context, sessionID string) error

HideSession hides a session from the browse view.

func (*ThreadsService) Import added in v0.2.0

Import imports threads from JSON messages or conversation markdown.

func (*ThreadsService) ImportConversation added in v0.2.0

ImportConversation imports an external conversation file.

func (*ThreadsService) List

List returns threads with filtering and pagination.

func (*ThreadsService) Parse added in v0.2.0

Parse parses thread content from various formats.

func (*ThreadsService) PreviewConversation added in v0.2.0

PreviewConversation loads a richer head-and-tail preview for one discovered conversation before import.

func (*ThreadsService) ReconcileTail added in v0.2.0

func (s *ThreadsService) ReconcileTail(ctx context.Context, threadID string) error

ReconcileTail reconciles the tail of a thread.

func (*ThreadsService) SaveSession added in v0.2.0

SaveSession saves coding sessions as conversation threads.

func (*ThreadsService) Search

func (s *ThreadsService) Search(ctx context.Context, query string, limit int) ([]ThreadListItem, error)

Search performs full thread search with message matching.

func (*ThreadsService) StartWatcher added in v0.2.0

func (s *ThreadsService) StartWatcher(ctx context.Context) error

StartWatcher starts auto-importing sessions.

func (*ThreadsService) StopWatcher added in v0.2.0

func (s *ThreadsService) StopWatcher(ctx context.Context) error

StopWatcher stops the session watcher.

func (*ThreadsService) Summaries

func (s *ThreadsService) Summaries(ctx context.Context) ([]ThreadSummary, error)

Summaries returns all thread titles and summaries.

func (*ThreadsService) ToggleFavorite

func (s *ThreadsService) ToggleFavorite(ctx context.Context, threadID string) (*ToggleFavoriteResponse, error)

ToggleFavorite toggles favorite status for a thread.

func (*ThreadsService) UnhideProject added in v0.2.0

func (s *ThreadsService) UnhideProject(ctx context.Context, project string) error

UnhideProject unhides a project.

func (*ThreadsService) UnhideSession added in v0.2.0

func (s *ThreadsService) UnhideSession(ctx context.Context, sessionID string) error

UnhideSession unhides a session.

func (*ThreadsService) UpdateImportConfig added in v0.2.0

func (s *ThreadsService) UpdateImportConfig(ctx context.Context, req *UpdateImportConfigRequest) error

UpdateImportConfig updates import configuration.

type ToggleFavoriteResponse

type ToggleFavoriteResponse struct {
	IsFavorite bool `json:"is_favorite"`
}

ToggleFavoriteResponse is the response for POST /memories/{id}/favorite.

type TriageRequest added in v0.2.0

type TriageRequest struct {
	ThreadID      string  `json:"thread_id"`
	ThreadContent *string `json:"thread_content,omitempty"`
	SpaceID       *string `json:"space_id,omitempty"`
}

TriageRequest is the request for POST /memories/distill/triage.

type TriageResponse added in v0.2.0

type TriageResponse struct {
	Worthy     bool    `json:"worthy"`
	Reason     string  `json:"reason,omitempty"`
	Confidence float64 `json:"confidence,omitempty"`
}

TriageResponse is the response for POST /memories/distill/triage.

type UpdateImportConfigRequest added in v0.2.0

type UpdateImportConfigRequest struct {
	AutoImport   *bool    `json:"auto_import,omitempty"`
	Sources      []string `json:"sources,omitempty"`
	ExcludePaths []string `json:"exclude_paths,omitempty"`
}

UpdateImportConfigRequest is the request for PUT /threads/import-config.

type UpdateLabelRequest

type UpdateLabelRequest struct {
	Name        string `json:"name,omitempty"`
	Color       string `json:"color,omitempty"`
	Description string `json:"description,omitempty"`
}

UpdateLabelRequest is the request body for PUT /labels/{id}.

type UpdateSourceRequest

type UpdateSourceRequest struct {
	LifecycleState string `json:"lifecycle_state,omitempty"`
}

UpdateSourceRequest is the request body for PATCH /sources/{id}.

type UpdateSpaceRequest

type UpdateSpaceRequest struct {
	Name                 *string `json:"name,omitempty"`
	Description          *string `json:"description,omitempty"`
	Icon                 *string `json:"icon,omitempty"`
	Instructions         *string `json:"instructions,omitempty"`
	DefaultRetrievalMode *string `json:"defaultRetrievalMode,omitempty"`
}

UpdateSpaceRequest is the request body for PATCH /spaces/{id}.

type UpdateWorkingMemoryRequest added in v0.2.0

type UpdateWorkingMemoryRequest struct {
	Content string `json:"content"`
}

UpdateWorkingMemoryRequest is the request for PUT /agent/working-memory.

type UpgradeInfo added in v0.2.0

type UpgradeInfo struct {
	Available      bool   `json:"available"`
	CurrentVersion string `json:"current_version"`
	LatestVersion  string `json:"latest_version,omitempty"`
	DownloadURL    string `json:"download_url,omitempty"`
	ReleaseNotes   string `json:"release_notes,omitempty"`
}

UpgradeInfo is the response for GET /admin/upgrade/check.

type UploadImportRequest added in v0.3.0

type UploadImportRequest struct {
	File                 io.Reader `json:"-"`
	Filename             string    `json:"-"`
	Mode                 string    `json:"mode,omitempty"`
	IncludeMemories      *bool     `json:"include_memories,omitempty"`
	IncludeThreads       *bool     `json:"include_threads,omitempty"`
	IncludeMessages      *bool     `json:"include_messages,omitempty"`
	IncludeEntities      *bool     `json:"include_entities,omitempty"`
	IncludeLabels        *bool     `json:"include_labels,omitempty"`
	IncludeSources       *bool     `json:"include_sources,omitempty"`
	IncludeCommunities   *bool     `json:"include_communities,omitempty"`
	IncludeEdges         *bool     `json:"include_edges,omitempty"`
	IncludeWorkingMemory *bool     `json:"include_working_memory,omitempty"`
}

UploadImportRequest is the request for POST /data/import/upload.

type UserProfile added in v0.2.0

type UserProfile struct {
	Name               string `json:"name"`
	Aliases            string `json:"aliases"`
	Context            string `json:"context"`
	PreferredLanguage  string `json:"preferred_language"`
	CustomInstructions string `json:"custom_instructions"`
}

UserProfile is the response for GET /settings/profile.

type WatcherStatus added in v0.2.0

type WatcherStatus struct {
	Running   bool   `json:"running"`
	LastScan  string `json:"last_scan,omitempty"`
	ScanCount int    `json:"scan_count"`
}

WatcherStatus is the response for GET /threads/watcher/status.

type WikiIndex added in v0.2.0

type WikiIndex struct {
	Pages []WikiIndexEntry `json:"pages"`
}

WikiIndex is the response for GET /library/wiki-index.

type WikiIndexEntry added in v0.2.0

type WikiIndexEntry struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`
}

WikiIndexEntry is a single entry in the wiki index.

type WikiPage added in v0.2.0

type WikiPage struct {
	ID       string         `json:"id"`
	Title    string         `json:"title"`
	Content  string         `json:"content"`
	Type     string         `json:"type"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

WikiPage represents a wiki page.

type WorkingMemory added in v0.2.0

type WorkingMemory struct {
	Date    string `json:"date"`
	Content string `json:"content"`
}

WorkingMemory is the response for GET /agent/working-memory.

type WorkingMemoryService added in v0.2.0

type WorkingMemoryService struct {
	// contains filtered or unexported fields
}

WorkingMemoryService handles working memory operations.

func (*WorkingMemoryService) Get added in v0.2.0

Get reads the Working Memory file (today's or an archived day).

func (*WorkingMemoryService) History added in v0.2.0

func (s *WorkingMemoryService) History(ctx context.Context) ([]string, error)

History lists dates with archived Working Memory files.

func (*WorkingMemoryService) Update added in v0.2.0

Update writes the Working Memory file from user edits.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL