Documentation
¶
Index ¶
- Constants
- func ProjectHash(workdir string) (string, error)
- func PromptBlock(scopes ...Scope) string
- func ReadOnlyPromptBlock(scopes ...Scope) string
- type BatchArgs
- type BatchResponse
- type BatchWarning
- type Decision
- type DeleteArgs
- type Entry
- type EntryPrecondition
- type Evidence
- type ListArgs
- type ListResponse
- type Meta
- type MutationResponse
- type OrganizeRun
- type OverviewResponse
- type Quota
- type QuotaSummaryResponse
- type ReadArgs
- type ReadMeta
- type ReadResponse
- type ReadWindow
- type Rejection
- type Scope
- type ScopeQuota
- type SearchArgs
- type SearchMatch
- type SearchResponse
- type Store
- func (s *Store) Accept(args ReadArgs) (MutationResponse, error)
- func (s *Store) ApplyBatch(args BatchArgs) (BatchResponse, error)
- func (s *Store) ApplyExtractionBatch(args BatchArgs, epoch uint64) (BatchResponse, error)
- func (s *Store) CancelOrganizeRun(id, warning string) (OrganizeRun, bool, error)
- func (s *Store) CancelOrganizeRunOwned(id string, epoch uint64, executor, warning string) (OrganizeRun, bool, error)
- func (s *Store) ClaimOrganizeDue() (map[string]any, error)
- func (s *Store) ClaimOrganizeRunApply(id string) (OrganizeRun, bool, error)
- func (s *Store) ClearOrganizeHistory() (map[string]any, error)
- func (s *Store) CreateOrganizeRun(run OrganizeRun) (OrganizeRun, error)
- func (s *Store) Delete(args DeleteArgs) (MutationResponse, error)
- func (s *Store) DeleteProject(workdir, actor, reason string) (map[string]any, error)
- func (s *Store) Dispatch(command string, raw json.RawMessage) (any, error)
- func (s *Store) DropUnjudged(session string) error
- func (s *Store) HoldUnjudged(session string, epoch uint64, msgs []UnjudgedMessage) error
- func (s *Store) ImportMarkdown(scope Scope) (int, error)
- func (s *Store) List(args ListArgs) (ListResponse, error)
- func (s *Store) ListOrganizeRuns() (map[string]any, error)
- func (s *Store) OrganizerEpoch() (uint64, error)
- func (s *Store) Overview(workdir string) (OverviewResponse, error)
- func (s *Store) PathsInfo() (map[string]any, error)
- func (s *Store) QuotaSummary(workdir string) (QuotaSummaryResponse, error)
- func (s *Store) Read(args ReadArgs) (ReadResponse, error)
- func (s *Store) ReadOrganizeRun(id string) (OrganizeRun, error)
- func (s *Store) RecentRejections() (map[string]any, error)
- func (s *Store) Root() string
- func (s *Store) SaveOrganizeRun(run OrganizeRun) (OrganizeRun, error)
- func (s *Store) Search(args SearchArgs) (SearchResponse, error)
- func (s *Store) TakeUnjudged(session string) ([]UnjudgedMessage, error)
- func (s *Store) TodayDaily() (any, error)
- func (s *Store) TodayLocalDate() string
- func (s *Store) Update(args UpdateArgs) (MutationResponse, error)
- func (s *Store) UpdateOrganizeRun(run OrganizeRun) (OrganizeRun, error)
- func (s *Store) WipeAll() (map[string]any, error)
- func (s *Store) WipeEpoch() uint64
- func (s *Store) Write(args WriteArgs) (MutationResponse, error)
- type StoreError
- type UnjudgedMessage
- type UpdateArgs
- type WriteArgs
Constants ¶
const ScopeLimit = 500
Variables ¶
This section is empty.
Functions ¶
func ProjectHash ¶ added in v0.107.0
func PromptBlock ¶
func ReadOnlyPromptBlock ¶ added in v0.107.6
ReadOnlyPromptBlock injects saved entries for hosts that no longer offer remember/forget.
Types ¶
type BatchArgs ¶ added in v0.107.0
type BatchArgs struct {
Workdir string `json:"workdir,omitempty"`
ConversationID string `json:"conversationId,omitempty"`
Trigger string `json:"trigger,omitempty"`
Model string `json:"model,omitempty"`
LocalDate string `json:"localDate,omitempty"`
DailyAppend *struct {
Bullet string `json:"bullet"`
} `json:"dailyAppend,omitempty"`
Decisions []Decision `json:"decisions,omitempty"`
}
type BatchResponse ¶ added in v0.107.0
type BatchResponse struct {
Created []string `json:"created"`
Updated []string `json:"updated"`
Deleted []string `json:"deleted"`
Warnings []string `json:"warnings"`
WarningDetails []BatchWarning `json:"warningDetails"`
}
type BatchWarning ¶ added in v0.107.0
type Decision ¶ added in v0.107.0
type Decision struct {
Op string `json:"op"`
Slug string `json:"slug"`
Scope string `json:"scope,omitempty"`
WorkdirHash string `json:"workdirHash,omitempty"`
MemoryType string `json:"memoryType,omitempty"`
Description *string `json:"description,omitempty"`
Body *string `json:"body,omitempty"`
Mode string `json:"mode,omitempty"`
Reason string `json:"reason,omitempty"`
GroupID string `json:"groupId,omitempty"`
Evidence *Evidence `json:"evidence,omitempty"`
Preconditions []EntryPrecondition `json:"preconditions,omitempty"`
}
type DeleteArgs ¶ added in v0.107.0
type EntryPrecondition ¶ added in v0.107.6
type Evidence ¶ added in v0.107.0
type Evidence struct {
Confidence string `json:"confidence,omitempty"`
SourceQuote string `json:"sourceQuote,omitempty"`
Reasoning string `json:"reasoning,omitempty"`
Aliases []string `json:"aliases,omitempty"`
ConflictsWith []string `json:"conflictsWith,omitempty"`
Supersedes string `json:"supersedes,omitempty"`
OverrideReject string `json:"overrideReject,omitempty"`
}
type ListArgs ¶ added in v0.107.0
type ListArgs struct {
Scope string `json:"scope,omitempty"`
Workdir string `json:"workdir,omitempty"`
IncludeAllProjects bool `json:"includeAllProjects,omitempty"`
MemoryType string `json:"memoryType,omitempty"`
IncludeDaily bool `json:"includeDaily,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
type ListResponse ¶ added in v0.107.0
type Meta ¶ added in v0.107.0
type Meta struct {
Slug string `json:"slug"`
Scope string `json:"scope"`
WorkdirHash string `json:"workdirHash"`
WorkdirPath string `json:"workdirPath,omitempty"`
MemoryType string `json:"memoryType"`
Description string `json:"description"`
Headline string `json:"headline"`
DateLocal *string `json:"dateLocal"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
AppendCount int `json:"appendCount"`
Archived bool `json:"archived"`
Unreviewed bool `json:"unreviewed"`
Confidence string `json:"confidence"`
FileSize int64 `json:"fileSize"`
}
type MutationResponse ¶ added in v0.107.0
type MutationResponse struct {
Slug string `json:"slug"`
Scope string `json:"scope"`
Created bool `json:"created"`
Updated bool `json:"updated"`
Deleted bool `json:"deleted"`
IndexUpdated bool `json:"indexUpdated"`
Warning *string `json:"warning"`
AppliedConfidence string `json:"appliedConfidence,omitempty"`
AutoDowngraded *bool `json:"autoDowngraded,omitempty"`
}
type OrganizeRun ¶ added in v0.107.0
OrganizeRun retains optional report fields without rewriting old report versions.
type OverviewResponse ¶ added in v0.107.0
type Quota ¶ added in v0.107.0
type Quota struct {
Used int `json:"used"`
Limit int `json:"limit"`
ScopeQuotas []ScopeQuota `json:"scopeQuotas"`
}
type QuotaSummaryResponse ¶ added in v0.107.0
type QuotaSummaryResponse struct {
Scopes []ScopeQuota `json:"scopes"`
}
type ReadResponse ¶ added in v0.107.0
type ReadResponse struct {
Slug string `json:"slug"`
Scope string `json:"scope"`
MemoryType string `json:"memoryType"`
Description string `json:"description"`
Headline string `json:"headline"`
Body string `json:"body"`
TotalLines int `json:"totalLines"`
Window ReadWindow `json:"window"`
Meta ReadMeta `json:"meta"`
}
type ReadWindow ¶ added in v0.107.0
type Scope ¶
func Installation ¶
func Installation() Scope
func (Scope) ReadEntries ¶ added in v0.107.6
ReadEntries is Entries with the read error kept; a missing file is empty.
type ScopeQuota ¶ added in v0.107.0
type ScopeQuota struct {
Scope string `json:"scope"`
WorkdirHash string `json:"workdirHash"`
Used int `json:"used"`
Limit int `json:"limit"`
Headroom int `json:"headroom"`
Archived int `json:"archivedCount"`
UnreviewedCount int `json:"unreviewedCount"`
OldestUnreviewedAgeDays *float64 `json:"oldestUnreviewedAgeDays"`
}
type SearchArgs ¶ added in v0.107.0
type SearchArgs struct {
Query string `json:"query"`
Scope string `json:"scope,omitempty"`
Workdir string `json:"workdir,omitempty"`
MemoryType string `json:"memoryType,omitempty"`
Limit int `json:"limit,omitempty"`
IncludeHistory bool `json:"includeHistory,omitempty"`
HistorySince int64 `json:"historySince,omitempty"`
HistoryUntil int64 `json:"historyUntil,omitempty"`
HistoryDateLocal string `json:"historyDateLocal,omitempty"`
HistoryTimeMode string `json:"historyTimeMode,omitempty"`
}
type SearchMatch ¶ added in v0.107.0
type SearchMatch struct {
Slug string `json:"slug"`
Scope string `json:"scope"`
WorkdirHash string `json:"workdirHash,omitempty"`
MemoryType string `json:"memoryType"`
Description string `json:"description"`
Headline string `json:"headline"`
Snippet string `json:"snippet"`
Score float64 `json:"score"`
RawScore *float64 `json:"rawScore"`
AgeDays *float64 `json:"ageDays"`
Unreviewed bool `json:"unreviewed"`
Confidence string `json:"confidence"`
}
type SearchResponse ¶ added in v0.107.0
type SearchResponse struct {
Matches []SearchMatch `json:"matches"`
HistoryMatches []any `json:"historyMatches"`
UsedFallback bool `json:"usedFallback"`
}
type Store ¶ added in v0.107.0
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Accept ¶ added in v0.107.0
func (s *Store) Accept(args ReadArgs) (MutationResponse, error)
func (*Store) ApplyBatch ¶ added in v0.107.0
func (s *Store) ApplyBatch(args BatchArgs) (BatchResponse, error)
func (*Store) ApplyExtractionBatch ¶ added in v0.107.6
func (s *Store) ApplyExtractionBatch(args BatchArgs, epoch uint64) (BatchResponse, error)
ApplyExtractionBatch discards plans from before a wipe under the same lock that protects both the wipe and every batch mutation.
func (*Store) CancelOrganizeRun ¶ added in v0.107.0
func (s *Store) CancelOrganizeRun(id, warning string) (OrganizeRun, bool, error)
CancelOrganizeRun changes only a reviewable run. Once apply ownership has been claimed, cancellation leaves that state untouched.
func (*Store) CancelOrganizeRunOwned ¶ added in v0.107.0
func (s *Store) CancelOrganizeRunOwned(id string, epoch uint64, executor, warning string) (OrganizeRun, bool, error)
CancelOrganizeRunOwned cancels only when the caller still owns the run.
func (*Store) ClaimOrganizeDue ¶ added in v0.107.0
func (*Store) ClaimOrganizeRunApply ¶ added in v0.107.0
func (s *Store) ClaimOrganizeRunApply(id string) (OrganizeRun, bool, error)
ClaimOrganizeRunApply persists ownership before any batch side effects. An interrupted applying run is not replayed automatically.
func (*Store) ClearOrganizeHistory ¶ added in v0.107.0
func (*Store) CreateOrganizeRun ¶ added in v0.107.0
func (s *Store) CreateOrganizeRun(run OrganizeRun) (OrganizeRun, error)
func (*Store) Delete ¶ added in v0.107.0
func (s *Store) Delete(args DeleteArgs) (MutationResponse, error)
func (*Store) DeleteProject ¶ added in v0.107.0
func (*Store) Dispatch ¶ added in v0.107.0
Dispatch executes the explicitly supported native memory command set.
func (*Store) DropUnjudged ¶ added in v0.107.6
DropUnjudged forgets a session's held messages, for a deleted session.
func (*Store) HoldUnjudged ¶ added in v0.107.6
func (s *Store) HoldUnjudged(session string, epoch uint64, msgs []UnjudgedMessage) error
HoldUnjudged adds messages to a session's unjudged list, keeping the newest maxUnjudgedPerSession and one entry per ID. Messages read before a wipe (epoch is not the current WipeEpoch) are dropped.
func (*Store) ImportMarkdown ¶ added in v0.107.6
ImportMarkdown copies the open remember/forget markdown entries into unreviewed global user memory, once per store. Later edits to the file are not followed: it stays in place for hosts that still read it (TUI, non-interactive kn), and the store is the backend's only writable memory. Entries the store rejects are skipped and reported in the returned error; a read or I/O failure leaves the import unfinished so the next start retries.
Each entry is claimed as pending before its write and recorded as done after it. A pending entry found on the next start is kept if its write landed and written again if not; deleting a pending entry, or wiping the store, records it as done first, so a deletion sticks even when the import did not finish. Done entries are never written again. State is re-read before every save so a concurrent writer of the state file (another host on the same store) loses as little as possible.
func (*Store) ListOrganizeRuns ¶ added in v0.107.0
func (*Store) OrganizerEpoch ¶ added in v0.107.0
OrganizerEpoch returns the current reset generation. A run from an older generation cannot be recreated after history or memory has been cleared.
func (*Store) Overview ¶ added in v0.107.0
func (s *Store) Overview(workdir string) (OverviewResponse, error)
func (*Store) QuotaSummary ¶ added in v0.107.0
func (s *Store) QuotaSummary(workdir string) (QuotaSummaryResponse, error)
func (*Store) ReadOrganizeRun ¶ added in v0.107.0
func (s *Store) ReadOrganizeRun(id string) (OrganizeRun, error)
func (*Store) RecentRejections ¶ added in v0.107.0
func (*Store) SaveOrganizeRun ¶ added in v0.107.0
func (s *Store) SaveOrganizeRun(run OrganizeRun) (OrganizeRun, error)
SaveOrganizeRun upserts by persisted identity and preserves optional report fields. Runs carrying an executor identity are compare-and-set updates: a late executor cannot overwrite a reset, cancellation, terminal state, or a newer executor's claim.
func (*Store) Search ¶ added in v0.107.0
func (s *Store) Search(args SearchArgs) (SearchResponse, error)
func (*Store) TakeUnjudged ¶ added in v0.107.6
func (s *Store) TakeUnjudged(session string) ([]UnjudgedMessage, error)
TakeUnjudged returns and clears a session's unjudged list.
func (*Store) TodayDaily ¶ added in v0.107.0
func (*Store) TodayLocalDate ¶ added in v0.107.0
func (*Store) Update ¶ added in v0.107.0
func (s *Store) Update(args UpdateArgs) (MutationResponse, error)
func (*Store) UpdateOrganizeRun ¶ added in v0.107.0
func (s *Store) UpdateOrganizeRun(run OrganizeRun) (OrganizeRun, error)
type StoreError ¶ added in v0.107.0
func (*StoreError) Error ¶ added in v0.107.0
func (e *StoreError) Error() string
type UnjudgedMessage ¶ added in v0.107.6
UnjudgedMessage is a user message the hidden extractor has not judged yet: its turn was stopped or failed, or its extraction did not finish.
type UpdateArgs ¶ added in v0.107.0
type UpdateArgs struct {
ReadArgs
MemoryType *string `json:"memoryType,omitempty"`
Description *string `json:"description,omitempty"`
Body *string `json:"body,omitempty"`
Mode string `json:"mode,omitempty"`
Actor string `json:"actor,omitempty"`
ConversationID string `json:"conversationId,omitempty"`
Model string `json:"model,omitempty"`
Evidence *Evidence `json:"evidence,omitempty"`
// Unreviewed is set by internal callers only (hidden extraction).
Unreviewed *bool `json:"-"`
}
type WriteArgs ¶ added in v0.107.0
type WriteArgs struct {
Slug string `json:"slug"`
Scope string `json:"scope"`
Workdir string `json:"workdir,omitempty"`
MemoryType string `json:"memoryType"`
Description string `json:"description"`
Body string `json:"body"`
Actor string `json:"actor,omitempty"`
ConversationID string `json:"conversationId,omitempty"`
Model string `json:"model,omitempty"`
Evidence *Evidence `json:"evidence,omitempty"`
Unreviewed *bool `json:"unreviewed,omitempty"`
}