note

package
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusGenerating = "generating"
	StatusDone       = "done"
	StatusError      = "error"

	SourceAI     = "ai"
	SourceManual = "manual"
)

Variables

This section is empty.

Functions

func Now

func Now() int64

Types

type Note

type Note struct {
	ID        string `json:"id"`
	Directory string `json:"directory"`
	Title     string `json:"title"`
	Query     string `json:"query"`
	Content   string `json:"content"`
	SessionID string `json:"sessionId,omitempty"`
	Status    string `json:"status"`
	Source    string `json:"source"`
	Version   int    `json:"version"`
	CreatedAt int64  `json:"createdAt"`
	UpdatedAt int64  `json:"updatedAt"`
}

type NoteVersion

type NoteVersion struct {
	ID        string `json:"id"`
	NoteID    string `json:"noteId"`
	Version   int    `json:"version"`
	Content   string `json:"content"`
	CreatedAt int64  `json:"createdAt"`
}

type Store

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

func NewStore

func NewStore(database *db.DB) *Store

func (*Store) Create

func (s *Store) Create(note *Note) error

func (*Store) Delete

func (s *Store) Delete(id string) error

func (*Store) FinalizeBySession

func (s *Store) FinalizeBySession(sessionID, content, exitReason string) error

FinalizeBySession is called when the note agent loop completes. It increments the version, saves the new content to the note table, and records a version entry so the full history is preserved.

func (*Store) Get

func (s *Store) Get(id string) (*Note, error)

func (*Store) GetBySessionID

func (s *Store) GetBySessionID(sessionID string) (*Note, error)

func (*Store) List

func (s *Store) List(directory string) ([]*Note, error)

func (*Store) ListVersions

func (s *Store) ListVersions(noteID string) ([]*NoteVersion, error)

func (*Store) RecoverStuckNotes added in v0.3.1

func (s *Store) RecoverStuckNotes() ([]*Note, error)

RecoverStuckNotes finds all notes still in "generating" status and marks them as "error". This runs on server startup to handle notes whose agent loop was interrupted by a server restart or crash.

func (*Store) SaveContent added in v0.9.2

func (s *Store) SaveContent(noteID, title, content string) error

SaveContent updates a note's title and content, increments version, and records a version snapshot.

func (*Store) UpdateContent

func (s *Store) UpdateContent(id, title, content, status string, version int) error

Jump to

Keyboard shortcuts

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