Documentation
¶
Overview ¶
Package knowl contains the public non-Fx host composition API for Knowl. Domain contracts live in the pkg/knowl/types import path; the root package keeps transition aliases while embedders move to that dedicated contract package.
Package knowl continues to export the public domain contracts during the transition to pkg/knowl/types. New code should import the types subpackage directly.
Index ¶
- Constants
- type AcceptedSourcedeprecated
- type Config
- type ContentCommitdeprecated
- type Failuredeprecated
- type FileEditdeprecated
- type Host
- func (host *Host) Addr() string
- func (host *Host) Close() error
- func (host *Host) Handler() http.Handler
- func (host *Host) Index() app.SearchIndex
- func (host *Host) Lint() *app.LintService
- func (host *Host) MCP() *mcp.Server
- func (host *Host) Operations() app.OperationStore
- func (host *Host) Query() *app.QueryService
- func (host *Host) Ready() bool
- func (host *Host) Run(ctx context.Context) error
- func (host *Host) Shutdown(ctx context.Context) error
- func (host *Host) Start(_ context.Context) error
- func (host *Host) Stop(ctx context.Context) error
- func (host *Host) Wait(ctx context.Context) error
- func (host *Host) Workspace() *contentfs.Workspace
- type Leasedeprecated
- type LinkReferencedeprecated
- type LintFindingdeprecated
- type LintReportdeprecated
- type MaintenanceInputdeprecated
- type ModelEditPlandeprecated
- type Operationdeprecated
- type OperationIDdeprecated
- type OperationKeydeprecated
- type OperationMetadeprecated
- type OperationStatusdeprecated
- type Options
- type PageIDdeprecated
- type PageReferencedeprecated
- type PageSnapshotdeprecated
- type PlanSummarydeprecated
- type RawSourceRecorddeprecated
- type ReadLimitsdeprecated
- type RecoveryResultdeprecated
- type SchemaDocumentdeprecated
- type ScopeRefdeprecated
- type SourceEnvelopedeprecated
- type SourceRefdeprecated
- type SourceSummarydeprecated
- type SourceVersiondeprecated
- type StagedChangedeprecated
- type ValidatedEditPlandeprecated
- type WorkspaceInspectiondeprecated
- type WorkspaceSnapshotdeprecated
Examples ¶
Constants ¶
const ( StoreSQLite = "sqlite" StorePostgres = "postgres" DefaultScope = domain.ScopeRef("local") DefaultListen = "127.0.0.1:8080" )
const ( // Deprecated: use knowltypes.StatusReceived from pkg/knowl/types. StatusReceived = knowltypes.StatusReceived // Deprecated: use knowltypes.StatusPlanned from pkg/knowl/types. StatusPlanned = knowltypes.StatusPlanned // Deprecated: use knowltypes.StatusAwaitingReview from pkg/knowl/types. StatusAwaitingReview = knowltypes.StatusAwaitingReview // Deprecated: use knowltypes.StatusApplying from pkg/knowl/types. StatusApplying = knowltypes.StatusApplying // Deprecated: use knowltypes.StatusCommitted from pkg/knowl/types. StatusCommitted = knowltypes.StatusCommitted // Deprecated: use knowltypes.StatusFailed from pkg/knowl/types. StatusFailed = knowltypes.StatusFailed )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptedSource
deprecated
type AcceptedSource = knowltypes.AcceptedSource
Deprecated: use knowltypes.AcceptedSource from pkg/knowl/types.
type Config ¶
type Config struct {
Workspace string
Scope domain.ScopeRef
StoreDriver string
StorePath string
PostgresDSN string
ListenAddr string
OperatorToken string
ReadLimits domain.ReadLimits
IngestOptions app.IngestOptions
// WorkerQueueSize bounds only coalesced in-memory wake hints. Accepted work
// remains durable and is recovered by scheduler scans when hints are lost.
WorkerQueueSize int
ShutdownTimeout time.Duration
}
Config controls one local Knowl host. The scope is trusted host context.
type ContentCommit
deprecated
type ContentCommit = knowltypes.ContentCommit
Deprecated: use knowltypes.ContentCommit from pkg/knowl/types.
type Failure
deprecated
type Failure = knowltypes.Failure
Deprecated: use knowltypes.Failure from pkg/knowl/types.
type FileEdit
deprecated
type FileEdit = knowltypes.FileEdit
Deprecated: use knowltypes.FileEdit from pkg/knowl/types.
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host composes canonical content, operational state, application services, HTTP, and MCP.
func New ¶
New composes and preflights a host. Recovery, migrations, and projection readiness complete before return.
func NewHost ¶
NewHost is an explicit constructor alias for callers composing one local host.
Example ¶
package main
import (
"context"
"fmt"
"os"
"path/filepath"
"time"
"github.com/baldaworks/knowl/pkg/knowl"
contentfs "github.com/baldaworks/knowl/pkg/knowl/content/fs"
"github.com/baldaworks/knowl/pkg/knowl/provider"
)
func main() {
root, err := os.MkdirTemp("", "knowl-host-example-")
if err != nil {
panic(err)
}
defer func() { _ = os.RemoveAll(root) }()
workspace, err := contentfs.New(root)
if err != nil {
panic(err)
}
if err := workspace.Init(); err != nil {
panic(err)
}
config := knowl.DefaultConfig()
config.Workspace = workspace.Root()
config.StorePath = filepath.Join(workspace.Root(), ".knowl", "knowl.sqlite")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
host, err := knowl.NewHost(ctx, config, provider.Fixture{})
if err != nil {
fmt.Println(false)
return
}
defer func() { _ = host.Close() }()
fmt.Println(host != nil && !host.Ready())
}
Output: true
func (*Host) Handler ¶
Handler returns the loopback HTTP handler for in-process integration tests and embedding.
func (*Host) Index ¶
func (host *Host) Index() app.SearchIndex
Index returns the rebuildable search projection port.
func (*Host) Lint ¶
func (host *Host) Lint() *app.LintService
Lint returns the composed deterministic lint service.
func (*Host) Operations ¶
func (host *Host) Operations() app.OperationStore
Operations returns the redacted operational-state port.
func (*Host) Query ¶
func (host *Host) Query() *app.QueryService
Query returns the composed bounded query service.
func (*Host) Ready ¶
Ready reports whether recovery, migrations, projection preparation, and HTTP start completed.
func (*Host) Shutdown ¶
Shutdown is retained as an explicit alias for callers using the pre-Fx host API.
func (*Host) Start ¶
Start binds the loopback HTTP listener and marks the host ready after preflight. The context is used for the start operation; Stop owns the server lifetime.
func (*Host) Stop ¶
Stop makes the host unavailable, stops request intake and new claims, gives active work the caller's bound, and then closes owned resources.
type Lease
deprecated
type Lease = knowltypes.Lease
Deprecated: use knowltypes.Lease from pkg/knowl/types.
type LinkReference
deprecated
type LinkReference = knowltypes.LinkReference
Deprecated: use knowltypes.LinkReference from pkg/knowl/types.
type LintFinding
deprecated
type LintFinding = knowltypes.LintFinding
Deprecated: use knowltypes.LintFinding from pkg/knowl/types.
type LintReport
deprecated
type LintReport = knowltypes.LintReport
Deprecated: use knowltypes.LintReport from pkg/knowl/types.
type MaintenanceInput
deprecated
type MaintenanceInput = knowltypes.MaintenanceInput
Deprecated: use knowltypes.MaintenanceInput from pkg/knowl/types.
type ModelEditPlan
deprecated
type ModelEditPlan = knowltypes.ModelEditPlan
Deprecated: use knowltypes.ModelEditPlan from pkg/knowl/types.
type Operation
deprecated
type Operation = knowltypes.Operation
Deprecated: use knowltypes.Operation from pkg/knowl/types.
type OperationID
deprecated
type OperationID = knowltypes.OperationID
Deprecated: use knowltypes.OperationID from pkg/knowl/types.
type OperationKey
deprecated
type OperationKey = knowltypes.OperationKey
Deprecated: use knowltypes.OperationKey from pkg/knowl/types.
type OperationMeta
deprecated
type OperationMeta = knowltypes.OperationMeta
Deprecated: use knowltypes.OperationMeta from pkg/knowl/types.
type OperationStatus
deprecated
type OperationStatus = knowltypes.OperationStatus
Deprecated: use knowltypes.OperationStatus from pkg/knowl/types.
type Options ¶
type Options struct {
Config Config
Maintainer app.Maintainer
RuntimeFactory runtimeprovider.RuntimeFactory
ProviderID string
}
Options supplies the host configuration plus either an explicit maintainer or the runtime-provider inputs needed to build one lazily.
type PageID
deprecated
type PageID = knowltypes.PageID
Deprecated: use knowltypes.PageID from pkg/knowl/types.
type PageReference
deprecated
type PageReference = knowltypes.PageReference
Deprecated: use knowltypes.PageReference from pkg/knowl/types.
type PageSnapshot
deprecated
type PageSnapshot = knowltypes.PageSnapshot
Deprecated: use knowltypes.PageSnapshot from pkg/knowl/types.
type PlanSummary
deprecated
type PlanSummary = knowltypes.PlanSummary
Deprecated: use knowltypes.PlanSummary from pkg/knowl/types.
type RawSourceRecord
deprecated
type RawSourceRecord = knowltypes.RawSourceRecord
Deprecated: use knowltypes.RawSourceRecord from pkg/knowl/types.
type ReadLimits
deprecated
type ReadLimits = knowltypes.ReadLimits
Deprecated: use knowltypes.ReadLimits from pkg/knowl/types.
type RecoveryResult
deprecated
type RecoveryResult = knowltypes.RecoveryResult
Deprecated: use knowltypes.RecoveryResult from pkg/knowl/types.
type SchemaDocument
deprecated
type SchemaDocument = knowltypes.SchemaDocument
Deprecated: use knowltypes.SchemaDocument from pkg/knowl/types.
type ScopeRef
deprecated
type ScopeRef = knowltypes.ScopeRef
Deprecated: use knowltypes.ScopeRef from pkg/knowl/types.
type SourceEnvelope
deprecated
type SourceEnvelope = knowltypes.SourceEnvelope
Deprecated: use knowltypes.SourceEnvelope from pkg/knowl/types.
type SourceRef
deprecated
type SourceRef = knowltypes.SourceRef
Deprecated: use knowltypes.SourceRef from pkg/knowl/types.
type SourceSummary
deprecated
type SourceSummary = knowltypes.SourceSummary
Deprecated: use knowltypes.SourceSummary from pkg/knowl/types.
type SourceVersion
deprecated
type SourceVersion = knowltypes.SourceVersion
Deprecated: use knowltypes.SourceVersion from pkg/knowl/types.
type StagedChange
deprecated
type StagedChange = knowltypes.StagedChange
Deprecated: use knowltypes.StagedChange from pkg/knowl/types.
type ValidatedEditPlan
deprecated
type ValidatedEditPlan = knowltypes.ValidatedEditPlan
Deprecated: use knowltypes.ValidatedEditPlan from pkg/knowl/types.
type WorkspaceInspection
deprecated
type WorkspaceInspection = knowltypes.WorkspaceInspection
Deprecated: use knowltypes.WorkspaceInspection from pkg/knowl/types.
type WorkspaceSnapshot
deprecated
type WorkspaceSnapshot = knowltypes.WorkspaceSnapshot
Deprecated: use knowltypes.WorkspaceSnapshot from pkg/knowl/types.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package app owns Knowl application policy and its consuming ports.
|
Package app owns Knowl application policy and its consuming ports. |
|
content
|
|
|
fs
Package fs will provide the canonical filesystem workspace adapter.
|
Package fs will provide the canonical filesystem workspace adapter. |
|
internal
|
|
|
knowledgetest
Package knowledgetest contains the internal deterministic v0.1 knowledge loop corpus.
|
Package knowledgetest contains the internal deterministic v0.1 knowledge loop corpus. |
|
runnertest
Package runnertest provides the backend-neutral durable runner contract.
|
Package runnertest provides the backend-neutral durable runner contract. |
|
Package mcp provides bounded, server-scoped Knowl MCP tools.
|
Package mcp provides bounded, server-scoped Knowl MCP tools. |
|
Package provider contains adapters from the shared runtime provider registry to Knowl's structured maintainer boundary.
|
Package provider contains adapters from the shared runtime provider registry to Knowl's structured maintainer boundary. |
|
store
|
|
|
internal/contextpolicy
Package contextpolicy owns backend-independent maintenance context budgets and deterministic phase merging.
|
Package contextpolicy owns backend-independent maintenance context budgets and deterministic phase merging. |
|
internal/contexttest
Package contexttest defines the shared maintenance context contract for rebuildable search adapters.
|
Package contexttest defines the shared maintenance context contract for rebuildable search adapters. |
|
internal/lexical
Package lexical contains the backend-independent lexical retrieval policy.
|
Package lexical contains the backend-independent lexical retrieval policy. |
|
internal/searchtest
Package searchtest defines the shared behavioral contract for lexical store adapters.
|
Package searchtest defines the shared behavioral contract for lexical store adapters. |
|
internal/storetest
Package storetest provides shared behavioral contracts for operational stores.
|
Package storetest provides shared behavioral contracts for operational stores. |
|
postgres
Package postgres implements Knowl operational state and search projections with PostgreSQL-native transactions and full-text search.
|
Package postgres implements Knowl operational state and search projections with PostgreSQL-native transactions and full-text search. |
|
sqlite
Package sqlite will provide the SQLite operational store and search projection.
|
Package sqlite will provide the SQLite operational store and search projection. |
|
Package knowl contains the public, transport-neutral Knowl domain contracts.
|
Package knowl contains the public, transport-neutral Knowl domain contracts. |
|
Package wiki contains the shared Markdown/wiki parsing and normalization rules that define canonical Knowl workspace semantics.
|
Package wiki contains the shared Markdown/wiki parsing and normalization rules that define canonical Knowl workspace semantics. |