bridge

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AISettingsDTO added in v1.3.0

type AISettingsDTO struct {
	Provider          string  `json:"provider"`
	Model             string  `json:"model"`
	Endpoint          string  `json:"endpoint"`
	APIKey            string  `json:"apiKey"`
	Temperature       float64 `json:"temperature"`
	EmbeddingsModel   string  `json:"embeddingsModel"`
	DisableEmbeddings bool    `json:"disableEmbeddings"`
	SystemPrompt      string  `json:"systemPrompt"`
	SemanticTopK      int     `json:"semanticTopK"`
}

AISettingsDTO is persisted AI configuration exposed to the Svelte UI.

type App

type App struct {

	// EventEmitter is optional (Android WebView). When set, code that would use Wails runtime events
	// should prefer this path so the native shell can forward to JavaScript.
	EventEmitter func(name string, payload map[string]any)
	// contains filtered or unexported fields
}

App is the Wails-facing API surface (bound to the frontend).

func NewApp

func NewApp(store storage.Provider, g *graph.Service, notesRoot string) *App

NewApp constructs the bridge.

func (*App) AIChat added in v1.3.0

func (a *App) AIChat(pagePath, userMessage string) (string, error)

AIChat uses RAG: current page Markdown plus top semantic hits from the vault.

func (*App) ApplySlashOp

func (a *App) ApplySlashOp(blockID, op string) error

ApplySlashOp applies a slash command to the block: today, todo, h1, h2, h3, code.

func (*App) CycleBlockTodo

func (a *App) CycleBlockTodo(blockID string) error

CycleBlockTodo cycles TODO → DOING → DONE → (clear) on the first line of the block in the file.

func (*App) EnsurePage

func (a *App) EnsurePage(path string) error

EnsurePage creates path if missing (vault-relative or absolute under vault).

func (*App) ExportPageHTML

func (a *App) ExportPageHTML(pagePath, destPath string) error

ExportPageHTML writes a standalone HTML file for a vault page using Goldmark. destPath should be absolute.

func (*App) GetAISettings added in v1.3.0

func (a *App) GetAISettings() (AISettingsDTO, error)

GetAISettings returns persisted AI options (API key is local-only, like cloudToken).

func (*App) GetAppVersion

func (a *App) GetAppVersion() string

GetAppVersion returns the build version (set via -ldflags for release binaries).

func (a *App) GetBacklinks(pagePath string) ([]domain.Block, error)

GetBacklinks returns blocks (any page) whose content links to the given vault-relative page via [[wikilinks]].

func (*App) GetLocale

func (a *App) GetLocale() (string, error)

GetLocale returns the persisted locale tag (e.g. en, zh-CN) or empty if never set (first run).

func (*App) GetPage

func (a *App) GetPage(path string) ([]PageBlock, error)

GetPage loads all blocks for a vault-relative or absolute Markdown path and returns a tree of roots.

func (*App) GetSemanticGraphEdges added in v1.3.0

func (a *App) GetSemanticGraphEdges() ([]storage.WikiGraphSemanticEdge, error)

GetSemanticGraphEdges returns page–page edges derived from embedding similarity (local SQLite only).

func (*App) GetSemanticRelatedForPage added in v1.3.0

func (a *App) GetSemanticRelatedForPage(pagePath string, limit int) ([]SemanticRelatedDTO, error)

GetSemanticRelatedForPage finds blocks on other pages similar to the page's Markdown (vector search).

func (*App) GetSyncSettings added in v1.3.1

func (a *App) GetSyncSettings() (SyncSettingsDTO, error)

GetSyncSettings returns WebDAV and LAN pairing options (secrets are local-only).

func (*App) GetTheme

func (a *App) GetTheme() (string, error)

GetTheme returns persisted UI theme: "dark" or "light".

func (*App) GetWikiGraph

func (a *App) GetWikiGraph() (storage.WikiGraph, error)

GetWikiGraph returns indexed pages as nodes and resolved wikilinks as directed edges.

func (*App) HealthResetLocalSearchIndex added in v1.4.6

func (a *App) HealthResetLocalSearchIndex() error

HealthResetLocalSearchIndex wipes the local SQLite search index (blocks, FTS, embeddings metadata, page props/aliases) and re-indexes from Markdown on disk. Markdown files in the vault are not deleted.

func (*App) IndentBlock

func (a *App) IndentBlock(blockID string) error

IndentBlock increases list indentation by two spaces for the block (and nested list lines under it).

func (*App) InsertBlockAfter

func (a *App) InsertBlockAfter(blockID, initialText string) error

InsertBlockAfter appends a new Markdown line after the given block (Logseq-style Enter).

func (*App) IsAIReachable added in v1.4.5

func (a *App) IsAIReachable() bool

IsAIReachable returns true when the configured LLM endpoint responds (Ollama /api/tags or OpenAI root ping).

func (*App) ListLANSyncPeers added in v1.3.1

func (a *App) ListLANSyncPeers() ([]LANPeerDTO, error)

ListLANSyncPeers discovers other Dingovault desktops advertising on the LAN.

func (*App) ListPagesByProperty

func (a *App) ListPagesByProperty(key, value string) ([]string, error)

ListPagesByProperty returns vault-relative .md paths whose YAML frontmatter has prop_key = prop_value (case-insensitive).

func (*App) ListVaultPages

func (a *App) ListVaultPages() ([]string, error)

ListVaultPages returns vault-relative .md paths for all indexed pages, most recently updated first.

func (*App) NotesRoot

func (a *App) NotesRoot() string

NotesRoot returns the configured vault directory (absolute path).

func (*App) OutdentBlock

