server

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Exposed aliases for enforcement reporting.
	EnforcementCodeModeCompliance     = enforcementCodeModeCompliance
	EnforcementCodeModeTooLow         = enforcementCodeModeTooLow
	EnforcementCodeModeNotSet         = enforcementCodeModeNotSet
	EnforcementCodeStrictRequired     = enforcementCodeStrictRequired
	EnforcementCodeFactEvidence       = enforcementCodeFactEvidence
	EnforcementCodeClaimViolation     = enforcementCodeClaimViolation
	EnforcementCodeModeUpdated        = enforcementCodeModeUpdated
	EnforcementCodeRecallRequired     = enforcementCodeRecallRequired
	EnforcementCodeArtifactPathEscape = enforcementCodeArtifactPathEscape
)

Variables

This section is empty.

Functions

func BuildNextTaskSignals

func BuildNextTaskSignals(parsedTasks []*tasks.Task) map[string]interface{}

BuildNextTaskSignals derives observational metadata for the next unfinished task.

func BuildSubtaskSpecs

func BuildSubtaskSpecs(inputs []TaskSubtaskInput) []tasks.SubtaskSpec

BuildSubtaskSpecs converts inputs into TaskManager subtask specs.

func BuildTaskAuthorityPayload

func BuildTaskAuthorityPayload(taskManager *tasks.TaskManager) (map[string]interface{}, error)

BuildTaskAuthorityPayload produces the response body for memory_check_task_authority.

func BuildToolList

func BuildToolList() []map[string]interface{}

BuildToolList renders the tool specifications with metadata for JSON responses.

func ToolMetadata

func ToolMetadata(name string, base map[string]interface{})

ToolMetadata augments a tool map with intent metadata.

func ValidateArtifactPath added in v0.8.1

func ValidateArtifactPath(workspaceRoot, relPath string) (string, error)

ValidateArtifactPath resolves and constrains a relative path to the workspace root. It rejects absolute paths, directory-traversal sequences, and any resolved path that falls outside the workspace. The returned string is the fully-resolved absolute path that is safe to write.

Types

type ArtifactEntry added in v0.8.1

type ArtifactEntry struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
}

ArtifactEntry describes a single file discovered during a workspace listing.

func ListArtifacts added in v0.8.1

func ListArtifacts(workspaceRoot, pattern string) ([]ArtifactEntry, error)

ListArtifacts walks the workspace and returns visible files, optionally filtered by a glob pattern. Internal directories (.tinyMem, .git, node_modules) and the root-level tinyTasks.md are always excluded.

type ArtifactReadResult added in v0.8.1

type ArtifactReadResult struct {
	Path    string `json:"path"`
	Content string `json:"content"`
	Size    int64  `json:"size"`
	SHA256  string `json:"sha256"`
}

ArtifactReadResult is the payload returned by a successful artifact read.

func ReadArtifact added in v0.8.1

func ReadArtifact(workspaceRoot, relPath string) (ArtifactReadResult, error)

ReadArtifact reads a workspace artifact after path validation. It enforces a size ceiling and explicitly blocks TaskManager-owned files.

type ArtifactResult added in v0.8.1

type ArtifactResult struct {
	Path         string `json:"path"`
	BytesWritten int    `json:"bytes_written"`
	Created      bool   `json:"created"`
	SHA256       string `json:"sha256"`
	LinkTaskID   string `json:"link_task_id,omitempty"`
}

ArtifactResult is the confirmation payload returned to the caller after a successful write.

func WriteArtifact added in v0.8.1

func WriteArtifact(workspaceRoot, relPath, content string, overwrite bool, linkTaskID string) (ArtifactResult, error)

WriteArtifact performs the server-owned file write after path validation. The write is atomic: content is written to a temporary file in the target directory and then renamed into place so a crash mid-write cannot leave a partial file. Failure is explicit and fail-closed.

type IntentGate

type IntentGate struct {
	// contains filtered or unexported fields
}

IntentGate centralizes mode, recall, and intention checks for both MCP and Proxy transports so there is a single enforcement boundary.

func NewIntentGate

func NewIntentGate(modeCtrl *execution.Controller, enforcer *enforcement.Recorder, logger *zap.Logger) *IntentGate

NewIntentGate constructs a gate that enforces the provided controller and recorder.

func (*IntentGate) EnforceMode

func (g *IntentGate) EnforceMode(action execution.Action, minimum execution.Mode) error

EnforceMode applies an explicit minimum mode check without re-running intent lookup.

func (*IntentGate) EnsureIntent

func (g *IntentGate) EnsureIntent(tool string, action execution.Action) (intent.Definition, error)

EnsureIntent validates the given tool/action pair against the declarative registry.

func (*IntentGate) RecordRecall

func (g *IntentGate) RecordRecall()

RecordRecall marks that a recall tool was invoked.

type TaskSubtaskInput

type TaskSubtaskInput struct {
	Title     string `json:"title"`
	Completed bool   `json:"completed"`
}

TaskSubtaskInput mirrors the JSON payload used by MCP task tools.

type ToolInputSchema

type ToolInputSchema map[string]interface{}

ToolInputSchema describes the input schema for a tool.

type ToolSpec

type ToolSpec struct {
	Name        string
	Description string
	InputSchema ToolInputSchema
}

ToolSpec describes a single tool exposed via MCP.

func ToolSpecs

func ToolSpecs() []ToolSpec

ToolSpecs exposes a copy of the tool specifications for tests.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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