Documentation
¶
Overview ¶
Package promptnotes defines the backend-neutral read contract for reusable, workspace-scoped prompt supplements.
Index ¶
Constants ¶
const ( // CurrentSchemaVersion is the prompt-note content schema understood by this // harness. Backends must fail closed on an enabled note with another version. CurrentSchemaVersion = 1 // MaxEnabledNotes and MaxTotalContentBytes keep authoritative reusable // guidance from consuming the model's entire context window. MaxEnabledNotes = 128 MaxTotalContentBytes = 64 << 10 MaxNoteContentBytes = 16 << 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileEditor ¶
type FileEditor struct {
// contains filtered or unexported fields
}
FileEditor adds idempotent CAS mutations to the same workspace-isolated prompt-notes.json authority read by FileProvider. Atomic replacement means a reader observes the old or new complete authority document, never a partial mutation. One process must own writes to a state directory.
func NewFileEditor ¶
func NewFileEditor(stateDir string) (*FileEditor, error)
func (*FileEditor) Apply ¶
func (e *FileEditor) Apply(ctx context.Context, workspaceID, operationID string, edit refinement.Edit) (refinement.Mutation, error)
type FileProvider ¶
type FileProvider struct {
// contains filtered or unexported fields
}
FileProvider reads the standalone prompt-note authority from the harness state directory. Each logical workspace gets its own prompt-notes.json file.
func NewFileProvider ¶
func NewFileProvider(stateDir string) (*FileProvider, error)
NewFileProvider constructs a workspace-isolated local provider.
func (*FileProvider) LoadWorkspace ¶
LoadWorkspace reads and validates one workspace's local authority. A missing file means that workspace has no prompt notes; malformed or mismatched data is an error so it cannot silently change the system prompt.
func (*FileProvider) Path ¶
func (p *FileProvider) Path(workspaceID string) string
Path returns the authoritative JSON file for workspaceID. It is exposed so local operators and UIs can tell users exactly which file to edit.
type Note ¶
type Note struct {
ID string `json:"id,omitempty"`
Key string `json:"key"`
Title string `json:"title,omitempty"`
Content string `json:"content"`
Enabled bool `json:"enabled"`
SchemaVersion int `json:"schema_version"`
Metadata map[string]any `json:"metadata,omitempty"`
Revision int `json:"revision,omitempty"`
ETag string `json:"etag,omitempty"`
}
Note is a reusable prompt supplement. Persistence-specific provenance is retained so callers can diagnose exactly which authoritative revision was assembled, while prompt rendering uses Key, Title, and Content.
type WorkspaceProvider ¶
type WorkspaceProvider interface {
LoadWorkspace(ctx context.Context, workspaceID string) ([]Note, error)
}
WorkspaceProvider loads the current prompt-note heads for one logical workspace. The selected implementation is authoritative: an error must be surfaced, not replaced with data from another provider.
func BindWorkspaceProvider ¶
func BindWorkspaceProvider(base WorkspaceProvider, logicalWorkspace, backendWorkspace string) WorkspaceProvider
BindWorkspaceProvider preserves logical multi-workspace routing when a backend default differs from the selected logical workspace.