Documentation
¶
Overview ¶
Package server implements gitrakz's HTTP handlers as the generated api.StrictServerInterface. Every external dependency (storage, the transform engine, sessionization, the gh sync controller, and the LLM template composer) is expressed as a small interface owned by this package, so Server is fully unit-testable without a real DB, LLM, or gh CLI. Production wiring (a later chunk, the "service" layer) supplies the concrete implementations.
Index ¶
- type Deps
- type Engine
- type LLMComposer
- type LLMModelLister
- type Server
- func (s *Server) CreateTemplate(ctx context.Context, request api.CreateTemplateRequestObject) (api.CreateTemplateResponseObject, error)
- func (s *Server) DeleteTemplate(ctx context.Context, request api.DeleteTemplateRequestObject) (api.DeleteTemplateResponseObject, error)
- func (s *Server) ExportDocument(ctx context.Context, request api.ExportDocumentRequestObject) (api.ExportDocumentResponseObject, error)
- func (s *Server) GenerateTemplate(ctx context.Context, request api.GenerateTemplateRequestObject) (api.GenerateTemplateResponseObject, error)
- func (s *Server) GetLLMSettings(ctx context.Context, _ api.GetLLMSettingsRequestObject) (api.GetLLMSettingsResponseObject, error)
- func (s *Server) GetSyncStatus(ctx context.Context, _ api.GetSyncStatusRequestObject) (api.GetSyncStatusResponseObject, error)
- func (s *Server) ListLLMModels(ctx context.Context, _ api.ListLLMModelsRequestObject) (api.ListLLMModelsResponseObject, error)
- func (s *Server) ListOwners(ctx context.Context, _ api.ListOwnersRequestObject) (api.ListOwnersResponseObject, error)
- func (s *Server) ListRepos(ctx context.Context, request api.ListReposRequestObject) (api.ListReposResponseObject, error)
- func (s *Server) ListSessions(ctx context.Context, request api.ListSessionsRequestObject) (api.ListSessionsResponseObject, error)
- func (s *Server) ListTemplates(ctx context.Context, _ api.ListTemplatesRequestObject) (api.ListTemplatesResponseObject, error)
- func (s *Server) ListTimeline(ctx context.Context, request api.ListTimelineRequestObject) (api.ListTimelineResponseObject, error)
- func (s *Server) RunTemplate(ctx context.Context, request api.RunTemplateRequestObject) (api.RunTemplateResponseObject, error)
- func (s *Server) TriggerSync(ctx context.Context, _ api.TriggerSyncRequestObject) (api.TriggerSyncResponseObject, error)
- func (s *Server) UpdateLLMSettings(ctx context.Context, request api.UpdateLLMSettingsRequestObject) (api.UpdateLLMSettingsResponseObject, error)
- func (s *Server) UpdateTemplate(ctx context.Context, request api.UpdateTemplateRequestObject) (api.UpdateTemplateResponseObject, error)
- type Sessionizer
- type Store
- type SyncController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Deps ¶
type Deps struct {
Store Store
Engine Engine
Sessionizer Sessionizer
SyncController SyncController
LLMComposer LLMComposer
LLMModelLister LLMModelLister
}
Deps collects every dependency Server needs to satisfy api.StrictServerInterface.
type Engine ¶
type Engine interface {
Run(
ctx context.Context,
tmpl template.Template,
timeline types.Timeline,
form types.FormValues,
) (blocks.Document, error)
}
Engine runs a template's transform pipeline over a selected timeline and renders it into a display Document. *engine.Engine satisfies it in production.
type LLMComposer ¶
type LLMComposer interface {
GenerateTemplate(
ctx context.Context,
description string,
) (template.Template, error)
}
LLMComposer drafts a new template from a natural-language description. The service layer wires this to elelem.
type LLMModelLister ¶ added in v0.7.0
LLMModelLister lists the provider's available models with their capability flags. The service layer wires this to elelem.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements api.StrictServerInterface entirely against the interfaces in Deps, so it never talks to a real DB/LLM/gh CLI directly.
func (*Server) CreateTemplate ¶
func (s *Server) CreateTemplate( ctx context.Context, request api.CreateTemplateRequestObject, ) (api.CreateTemplateResponseObject, error)
CreateTemplate saves a new, non-builtin template from the client- submitted TemplateInput, assigning it a fresh id.
func (*Server) DeleteTemplate ¶
func (s *Server) DeleteTemplate( ctx context.Context, request api.DeleteTemplateRequestObject, ) (api.DeleteTemplateResponseObject, error)
DeleteTemplate removes a custom template. Builtin templates are not deletable.
func (*Server) ExportDocument ¶
func (s *Server) ExportDocument( ctx context.Context, request api.ExportDocumentRequestObject, ) (api.ExportDocumentResponseObject, error)
ExportDocument resolves a Document (inline, or by running a template) and serializes it in the requested format.
The generated response only carries an application/octet-stream Body + ContentLength (VisitExportDocumentResponse hardcodes the content type and sets no other headers), so per-format content-type/filename distinction isn't expressible within the generated contract — every format returns as octet-stream bytes.
func (*Server) GenerateTemplate ¶
func (s *Server) GenerateTemplate( ctx context.Context, request api.GenerateTemplateRequestObject, ) (api.GenerateTemplateResponseObject, error)
GenerateTemplate LLM-composes a template draft from a description. Nothing is persisted — the caller reviews/edits/saves separately via CreateTemplate.
func (*Server) GetLLMSettings ¶ added in v0.7.0
func (s *Server) GetLLMSettings( ctx context.Context, _ api.GetLLMSettingsRequestObject, ) (api.GetLLMSettingsResponseObject, error)
GetLLMSettings returns the stored LLM settings.
func (*Server) GetSyncStatus ¶
func (s *Server) GetSyncStatus( ctx context.Context, _ api.GetSyncStatusRequestObject, ) (api.GetSyncStatusResponseObject, error)
GetSyncStatus returns the current sync status.
func (*Server) ListLLMModels ¶ added in v0.7.0
func (s *Server) ListLLMModels( ctx context.Context, _ api.ListLLMModelsRequestObject, ) (api.ListLLMModelsResponseObject, error)
ListLLMModels returns the provider's available models with their capability flags so the UI can gate the reasoning-effort and temperature controls.
func (*Server) ListOwners ¶
func (s *Server) ListOwners( ctx context.Context, _ api.ListOwnersRequestObject, ) (api.ListOwnersResponseObject, error)
ListOwners returns every distinct owner with ingested activity.
func (*Server) ListRepos ¶
func (s *Server) ListRepos( ctx context.Context, request api.ListReposRequestObject, ) (api.ListReposResponseObject, error)
ListRepos returns every distinct repo ingested under the required "owner" query parameter.
func (*Server) ListSessions ¶
func (s *Server) ListSessions( ctx context.Context, request api.ListSessionsRequestObject, ) (api.ListSessionsResponseObject, error)
ListSessions derives per-owner work sessions over the filtered range.
The Gap query parameter (a per-request sessionization override) is unused here — the Sessionizer contract takes only a timeline; gap tuning belongs to the service layer that wires Sessionizer to the sessionize primitive.
func (*Server) ListTemplates ¶
func (s *Server) ListTemplates( ctx context.Context, _ api.ListTemplatesRequestObject, ) (api.ListTemplatesResponseObject, error)
ListTemplates returns every saved template, built-in and custom.
func (*Server) ListTimeline ¶
func (s *Server) ListTimeline( ctx context.Context, request api.ListTimelineRequestObject, ) (api.ListTimelineResponseObject, error)
ListTimeline returns one page of the filtered, newest-first event timeline.
func (*Server) RunTemplate ¶
func (s *Server) RunTemplate( ctx context.Context, request api.RunTemplateRequestObject, ) (api.RunTemplateResponseObject, error)
RunTemplate resolves the request's templateId and runs its transform pipeline over the (optionally filtered) timeline, returning the rendered Document.
RunRequest carries only a templateId (no inline template field in the generated schema); unlike ExportDocument, there is no inline-document path here.
func (*Server) TriggerSync ¶
func (s *Server) TriggerSync( ctx context.Context, _ api.TriggerSyncRequestObject, ) (api.TriggerSyncResponseObject, error)
TriggerSync runs one incremental `gh` sync and reports its outcome as an accepted job. ghsync.SyncResult carries no id of its own, so a fresh one is minted per call purely to satisfy the SyncJob response shape.
func (*Server) UpdateLLMSettings ¶ added in v0.7.0
func (s *Server) UpdateLLMSettings( ctx context.Context, request api.UpdateLLMSettingsRequestObject, ) (api.UpdateLLMSettingsResponseObject, error)
UpdateLLMSettings persists the submitted LLM settings.
func (*Server) UpdateTemplate ¶
func (s *Server) UpdateTemplate( ctx context.Context, request api.UpdateTemplateRequestObject, ) (api.UpdateTemplateResponseObject, error)
UpdateTemplate replaces a custom template's fields with the submitted TemplateInput. Builtin templates are not editable.
type Sessionizer ¶
type Sessionizer interface {
Sessions(
ctx context.Context,
timeline types.Timeline,
) ([]types.Session, error)
}
Sessionizer derives per-owner work sessions from a raw timeline. The service layer wires this to the sessionize transform primitive.
type Store ¶
type Store interface {
ListOwners(ctx context.Context) ([]string, error)
ListRepos(ctx context.Context, owner string) ([]string, error)
QueryTimeline(
ctx context.Context,
filter db.TimelineFilter,
) ([]types.Event, bool, error)
ListTemplates(ctx context.Context) ([]template.Template, error)
GetTemplate(ctx context.Context, id string) (template.Template, error)
SaveTemplate(ctx context.Context, tmpl template.Template) error
DeleteTemplate(ctx context.Context, id string) error
GetLLMSettings(ctx context.Context) (db.LLMSettings, error)
SaveLLMSettings(ctx context.Context, settings db.LLMSettings) error
}
Store is the persistence surface the HTTP handlers need. *db.Store satisfies it in production; tests supply an in-memory fake.
type SyncController ¶
type SyncController interface {
Trigger(ctx context.Context) (ghsync.SyncResult, error)
Status(ctx context.Context) (api.SyncStatus, error)
}
SyncController drives, and reports on, the background `gh` sync. The service layer wires this to the running syncer.