codecompletion

package
v1.0.0-rc.16 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codecompletion owns native FIM and explicitly selected instructed completion.

Index

Constants

This section is empty.

Variables

View Source
var ErrSuperseded = errors.New("code completion was superseded")

ErrSuperseded identifies a completion replaced by a newer request for the same editor.

Functions

func AssistantText

func AssistantText(output any) string

AssistantText extracts visible assistant output from a completion-chain result.

func Contract

func Contract() servicecontract.Contract

Contract describes editor predictions independently of the IDE and ACP adapters.

Types

type Autocompleter

Autocompleter executes a native FIM request on the selected runtime route.

type Editor

type Editor struct {
	ClientID   string
	DocumentID string
}

Editor identifies one document in one IDE client, independently of its selected route.

type NextEditExecutor

type NextEditExecutor interface {
	NextEdit(context.Context, llmrepo.Request, modelrepo.NextEditRequest) (modelrepo.NextEditResult, llmrepo.Meta, error)
}

NextEditExecutor executes the selected model's declared edit operation.

type NextEditRequest

type NextEditRequest struct {
	Provider  string
	Model     string
	Format    string
	Input     modelcontract.NextEditInput
	MaxTokens int
}

NextEditRequest selects a route and an explicit editable document snapshot.

type NextEditService

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

NextEditService owns prediction identity, supersession and replacement validation.

func NewNextEdit

func NewNextEdit(executor NextEditExecutor) (*NextEditService, error)

NewNextEdit constructs edit prediction with its required model executor.

func (*NextEditService) CancelPending

func (s *NextEditService) CancelPending()

CancelPending fences predictions before their route is replaced.

func (*NextEditService) ExecutionFingerprint

func (s *NextEditService) ExecutionFingerprint(format string) (string, error)

ExecutionFingerprint identifies the edit prompt, parser and service semantics.

func (*NextEditService) Predict

Predict verifies or executes an isolated prediction on the selected route.

func (*NextEditService) PredictLatest

func (s *NextEditService) PredictLatest(ctx context.Context, editor Editor, request NextEditRequest) ([]modelcontract.TextEdit, error)

PredictLatest supersedes the previous prediction for this client and document.

type PromptExecutor

type PromptExecutor interface {
	PromptExecute(context.Context, llmrepo.Request, string, float32, string, ...modelrepo.PromptArgument) (string, llmrepo.Meta, error)
}

PromptExecutor executes one bounded prompt on the selected model route.

type Prompter

type Prompter interface {
	Prompt(context.Context, agentservice.PromptRequest) (*agentservice.PromptResponse, error)
}

Prompter executes the configured completion chain without requiring a conversation session.

type Request

type Request struct {
	Mode         string
	Provider     string
	Model        string
	Prefix       string
	Suffix       string
	MaxTokens    int
	TemplateVars map[string]string
}

Request identifies a complete, explicitly selected completion route and input.

type Service

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

Service owns the same completion operation used by IDE editing and setup verification.

func New

func New(agent Prompter, chain *taskengine.TaskChainDefinition, native Autocompleter) (*Service, error)

New constructs completion with its required native executor, agent and instructed chain.

func NewNative

func NewNative(native Autocompleter) (*Service, error)

NewNative constructs native completion without an instructed-chain dependency.

func NewPromptOnly

func NewPromptOnly(prompt PromptExecutor, native Autocompleter) (*Service, error)

NewPromptOnly constructs completion with explicit prompt execution and native FIM dependencies.

func (*Service) CancelPending

func (s *Service) CancelPending()

CancelPending fences results and requests cancellation before replacing a route executor.

func (*Service) Complete

func (s *Service) Complete(ctx context.Context, request Request) (string, error)

Complete runs the selected operation without substituting a route or retrying different settings.

func (*Service) CompleteLatest

func (s *Service) CompleteLatest(ctx context.Context, editor Editor, request Request) (string, error)

CompleteLatest supersedes the entire prior completion operation for this editor.

func (*Service) ExecutionFingerprint

func (s *Service) ExecutionFingerprint(mode, format string) (string, error)

ExecutionFingerprint binds verification to the selected operation implementation.

func (*Service) Fingerprint

func (s *Service) Fingerprint() (string, error)

Fingerprint identifies the loaded completion chain used by editing and verification.

Jump to

Keyboard shortcuts

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