* feat(api): add bank template import/export endpoints
Add POST /banks/{bank_id}/import and GET /banks/{bank_id}/export
endpoints for declarative bank setup via JSON manifests.
A template manifest (version 1) can include bank config overrides
and mental model definitions. Import creates or updates mental
models matched by id, applies config as per-bank overrides, and
returns async operation IDs for content generation.
Export dumps a bank's explicit overrides and mental models as a
manifest that can be re-imported into another bank.
Includes control plane UI: bank creation dialog now accepts an
optional template JSON to pre-configure the bank on creation.
* docs: add Template Gallery page and bank templates reference
- Template Gallery (/templates) with search, category filter, manifest
preview modal with copy-to-clipboard
- 5 starter templates: Customer Support, Research Assistant, Personal
Journal, Code Review Buddy, Meeting Notes
- Bank Templates API reference doc (developer/api/bank-templates)
- Sidebar entry under API section
* docs: add Template Gallery links to navbar and sidebar
- Top navbar: "Templates" link between Integrations and Changelog
- Sidebar: "Template Gallery" in Resources section
* fix(docs): remove emoji icons, autofocus search, fix placeholder in template gallery
* docs: rename to Bank Templates, move to Resources sidebar only
* docs: add Bank Templates to Resources navbar dropdown
* feat(api): add directives to bank template import/export
- Add BankTemplateDirective model with name, content, priority, is_active, tags
- Import creates/updates directives matched by name
- Export includes all directives (active and inactive)
- Validation: duplicate names rejected, empty name/content caught
- Tests: 24 tests covering directives create/update, existing vs new
bank import, validation, export with directives, full round-trip
* docs: add directives to bank templates docs and sample templates
* feat(api): add JSON Schema endpoint for bank template validation
- GET /v1/default/bank-template-schema returns the JSON Schema
auto-generated from the Pydantic BankTemplateManifest model
- Static schema file at docs/static/bank-template-schema.json
- Docs updated with schema endpoint, static file link, and
validation examples (Python jsonschema, Node ajv-cli)
* feat(api): live schema validation on import, fix schema endpoint path
- Move schema endpoint to /v1/bank-template-schema (system-level, not per-bank)
- Import endpoint now accepts raw JSON and validates with Pydantic manually,
returning clean 400 errors instead of raw 422s for all validation failures
- All validation (schema + semantic) returns consistent 400 with detailed messages
* docs: add interactive JSON Schema viewer to Bank Templates page
Renders the Pydantic-generated schema as a collapsible property tree
with types, required badges, defaults, and descriptions. The schema
is imported from the static bank-template-schema.json file.
* ui: add template toggle switch and browse link to bank creation dialog
- Replace always-visible textarea with a switch toggle ("Import from template")
- Textarea only shows when switch is on, keeping the dialog clean by default
- Add "Browse templates" link pointing to hindsight.vectorize.io/templates
- Reset template state when switch is toggled off or dialog is cancelled
* ui: add empty state with Add Document CTA to data view
When a bank has 0 memories, the data view (all tabs: constellation,
graph, table, timeline) shows a centered empty state with a CTA
button that opens the Add Document dialog.
* docs: replace templates with Conversation and Coding Agent
Remove generic placeholder templates. Add two practical templates
based on actual integration patterns:
- Conversation: for chat agents (LiteLLM, LangGraph, Pydantic AI,
Vercel AI SDK). Tracks user preferences, open threads.
- Coding Agent: for Claude Code/Codex. Tracks technical decisions,
project context, developer preferences. High literalism.
* docs: rename gallery to Bank Templates Hub, keep API doc as Bank Templates
* docs: register layout-template and file-json icons in navbar and sidebar
* docs: register layout-template icon in DefaultNavbarItem for dropdown items
* docs: show integration icons on template cards
Templates now have an optional `integrations` field referencing
integration IDs from integrations.json. Icons are resolved at render
time and shown in the card header next to the category badge.
* docs: add Personal Assistant template for OpenClaw, Hermes, NemoClaw
* feat: add Export Template to bank actions + map all integrations to templates
- Add "Export Template" to the bank Actions dropdown — exports config,
mental models, and directives as JSON, copies to clipboard
- Add export API route and client method
- Map remaining integrations to templates: CrewAI, AG2, Agno, Strands,
LlamaIndex, local-mcp, skills → Conversation; hindclaw → Personal Assistant
* feat: add --template flag to LoCoMo benchmark + remove schema from Hub
- LoCoMo benchmark accepts --template <path> to apply a bank template
manifest (config, mental models, directives) before ingestion
- Template is applied per-bank in both single-phase and two-phase modes
- BenchmarkRunner.apply_template() reuses the same engine methods as
the /import API endpoint
- Remove Manifest Schema section from Bank Templates Hub page
(schema stays in the API reference doc)
* refactor: remove description field from bank template manifest
* docs: remove tags, fact_types, and directives from starter templates
* docs: remove reflect_mission and disposition fields from starter templates
* build: validate template manifests against JSON Schema during docs build
* cleanup: remove unused JsonSchemaViewer component
* docs: remove retain_extraction_mode from starter templates
* ui: enable word wrap in template manifest preview
* docs: add link to Bank Templates reference doc from Hub page
* docs: convert bank templates doc to mdx with multi-language code snippets
- Convert bank-templates.md to .mdx with Tabs/CodeSnippet components
- Add example files: bank-templates.py, .mjs, .sh, .go with doc markers
- Examples cover import, dry-run, export, round-trip, and schema
- Regenerate OpenAPI spec and all client SDKs (Python, TS, Rust, Go)
* fix: migration revision collision + use typed models in benchmark template
- Rename merge migration d6e7f8a9b0c1 -> d6e7f8a9b0c2 to resolve
revision ID collision with case_insensitive_entities_trgm_index
- Update a4b5c6d7e8f9 down_revision to point to the renamed migration
- Fix f-string lint in case_insensitive migration
- BenchmarkRunner.apply_template() now validates manifest through
BankTemplateManifest Pydantic model instead of raw dict access
- Remove redundant inline imports (json, Path already at module top)
* fix(docs): add missing Go tab to dry-run code snippet
* ci: retrigger
* fix: sync skills openapi.json + fix bankId null type error in export
- Copy updated openapi.json to skills/hindsight-docs/references/
- Add null guard for bankId in Export Template onClick handler
* fix: sync generated files (memory_engine formatting, docs skill references)
* cleanup: remove obsolete migration collision workaround
279 lines
7.9 KiB
Go
279 lines
7.9 KiB
Go
/*
|
|
Hindsight HTTP API
|
|
|
|
HTTP API for Hindsight
|
|
|
|
API version: 0.4.22
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package hindsight
|
|
|
|
import (
|
|
"encoding/json"
|
|
"bytes"
|
|
"fmt"
|
|
)
|
|
|
|
// checks if the BankTemplateManifest type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &BankTemplateManifest{}
|
|
|
|
// BankTemplateManifest A bank template manifest for import/export. Version field enables forward-compatible schema evolution: the API auto-upgrades older manifest versions to the current schema on import.
|
|
type BankTemplateManifest struct {
|
|
// Manifest schema version (currently '1')
|
|
Version string `json:"version"`
|
|
Bank NullableBankTemplateConfig `json:"bank,omitempty"`
|
|
MentalModels []BankTemplateMentalModel `json:"mental_models,omitempty"`
|
|
Directives []BankTemplateDirective `json:"directives,omitempty"`
|
|
}
|
|
|
|
type _BankTemplateManifest BankTemplateManifest
|
|
|
|
// NewBankTemplateManifest instantiates a new BankTemplateManifest object
|
|
// This constructor will assign default values to properties that have it defined,
|
|
// and makes sure properties required by API are set, but the set of arguments
|
|
// will change when the set of required properties is changed
|
|
func NewBankTemplateManifest(version string) *BankTemplateManifest {
|
|
this := BankTemplateManifest{}
|
|
this.Version = version
|
|
return &this
|
|
}
|
|
|
|
// NewBankTemplateManifestWithDefaults instantiates a new BankTemplateManifest object
|
|
// This constructor will only assign default values to properties that have it defined,
|
|
// but it doesn't guarantee that properties required by API are set
|
|
func NewBankTemplateManifestWithDefaults() *BankTemplateManifest {
|
|
this := BankTemplateManifest{}
|
|
return &this
|
|
}
|
|
|
|
// GetVersion returns the Version field value
|
|
func (o *BankTemplateManifest) GetVersion() string {
|
|
if o == nil {
|
|
var ret string
|
|
return ret
|
|
}
|
|
|
|
return o.Version
|
|
}
|
|
|
|
// GetVersionOk returns a tuple with the Version field value
|
|
// and a boolean to check if the value has been set.
|
|
func (o *BankTemplateManifest) GetVersionOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Version, true
|
|
}
|
|
|
|
// SetVersion sets field value
|
|
func (o *BankTemplateManifest) SetVersion(v string) {
|
|
o.Version = v
|
|
}
|
|
|
|
// GetBank returns the Bank field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *BankTemplateManifest) GetBank() BankTemplateConfig {
|
|
if o == nil || IsNil(o.Bank.Get()) {
|
|
var ret BankTemplateConfig
|
|
return ret
|
|
}
|
|
return *o.Bank.Get()
|
|
}
|
|
|
|
// GetBankOk returns a tuple with the Bank field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *BankTemplateManifest) GetBankOk() (*BankTemplateConfig, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.Bank.Get(), o.Bank.IsSet()
|
|
}
|
|
|
|
// HasBank returns a boolean if a field has been set.
|
|
func (o *BankTemplateManifest) HasBank() bool {
|
|
if o != nil && o.Bank.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetBank gets a reference to the given NullableBankTemplateConfig and assigns it to the Bank field.
|
|
func (o *BankTemplateManifest) SetBank(v BankTemplateConfig) {
|
|
o.Bank.Set(&v)
|
|
}
|
|
// SetBankNil sets the value for Bank to be an explicit nil
|
|
func (o *BankTemplateManifest) SetBankNil() {
|
|
o.Bank.Set(nil)
|
|
}
|
|
|
|
// UnsetBank ensures that no value is present for Bank, not even an explicit nil
|
|
func (o *BankTemplateManifest) UnsetBank() {
|
|
o.Bank.Unset()
|
|
}
|
|
|
|
// GetMentalModels returns the MentalModels field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *BankTemplateManifest) GetMentalModels() []BankTemplateMentalModel {
|
|
if o == nil {
|
|
var ret []BankTemplateMentalModel
|
|
return ret
|
|
}
|
|
return o.MentalModels
|
|
}
|
|
|
|
// GetMentalModelsOk returns a tuple with the MentalModels field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *BankTemplateManifest) GetMentalModelsOk() ([]BankTemplateMentalModel, bool) {
|
|
if o == nil || IsNil(o.MentalModels) {
|
|
return nil, false
|
|
}
|
|
return o.MentalModels, true
|
|
}
|
|
|
|
// HasMentalModels returns a boolean if a field has been set.
|
|
func (o *BankTemplateManifest) HasMentalModels() bool {
|
|
if o != nil && !IsNil(o.MentalModels) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetMentalModels gets a reference to the given []BankTemplateMentalModel and assigns it to the MentalModels field.
|
|
func (o *BankTemplateManifest) SetMentalModels(v []BankTemplateMentalModel) {
|
|
o.MentalModels = v
|
|
}
|
|
|
|
// GetDirectives returns the Directives field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *BankTemplateManifest) GetDirectives() []BankTemplateDirective {
|
|
if o == nil {
|
|
var ret []BankTemplateDirective
|
|
return ret
|
|
}
|
|
return o.Directives
|
|
}
|
|
|
|
// GetDirectivesOk returns a tuple with the Directives field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
|
func (o *BankTemplateManifest) GetDirectivesOk() ([]BankTemplateDirective, bool) {
|
|
if o == nil || IsNil(o.Directives) {
|
|
return nil, false
|
|
}
|
|
return o.Directives, true
|
|
}
|
|
|
|
// HasDirectives returns a boolean if a field has been set.
|
|
func (o *BankTemplateManifest) HasDirectives() bool {
|
|
if o != nil && !IsNil(o.Directives) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetDirectives gets a reference to the given []BankTemplateDirective and assigns it to the Directives field.
|
|
func (o *BankTemplateManifest) SetDirectives(v []BankTemplateDirective) {
|
|
o.Directives = v
|
|
}
|
|
|
|
func (o BankTemplateManifest) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o BankTemplateManifest) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
toSerialize["version"] = o.Version
|
|
if o.Bank.IsSet() {
|
|
toSerialize["bank"] = o.Bank.Get()
|
|
}
|
|
if o.MentalModels != nil {
|
|
toSerialize["mental_models"] = o.MentalModels
|
|
}
|
|
if o.Directives != nil {
|
|
toSerialize["directives"] = o.Directives
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *BankTemplateManifest) UnmarshalJSON(data []byte) (err error) {
|
|
// This validates that all required properties are included in the JSON object
|
|
// by unmarshalling the object into a generic map with string keys and checking
|
|
// that every required field exists as a key in the generic map.
|
|
requiredProperties := []string{
|
|
"version",
|
|
}
|
|
|
|
allProperties := make(map[string]interface{})
|
|
|
|
err = json.Unmarshal(data, &allProperties)
|
|
|
|
if err != nil {
|
|
return err;
|
|
}
|
|
|
|
for _, requiredProperty := range(requiredProperties) {
|
|
if _, exists := allProperties[requiredProperty]; !exists {
|
|
return fmt.Errorf("no value given for required property %v", requiredProperty)
|
|
}
|
|
}
|
|
|
|
varBankTemplateManifest := _BankTemplateManifest{}
|
|
|
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
|
decoder.DisallowUnknownFields()
|
|
err = decoder.Decode(&varBankTemplateManifest)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = BankTemplateManifest(varBankTemplateManifest)
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableBankTemplateManifest struct {
|
|
value *BankTemplateManifest
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableBankTemplateManifest) Get() *BankTemplateManifest {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableBankTemplateManifest) Set(val *BankTemplateManifest) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableBankTemplateManifest) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableBankTemplateManifest) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableBankTemplateManifest(val *BankTemplateManifest) *NullableBankTemplateManifest {
|
|
return &NullableBankTemplateManifest{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableBankTemplateManifest) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableBankTemplateManifest) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|