gokernel

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 0

Documentation

Overview

Package gokernel contains the experimental dependency-free Corvint production kernel. The initial slice intentionally implements only non-index lifecycle events; unsupported events fail closed instead of delegating to Python.

Index

Constants

View Source
const (
	Profile        = "corvint-harness-event/0"
	ReceiptPrefix  = "harness-receipt:sha256:"
	MaxInputBytes  = 131_072
	MinOutputBytes = 4_096
	MaxOutputBytes = 1_000_000
	// OutputOverheadBytes is reserved for the receipt envelope around the context
	// block, matching the oracle's OUTPUT_OVERHEAD_BYTES.
	OutputOverheadBytes = 2_048
	// MaxQueryCharacters and MaxTaskBytes bound the user-prompt task, matching the
	// oracle's MAX_QUERY_CHARS and MAX_TASK_BYTES.
	MaxQueryCharacters = 2_000
	MaxTaskBytes       = 16_384
)

Variables

This section is empty.

Functions

func CanonicalJSON

func CanonicalJSON(value any) ([]byte, error)

CanonicalJSON matches the compact, sorted, UTF-8 JSON used by the Python harness protocol. It intentionally returns no terminal newline so the bytes are suitable for receipt hashing.

func CompactionDegradations

func CompactionDegradations(event string, block map[string]any) []any

CompactionDegradations reads back the compaction rehydration block. The oracle raises each flag inside the branch that shaped that block, so the block itself is the evidence for which degradations belong on the receipt.

func HandleEvent

func HandleEvent(request EventRequest) (map[string]any, error)

func HandleEventContext

func HandleEventContext(ctx context.Context, request EventRequest) (map[string]any, error)

func HarnessHosts

func HarnessHosts() []string

HarnessHosts returns the host identifiers in the embedded schema.

func KnownHarnessHost

func KnownHarnessHost(host string) bool

KnownHarnessHost reports whether the embedded schema admits host.

func SupportedEvents

func SupportedEvents() []string

Types

type Error

type Error struct {
	Code    string
	Message string
}

Error is the stable machine-readable error returned by the experimental Go kernel. Callers must key behavior from Code, never Message.

func (*Error) Error

func (err *Error) Error() string

type EventRequest

type EventRequest struct {
	Root                 string
	Host                 string
	HostVersion          string
	Surface              string
	AdapterVersion       string
	Event                string
	Input                []byte
	BudgetBytes          int
	IndexedContext       IndexedContext
	SharedIndexedContext SharedIndexedContext
}

type IndexedBlock

type IndexedBlock func() (map[string]any, error)

IndexedBlock finishes an index-backed event from an index already in memory. It reads no repository state, so the bracket runs it beside its closing observation rather than inside the read stage.

type IndexedContext

type IndexedContext func(ctx context.Context, root, event string, normalized map[string]any, budgetBytes int) (map[string]any, error)

IndexedContext supplies the context block for the two events that require a built repository index. It is injected rather than imported so this package stays dependency-free; when it is nil those events fail closed exactly as before.

type Observation

type Observation struct {
	ObjectFormat, CommitRevision, TreeRevision string
	DirtyPaths                                 []string
	StatusSHA256                               string
}

Observation is the bracket's opening observation as handed to a shared reader: the identity that names an index snapshot and the dirty set a snapshot hit applies (IDX-SNAP-V0-010). StatusSHA256 digests the raw status bytes exactly as the index loader's own status read would.

type Repository

type Repository struct {
	CommitRevision string
	DirtyPathCount int
	DirtyPathsSHA  string
	ObjectFormat   string
	ProfileID      string
	TreeRevision   string
	WorktreeState  string
}

func ProbeRepository

func ProbeRepository(root string) (Repository, error)

func ProbeRepositoryContext

func ProbeRepositoryContext(parent context.Context, root string) (Repository, error)

type SharedIndexedContext

type SharedIndexedContext func(ctx context.Context, root, event string, normalized map[string]any, budgetBytes int, observation Observation) (IndexedBlock, error)

SharedIndexedContext is IndexedContext placed inside the GPK-V0-007 bracket (proposed GPK-V0-058): it consumes the bracket's opening observation instead of reading identity and status itself, performs the event's reads, and returns the IndexedBlock that computes the context block from what it read. When nil, the default concurrent path runs unchanged. It serves file-change and compact session-start; user-prompt keeps the default path.

Jump to

Keyboard shortcuts

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