func (a *App) OutdentBlock(blockID string) error

OutdentBlock decreases list indentation by two spaces for the same span.

func (*App) PairLANSyncWith added in v1.3.1

func (a *App) PairLANSyncWith(host string, port int, pin string) error

PairLANSyncWith connects to a peer, verifies the PIN, and stores received sync settings (WebDAV and optional S3) locally.

func (*App) QueryBlocks

func (a *App) QueryBlocks(dsl string) ([]domain.Block, error)

QueryBlocks runs a small query DSL: "key:value" for properties, otherwise FTS on content.

func (*App) ReorderBlockBefore

func (a *App) ReorderBlockBefore(movingID, beforeID string) error

ReorderBlockBefore moves movingID immediately before beforeID among sibling blocks in the same file.

func (a *App) ResolveWikilink(target string) (string, error)

ResolveWikilink returns the absolute .md path for a [[wikilink]] target string.

func (*App) SearchBlocks

func (a *App) SearchBlocks(query string) ([]storage.BlockSearchHit, error)

SearchBlocks queries the FTS5 index (blocks_fts) and returns ranked hits with snippets.

func (*App) SetAISettings added in v1.3.0

func (a *App) SetAISettings(dto AISettingsDTO) error

SetAISettings saves AI options. Empty apiKey preserves the previous key when provider stays OpenAI.

func (*App) SetHealthRescan added in v1.4.6

func (a *App) SetHealthRescan(fn func(context.Context) error)

SetHealthRescan registers a callback that re-walks the vault after the SQLite index is cleared (desktop / mobile). Optional; required for HealthResetLocalSearchIndex.

func (*App) SetLocale

func (a *App) SetLocale(tag string) error

SetLocale persists UI language; only en and zh-CN are supported for now.

func (*App) SetSyncSettings added in v1.3.1

func (a *App) SetSyncSettings(dto SyncSettingsDTO) error

SetSyncSettings saves sync options. Empty webdavPassword preserves the previous password.

func (*App) SetTheme

func (a *App) SetTheme(theme string) error

SetTheme persists theme and should be paired with updating document.documentElement.dataset.theme in the UI.

func (*App) StartAIInlineStream added in v1.3.0

func (a *App) StartAIInlineStream(opID, blockID, instruction string) error

StartAIInlineStream begins a streaming LLM refactor for one block. Chunks are emitted as Wails events:

  • "ai-inline-chunk" payload: { opID, chunk }
  • "ai-inline-done" payload: { opID }
  • "ai-inline-error" payload: { opID, message }

func (*App) StartLANSyncAdvertise added in v1.3.1

func (a *App) StartLANSyncAdvertise() (string, error)

StartLANSyncAdvertise opens the PIN pairing server and publishes mDNS; returns the 4-digit PIN to show locally.

func (*App) Startup

func (a *App) Startup(ctx context.Context)

Startup is called by Wails on init; ctx is used for runtime events later.

func (*App) StopLANSyncAdvertise added in v1.3.1

func (a *App) StopLANSyncAdvertise()

StopLANSyncAdvertise tears down mDNS and the pairing listener.

func (*App) SuggestTagsForBlock added in v1.3.0

func (a *App) SuggestTagsForBlock(blockID string) ([]string, error)

SuggestTagsForBlock suggests existing vault #tags that are semantically similar to the block text.

func (*App) SyncVaultS3 added in v1.3.2

func (a *App) SyncVaultS3() error

SyncVaultS3 performs a bidirectional .md sync with the configured S3 bucket (or S3-compatible API).

func (*App) SyncVaultWebDAV added in v1.3.1

func (a *App) SyncVaultWebDAV() error

SyncVaultWebDAV performs a bidirectional .md sync with the configured WebDAV server.

func (*App) UpdateBlock

func (a *App) UpdateBlock(blockID, newContent string) error

UpdateBlock surgically replaces the block's line span in the backing file and re-indexes.

type LANPeerDTO added in v1.3.1

type LANPeerDTO struct {
	Name string   `json:"name"`
	Host string   `json:"host"`
	IP   string   `json:"ip"`
	Port int      `json:"port"`
	TXT  []string `json:"txt,omitempty"`
}

LANPeerDTO is one discovered Dingovault instance on the LAN.

type PageBlock

type PageBlock struct {
	domain.Block
	Children []PageBlock `json:"children"`
}

PageBlock is a block with nested children for the outliner UI.

type SemanticRelatedDTO added in v1.3.0

type SemanticRelatedDTO struct {
	BlockID    string  `json:"blockId"`
	SourcePath string  `json:"sourcePath"`
	RelPath    string  `json:"relPath"`
	Preview    string  `json:"preview"`
	Score      float32 `json:"score"`
}

SemanticRelatedDTO is one semantically similar block on another page.

type SyncSettingsDTO added in v1.3.1

type SyncSettingsDTO struct {
	WebDAVURL        string `json:"webdavUrl"`
	WebDAVUser       string `json:"webdavUser"`
	WebDAVPassword   string `json:"webdavPassword"`
	WebDAVRemoteRoot string `json:"webdavRemoteRoot"`
	PairingPort      int    `json:"pairingPort"`
	LANInstanceName  string `json:"lanInstanceName"`
	S3Region         string `json:"s3Region"`
	S3Bucket         string `json:"s3Bucket"`
	S3Prefix         string `json:"s3Prefix"`
	S3AccessKey      string `json:"s3AccessKey"`
	S3SecretKey      string `json:"s3SecretKey"`
	S3Endpoint       string `json:"s3Endpoint"`
}

SyncSettingsDTO is persisted sync configuration for the Svelte UI.

Jump to

Keyboard shortcuts

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