Documentation
¶
Index ¶
- Constants
- func AllowedMilestoneKey(runtime Runtime, requested string) (string, error)
- func ArgumentByteLimits() map[string]int
- func AssignedMilestoneKey(runtime Runtime) string
- func AssignedTaskRef(runtime Runtime) string
- func BoolString(value bool) string
- func BuildToolResult(req Request, result Result) (domain.ToolResult, string, error)
- func CapModelResult(text string, limit int) string
- func ChatIDFromContext(ctx context.Context) (id.ID, bool)
- func CompactModelTextForPart(part domain.Part, diff string, limits CompactFormatLimits) (string, bool)
- func CompactTextForCompaction(text string, headLines int, tailLines int, maxBytes int, label string) string
- func DefaultSummarizeResult(req Request, result Result) (string, string)
- func DefinitionFor(kind ID, runtime Runtime) (provider.ToolDefinition, bool)
- func Definitions(runtime Runtime) []provider.ToolDefinition
- func DeniedMessage(err error) string
- func DisplayTextForPart(part domain.Part) (string, bool)
- func DisplayTextForStored(tool ID, payload any) string
- func EnsureSessionTmpDir(settings accesssettings.Settings) error
- func FinalizeResult(ctx context.Context, runtime Runtime, req Request, result Result) (domain.ToolResult, string, error)
- func FirstArg(args map[string]string, keys ...string) string
- func FormatMilestoneOutput(result MilestonePlanStoredResult) string
- func FormatTaskID(key string) string
- func FormatTaskOutput(result TaskListStoredResult) string
- func IsBuiltinID(id ID) bool
- func IsDenied(err error) bool
- func IsHTTPURL(input string) bool
- func ListDirectory(abs string) ([]string, error)
- func MCPImageStoredResultForPart(part domain.Part) ([]byte, string, bool)
- func MilestonePlanForKey(plan planning.Plan, ref string) planning.Plan
- func ModelResultLimitBytes(contextWindow int) int
- func ModelTextForPart(part domain.Part, diff string) (string, bool)
- func NormalizeMediaArgs(args map[string]string) (map[string]string, error)
- func NormalizePathInput(raw string) string
- func NormalizePathOrHTTPURL(input string) (string, error)
- func OutputBudgetBytes(contextWindow, usedTokens int) int
- func ParseFlexibleInt(raw string) (int, error)
- func Preview(req Request) string
- func ReadTextFile(abs string, lineLimit int, byteLimit int) (string, bool, error)
- func ReadablePath(root string, raw string) (abs string, label string, err error)
- func Register(tool Tool, spec ToolSpec)
- func RequireExecControl(runtime Runtime) (execruntime.Control, error)
- func RequireService[T any](runtime Runtime, key string) (T, error)
- func ResolvePath(runtime Runtime, raw string, kind accesssettings.AccessKind) (abs string, label string, err error)
- func ScopedMilestonePlan(runtime Runtime, plan planning.Plan) planning.Plan
- func ScopedTasks(runtime Runtime, tasks []planning.Task) []planning.Task
- func ShellResult(ctx context.Context, dir string, timeout time.Duration, command string, ...) (string, int, error)
- func StoredResultInfoForPart(part domain.Part) (ID, StoredResultStatus, bool)
- func SummarizePaths(paths []string, limit int) string
- func SummarizeResult(req Request, result Result) (string, string)
- func TaskScopeAllows(runtime Runtime, taskID string) error
- func ToolCall(req Request) provider.ToolCall
- func TruncateText(input string, limit int) (string, bool)
- func WithChatID(ctx context.Context, chatID id.ID) context.Context
- func WorkspaceDir(root string, raw string) (abs string, rel string, err error)
- func WorkspacePath(root string, raw string) (abs string, rel string, err error)
- func WriteFile(abs string, data []byte, mode fs.FileMode) error
- func WriteTextFile(abs string, content string, mode fs.FileMode) error
- type ActionRoute
- type ActionTool
- func (t ActionTool) BypassesPermission() bool
- func (t ActionTool) Call(ctx context.Context, opts Options) (Result, error)
- func (t ActionTool) Definition(runtime Runtime, spec ToolSpec) (ToolSpec, bool)
- func (t ActionTool) FinalizeResult(ctx context.Context, runtime Runtime, req Request, result Result) (Result, error)
- func (t ActionTool) ID() ID
- func (t ActionTool) NormalizeArgs(args map[string]string) (map[string]string, error)
- func (t ActionTool) Presentation(req Request) Presentation
- func (t ActionTool) Preview(req Request) string
- func (t ActionTool) SummarizeResult(req Request, result Result) (string, string)
- type BashStoredResult
- type BrowserStoredResult
- type ChatListStoredResult
- type ChatStatusControl
- type ChatStoredItem
- type CompactFormatLimits
- type DeniedError
- type DeniedStoredResult
- type DiagnosticReportStored
- type DiagnosticStored
- type EditStoredHunk
- type EditStoredResult
- type ErrorStoredResult
- type ExecListStoredItem
- type ExecListStoredResult
- type ExecProcess
- type ExecProcessStreamEntry
- type ExecStoredResult
- type FileTracker
- type GlobStoredResult
- type GrepStoredResult
- type ID
- type LintStoredResult
- type MCPExecutor
- type MCPStoredContentItem
- type MCPStoredResult
- type MediaInput
- type MilestonePlanStoredResult
- type MilestoneStoredItem
- type ModelImage
- type OfferFileStoredResult
- type Options
- type PlanStoredStep
- type PlanUpdateStoredResult
- type PlanningLifecycleStoredResult
- type Presentation
- type PresentationStoredResult
- type Presenter
- type ProviderCallError
- type QuestionStoredResult
- type ReadStoredLine
- type ReadStoredMode
- type ReadStoredResult
- type RemoteMedia
- type Request
- func CanonicalRequest(req Request) Request
- func Normalize(req Request) (Request, error)
- func ParseProviderCall(call provider.ToolCall) (Request, error)
- func RequestFromMeta(raw string) (Request, error)
- func RequestFromMetaMap(raw map[string]string) (Request, error)
- func RequestFromStored(kind ID, raw string) (Request, error)
- type Result
- func Call(ctx context.Context, options Options) (Result, error)
- func MilestonePlanResult(plan planning.Plan) Result
- func MilestonePlanResultWithTaskSummaries(plan planning.Plan, summaries map[string]string) Result
- func TaskBucketResult(plan planning.Plan, ref string, tasks []planning.Task, message string) Result
- func TaskBucketResultWithTitle(ref, title string, tasks []planning.Task, message string) Result
- type Runtime
- type SessionControl
- type ShowImageStoredResult
- type ShowMediaStoredItem
- type ShowMediaStoredResult
- type SkillStoredResult
- type StoredResultPayload
- type StoredResultStatus
- type TaskControl
- type TaskListStoredResult
- type TaskStoredItem
- type TaskStoredResult
- type Tool
- type ToolInt
- type ToolSpec
- type UserInputAnswer
- type UserInputOption
- type UserInputQuestion
- type ViewImageStoredResult
- type WebFetchStoredResult
- type WebSearchStoredItem
- type WebSearchStoredResult
- type WriteStoredResult
Constants ¶
const ( DefaultReadLineLimit = 1000 DefaultReadByteLimit = 64 * 1024 DefaultReadOutputCharLimit = 100000 DefaultToolOutputLimit = 64 * 1024 DefaultBashTimeout = 5 * time.Minute MaxBashTimeout = 10 * time.Minute )
const ( ExecReportingExit = "automatic: the exit arrives in this chat as a notification" ExecReportingLines = "automatic: each batch of new output lines, then the exit, arrives in this chat as a notification" // ExecReportingDone is shown once the exit has been reported, so an empty // output does not read as the command having printed nothing. ExecReportingDone = "done: the exit and its output were already sent to this chat as a notification" )
ExecStartRunningNote is the state note for a command that is still running when exec_command's startup wait ends. It states a fact rather than giving instructions: Qwen-style templates render tool results inside a user turn, where an instruction-like result reads as a new setup message. Reporting values for a running exec session, by notify mode.
const ExecStartRunningNote = "startup wait ended; the command continues in the background"
const MaxPresentedMediaItems = 20
const MaxRemoteMediaBytes = 25 * 1024 * 1024
Variables ¶
This section is empty.
Functions ¶
func AllowedMilestoneKey ¶
func ArgumentByteLimits ¶
func AssignedMilestoneKey ¶
func AssignedTaskRef ¶
func BoolString ¶
func BuildToolResult ¶
func CapModelResult ¶
CapModelResult cuts text over limit bytes at a line break and says so.
func CompactModelTextForPart ¶
func CompactModelTextForPart(part domain.Part, diff string, limits CompactFormatLimits) (string, bool)
CompactModelTextForPart returns a bounded text-only rendering of a stored result for compaction.
func CompactTextForCompaction ¶
func CompactTextForCompaction(text string, headLines int, tailLines int, maxBytes int, label string) string
CompactTextForCompaction trims text for a compaction prompt, keeping the first headLines and last tailLines lines and at most maxBytes bytes.
func DefaultSummarizeResult ¶
func DefinitionFor ¶
func DefinitionFor(kind ID, runtime Runtime) (provider.ToolDefinition, bool)
DefinitionFor returns the provider tool definition for a registered tool.
func Definitions ¶
func Definitions(runtime Runtime) []provider.ToolDefinition
func DeniedMessage ¶
func DisplayTextForStored ¶
func EnsureSessionTmpDir ¶
func EnsureSessionTmpDir(settings accesssettings.Settings) error
func FinalizeResult ¶
func FormatMilestoneOutput ¶
func FormatMilestoneOutput(result MilestonePlanStoredResult) string
func FormatTaskID ¶
func FormatTaskOutput ¶
func FormatTaskOutput(result TaskListStoredResult) string
func IsBuiltinID ¶
func ListDirectory ¶
func MCPImageStoredResultForPart ¶
MCPImageStoredResultForPart returns the first complete image emitted by a successful MCP tool call. Binary output remains out of model-visible text.
func ModelResultLimitBytes ¶
ModelResultLimitBytes caps any tool result in the model's context, as a backstop for tools that do not size their own output: a quarter of the context window, at most maxOutputBudgetBytes.
func NormalizeMediaArgs ¶
func NormalizePathInput ¶
func NormalizePathOrHTTPURL ¶
func OutputBudgetBytes ¶
OutputBudgetBytes sizes one tool output as a quarter of the context the chat has left, at about four bytes per token. usedTokens <= 0 means the usage is unknown and the whole window counts as free.
func ParseFlexibleInt ¶
func ReadTextFile ¶
func ReadablePath ¶
func RequireExecControl ¶
func RequireExecControl(runtime Runtime) (execruntime.Control, error)
func ResolvePath ¶
func ResolvePath(runtime Runtime, raw string, kind accesssettings.AccessKind) (abs string, label string, err error)
ResolvePath translates a path from the session's sandbox namespace to the host namespace and enforces the requested access against the resolved target.
func ScopedMilestonePlan ¶
func ShellResult ¶
func StoredResultInfoForPart ¶
func StoredResultInfoForPart(part domain.Part) (ID, StoredResultStatus, bool)
func SummarizePaths ¶
func TaskScopeAllows ¶
func WorkspacePath ¶
Types ¶
type ActionRoute ¶
ActionRoute maps one model-facing resource action to an existing operation. Keeping the operation as a normal registered tool preserves its validation, policy, result, and stored-history behavior during migrations.
type ActionTool ¶
type ActionTool struct {
Kind ID
Routes []ActionRoute
BypassPermissions bool
// RequirePersistedChat hides and rejects resources whose results need a
// durable client-visible destination.
RequirePersistedChat bool
// DefaultAction accepts historical calls that predate the action field when
// a canonical resource reuses an older single-operation name.
DefaultAction string
}
ActionTool exposes a coherent resource API while delegating each action to an existing operation handler. Its Parameters schema must contain an action string enum; unavailable actions are removed from that enum at definition time according to role, interaction mode, session settings, and runtime availability.
func (ActionTool) BypassesPermission ¶
func (t ActionTool) BypassesPermission() bool
func (ActionTool) Definition ¶
func (t ActionTool) Definition(runtime Runtime, spec ToolSpec) (ToolSpec, bool)
func (ActionTool) FinalizeResult ¶
func (ActionTool) ID ¶
func (t ActionTool) ID() ID
func (ActionTool) NormalizeArgs ¶
func (ActionTool) Presentation ¶
func (t ActionTool) Presentation(req Request) Presentation
func (ActionTool) Preview ¶
func (t ActionTool) Preview(req Request) string
func (ActionTool) SummarizeResult ¶
func (t ActionTool) SummarizeResult(req Request, result Result) (string, string)
type BashStoredResult ¶
type BrowserStoredResult ¶
type BrowserStoredResult struct {
Kind string `json:"kind"`
SessionID string `json:"session_id,omitempty"`
Path string `json:"path,omitempty"`
Summary string `json:"summary,omitempty"`
Text string `json:"text,omitempty"`
Attachment *attachment.Metadata `json:"attachment,omitempty"`
}
func BrowserStoredResultForPart ¶
func BrowserStoredResultForPart(part domain.Part) (BrowserStoredResult, bool)
type ChatListStoredResult ¶
type ChatListStoredResult struct {
Items []ChatStoredItem `json:"items,omitempty"`
}
type ChatStatusControl ¶
type ChatStatusControl interface {
SetChatActivity(context.Context, domain.ChatActivity) (domain.Chat, error)
}
ChatStatusControl updates durable descriptive activity for the owning chat.
func RequireChatStatusControl ¶
func RequireChatStatusControl(runtime Runtime) (ChatStatusControl, error)
RequireChatStatusControl returns the activity capability for the current chat.
type ChatStoredItem ¶
type ChatStoredItem struct {
ID id.ID `json:"id"`
Title string `json:"title"`
Role string `json:"role,omitempty"`
Backend string `json:"backend,omitempty"`
InteractionMode string `json:"interaction_mode,omitempty"`
ModelID string `json:"model_id,omitempty"`
PermissionProfile string `json:"permission_profile,omitempty"`
State string `json:"state,omitempty"`
Archived bool `json:"archived,omitempty"`
QueuedInputs int `json:"queued_inputs,omitempty"`
ActiveMilestoneKey string `json:"active_milestone_key,omitempty"`
AssignedTaskRef string `json:"assigned_task_ref,omitempty"`
StatusText string `json:"status_text,omitempty"`
Response string `json:"response,omitempty"`
}
type CompactFormatLimits ¶
type CompactFormatLimits struct {
MaxBytes int
HeadLines int
TailLines int
ReadMaxLines int
ExecHeadLines int
ExecTailLines int
}
CompactFormatLimits controls lossy text rendering for compaction prompts.
func DefaultCompactFormatLimits ¶
func DefaultCompactFormatLimits() CompactFormatLimits
DefaultCompactFormatLimits returns conservative limits for compaction input.
type DeniedError ¶
func (DeniedError) Error ¶
func (e DeniedError) Error() string
type DeniedStoredResult ¶
type DeniedStoredResult struct {
Message string `json:"message"`
}
type DiagnosticReportStored ¶
type DiagnosticReportStored struct {
Diagnostics []DiagnosticStored `json:"diagnostics,omitempty"`
Skipped []string `json:"skipped,omitempty"`
}
type DiagnosticStored ¶
type DiagnosticStored struct {
Source string `json:"source,omitempty"`
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
Severity string `json:"severity,omitempty"`
Tool string `json:"tool,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
type EditStoredHunk ¶
type EditStoredResult ¶
type EditStoredResult struct {
Path string `json:"path"`
ReplaceAll bool `json:"replace_all,omitempty"`
Occurrences int `json:"occurrences,omitempty"`
Summary string `json:"summary,omitempty"`
Matcher string `json:"matcher,omitempty"`
Verification string `json:"verification,omitempty"`
Diagnostics string `json:"diagnostics,omitempty"`
DiagnosticReport DiagnosticReportStored `json:"diagnostic_report,omitempty"`
Diff string `json:"diff,omitempty"`
Hunks []EditStoredHunk `json:"hunks,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
func EditStoredResultForPart ¶
func EditStoredResultForPart(part domain.Part) (EditStoredResult, bool)
type ErrorStoredResult ¶
type ErrorStoredResult struct {
Message string `json:"message"`
}
type ExecListStoredItem ¶
type ExecListStoredResult ¶
type ExecListStoredResult struct {
Scope string `json:"scope,omitempty"`
Message string `json:"message,omitempty"`
Items []ExecListStoredItem `json:"items,omitempty"`
}
type ExecProcess ¶
type ExecProcess struct {
ProcessID string `json:"process_id"`
Command string `json:"command"`
Workdir string `json:"workdir,omitempty"`
Shell string `json:"shell,omitempty"`
TTY bool `json:"tty,omitempty"`
State string `json:"state"`
ExitCode *int `json:"exit_code,omitempty"`
TimeoutMS int64 `json:"timeout_ms,omitempty"`
Output string `json:"output,omitempty"`
OutputBytes int `json:"output_bytes,omitempty"`
Stream []ExecProcessStreamEntry `json:"stream,omitempty"`
StdinClosed bool `json:"stdin_closed,omitempty"`
Lost bool `json:"lost,omitempty"`
}
type ExecProcessStreamEntry ¶
type ExecStoredResult ¶
type ExecStoredResult struct {
ProcessID string `json:"process_id"`
Command string `json:"command"`
Comment string `json:"comment,omitempty"`
Workdir string `json:"workdir,omitempty"`
Shell string `json:"shell,omitempty"`
TTY bool `json:"tty,omitempty"`
State string `json:"state"`
ExitCode *int `json:"exit_code,omitempty"`
TimeoutMS int64 `json:"timeout_ms,omitempty"`
Output string `json:"output,omitempty"`
OutputMode string `json:"output_mode,omitempty"`
OutputBytes int `json:"output_bytes,omitempty"`
// OmittedBytes counts output left out before Output by the size limit.
OmittedBytes int `json:"omitted_bytes,omitempty"`
StdinClosed bool `json:"stdin_closed,omitempty"`
// StateNote explains State in the model-facing text, e.g. that a
// command outlived exec_command's startup wait.
StateNote string `json:"state_note,omitempty"`
// Reporting says what a running session sends to the chat on its own.
Reporting string `json:"reporting,omitempty"`
Message string `json:"message,omitempty"`
}
type GlobStoredResult ¶
type GrepStoredResult ¶
type ID ¶
const ( FileRead ID = domain.ToolKindFileRead ViewImage ID = domain.ToolKindViewImage ViewPDF ID = domain.ToolKindViewPDF ShowImage ID = domain.ToolKindShowImage ShowMedia ID = domain.ToolKindShowMedia OfferFile ID = domain.ToolKindOfferFile FileGlob ID = domain.ToolKindFileGlob FileGrep ID = domain.ToolKindFileGrep CodeSearch ID = domain.ToolKindCodeSearch Lint ID = domain.ToolKindLint Bash ID = domain.ToolKindBash ExecCommand ID = domain.ToolKindExecCommand ExecSession ID = domain.ToolKindExecSession ExecStatus ID = domain.ToolKindExecStatus ExecList ID = domain.ToolKindExecList ExecWriteStdin ID = domain.ToolKindExecWriteStdin ExecResize ID = domain.ToolKindExecResize ExecTerminate ID = domain.ToolKindExecTerminate ExecCleanup ID = domain.ToolKindExecCleanup FileEdit ID = domain.ToolKindFileEdit FileWrite ID = domain.ToolKindFileWrite Task ID = domain.ToolKindTask Question ID = domain.ToolKindQuestion RequestUserInput ID = domain.ToolKindRequestUserInput Milestones ID = domain.ToolKindMilestones MilestoneList ID = domain.ToolKindMilestoneList MilestoneAdd ID = domain.ToolKindMilestoneAdd MilestoneUpdate ID = domain.ToolKindMilestoneUpdate MilestoneDepend ID = domain.ToolKindMilestoneDepend MilestoneArchive ID = domain.ToolKindMilestoneArchive MilestoneDelete ID = domain.ToolKindMilestoneDelete MilestonePlan ID = domain.ToolKindMilestonePlan MilestoneWrite ID = domain.ToolKindMilestoneWrite Tasks ID = domain.ToolKindTasks TaskList ID = domain.ToolKindTaskList TaskAddItems ID = domain.ToolKindTaskAddItems TaskUpdateItem ID = domain.ToolKindTaskUpdateItem TaskFetchNext ID = domain.ToolKindTaskFetchNext TaskArchive ID = domain.ToolKindTaskArchive TaskDelete ID = domain.ToolKindTaskDelete TasksAdd ID = domain.ToolKindTasksAdd TasksUpdate ID = domain.ToolKindTasksUpdate Chats ID = domain.ToolKindChats ChatList ID = domain.ToolKindChatList ChatStart ID = domain.ToolKindChatStart ChatSend ID = domain.ToolKindChatSend ChatCancel ID = domain.ToolKindChatCancel ChatArchive ID = domain.ToolKindChatArchive ChatRename ID = domain.ToolKindChatRename ChatCleanup ID = domain.ToolKindChatCleanup ChatStatus ID = domain.ToolKindChatStatus Sessions ID = domain.ToolKindSessions SessionList ID = domain.ToolKindSessionList SessionDelegate ID = domain.ToolKindSessionDelegate SessionStart ID = domain.ToolKindSessionStart Phone ID = domain.ToolKindPhone PhoneDevice ID = domain.ToolKindPhoneDevice PhoneLocation ID = domain.ToolKindPhoneLocation PhoneContacts ID = domain.ToolKindPhoneContacts PhoneCalendar ID = domain.ToolKindPhoneCalendar PhoneMessages ID = domain.ToolKindPhoneMessages PhoneCalls ID = domain.ToolKindPhoneCalls PhoneNotifications ID = domain.ToolKindPhoneNotifications PhoneClock ID = domain.ToolKindPhoneClock PhoneClipboard ID = domain.ToolKindPhoneClipboard PhoneApps ID = domain.ToolKindPhoneApps PhoneMedia ID = domain.ToolKindPhoneMedia PhoneOpen ID = domain.ToolKindPhoneOpen PhonePhotos ID = domain.ToolKindPhonePhotos PhonePhotosSearch ID = domain.ToolKindPhonePhotosSearch PhonePhotosThumbs ID = domain.ToolKindPhonePhotosThumbs PhonePhotoView ID = domain.ToolKindPhonePhotoView PhonePhotoTransfer ID = domain.ToolKindPhonePhotoTransfer PhoneLogs ID = domain.ToolKindPhoneLogs PhoneAlerts ID = domain.ToolKindPhoneAlerts Present ID = domain.ToolKindPresent PresentContentOld ID = domain.ToolKindPresentContentOld Skill ID = domain.ToolKindSkill WebFetch ID = domain.ToolKindWebFetch WebSearch ID = domain.ToolKindWebSearch Memory ID = domain.ToolKindMemory MCP ID = domain.ToolKindMCP BrowserStatus ID = domain.ToolKindBrowserStatus BrowserTask ID = domain.ToolKindBrowserTask BrowserTabs ID = domain.ToolKindBrowserTabs BrowserPage ID = domain.ToolKindBrowserPage BrowserInteract ID = domain.ToolKindBrowserInteract BrowserCapture ID = domain.ToolKindBrowserCapture BrowserNetwork ID = domain.ToolKindBrowserNetwork BrowserTabList ID = domain.ToolKindBrowserTabList BrowserTabNew ID = domain.ToolKindBrowserTabNew BrowserTabClaim ID = domain.ToolKindBrowserTabClaim BrowserTabSelect ID = domain.ToolKindBrowserTabSelect BrowserTabClose ID = domain.ToolKindBrowserTabClose BrowserBack ID = domain.ToolKindBrowserBack BrowserForward ID = domain.ToolKindBrowserForward BrowserReload ID = domain.ToolKindBrowserReload BrowserSnapshot ID = domain.ToolKindBrowserSnapshot BrowserFind ID = domain.ToolKindBrowserFind BrowserClick ID = domain.ToolKindBrowserClick BrowserFill ID = domain.ToolKindBrowserFill BrowserType ID = domain.ToolKindBrowserType BrowserPress ID = domain.ToolKindBrowserPress BrowserSelect ID = domain.ToolKindBrowserSelect BrowserCheck ID = domain.ToolKindBrowserCheck BrowserUncheck ID = domain.ToolKindBrowserUncheck BrowserHover ID = domain.ToolKindBrowserHover BrowserDrag ID = domain.ToolKindBrowserDrag BrowserScroll ID = domain.ToolKindBrowserScroll BrowserWait ID = domain.ToolKindBrowserWait BrowserUpload ID = domain.ToolKindBrowserUpload BrowserEvaluate ID = domain.ToolKindBrowserEvaluate BrowserScreenshot ID = domain.ToolKindBrowserScreenshot BrowserImage ID = domain.ToolKindBrowserImage BrowserPDF ID = domain.ToolKindBrowserPDF BrowserConsole ID = domain.ToolKindBrowserConsole BrowserRequests ID = domain.ToolKindBrowserRequests BrowserRequest ID = domain.ToolKindBrowserRequest BrowserResponseBody ID = domain.ToolKindBrowserResponseBody BrowserDownloads ID = domain.ToolKindBrowserDownloads BrowserDownloadsOld ID = domain.ToolKindBrowserDownloadsOld BrowserDownload ID = domain.ToolKindBrowserDownload )
func BuiltinIDs ¶
func BuiltinIDs() []ID
func RegisteredIDs ¶
func RegisteredIDs() []ID
type LintStoredResult ¶
type LintStoredResult struct {
Path string `json:"path"`
Mode string `json:"mode,omitempty"`
Summary string `json:"summary,omitempty"`
Diagnostics string `json:"diagnostics,omitempty"`
DiagnosticReport DiagnosticReportStored `json:"diagnostic_report,omitempty"`
}
type MCPExecutor ¶
type MCPStoredContentItem ¶
type MCPStoredContentItem struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
URI string `json:"uri,omitempty"`
MIMEType string `json:"mime_type,omitempty"`
Description string `json:"description,omitempty"`
Data []byte `json:"data,omitempty"`
Size int64 `json:"size,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
type MCPStoredResult ¶
type MCPStoredResult struct {
ServerID string `json:"server_id"`
ServerName string `json:"server_name,omitempty"`
ToolName string `json:"tool_name"`
StructuredContent string `json:"structured_content,omitempty"`
IsError bool `json:"is_error,omitempty"`
NeedsInput bool `json:"needs_input,omitempty"`
InputRequests string `json:"input_requests,omitempty"`
RequestState string `json:"request_state,omitempty"`
Content []MCPStoredContentItem `json:"content,omitempty"`
}
type MediaInput ¶
func DecodeMediaInputs ¶
func DecodeMediaInputs(value string) ([]MediaInput, error)
func MediaInputs ¶
func MediaInputs(args map[string]string) ([]MediaInput, error)
type MilestonePlanStoredResult ¶
type MilestonePlanStoredResult struct {
Summary string `json:"summary,omitempty"`
Milestones []MilestoneStoredItem `json:"milestones,omitempty"`
}
func MilestoneStoredResult ¶
func MilestoneStoredResult(plan planning.Plan) MilestonePlanStoredResult
func MilestoneStoredResultWithTaskSummaries ¶
func MilestoneStoredResultWithTaskSummaries(plan planning.Plan, summaries map[string]string) MilestonePlanStoredResult
type MilestoneStoredItem ¶
type MilestoneStoredItem struct {
ID id.ID `json:"id,omitempty"`
Key string `json:"key,omitempty"`
LegacyRef string `json:"ref,omitempty"`
Title string `json:"title"`
Status string `json:"status"`
Archived bool `json:"archived,omitempty"`
Notes string `json:"notes,omitempty"`
DependsOnKey string `json:"depends_on_key,omitempty"`
LegacyDependsOnKey string `json:"depends_on_ref,omitempty"`
OwnerChatID string `json:"owner_chat_id,omitempty"`
TaskSummary string `json:"task_summary,omitempty"`
}
type ModelImage ¶
type ModelImage struct {
Data []byte
SourcePath string
SessionID string
Attachment *attachment.Metadata
MIMEType string
}
ModelImage is an image a tool result hands to the model: inline Data, or a file at SourcePath, or an Attachment in SessionID's attachment store.
func ModelImageForPart ¶
func ModelImageForPart(part domain.Part) (ModelImage, bool)
ModelImageForPart returns the image a tool result gives the model, if any. It is the one definition of which tool results carry images: MCP image content, view_image and view_pdf results, and browser captures.
type OfferFileStoredResult ¶
type Options ¶
type Options struct {
Runtime Runtime
Request Request
// Progress, when set, shows the user what a long-running tool is doing.
// Each call replaces the previous report.
Progress func(domain.ToolProgress)
}
type PlanStoredStep ¶
type PlanUpdateStoredResult ¶
type PlanUpdateStoredResult struct {
Explanation string `json:"explanation,omitempty"`
Steps []PlanStoredStep `json:"steps"`
}
PlanUpdateStoredResult preserves rendering for historical plan-update parts. Koder no longer exposes a tool that creates these records.
type Presentation ¶
func PresentationForRequest ¶
func PresentationForRequest(req Request) Presentation
func PresentationForTool ¶
func PresentationForTool(kind ID, preview string) Presentation
func SharedPresentation ¶
func SharedPresentation(kind ID, preview string) Presentation
type PresentationStoredResult ¶
type PresentationStoredResult struct {
Title string `json:"title,omitempty"`
MIMEType string `json:"mime_type"`
Content string `json:"content"`
}
PresentationStoredResult is deliberate inline visual material for a voice client. It remains MIME-typed so clients can provide generic fallbacks.
type Presenter ¶
type Presenter interface {
Presentation(req Request) Presentation
}
type ProviderCallError ¶
func (ProviderCallError) Error ¶
func (e ProviderCallError) Error() string
func (ProviderCallError) Unwrap ¶
func (e ProviderCallError) Unwrap() error
type QuestionStoredResult ¶
type QuestionStoredResult struct {
Question string `json:"question,omitempty"`
Answers []UserInputAnswer `json:"answers,omitempty"`
}
type ReadStoredLine ¶
func ParseReadStoredLines ¶
func ParseReadStoredLines(output string) ([]ReadStoredLine, string)
type ReadStoredMode ¶
type ReadStoredMode string
const ( ReadStoredModeFile ReadStoredMode = "file" ReadStoredModeDirectory ReadStoredMode = "dir" )
type ReadStoredResult ¶
type ReadStoredResult struct {
Path string `json:"path"`
Mode ReadStoredMode `json:"mode"`
Lines []ReadStoredLine `json:"lines,omitempty"`
Entries []string `json:"entries,omitempty"`
StartLine string `json:"start_line,omitempty"`
EndLine string `json:"end_line,omitempty"`
Offset string `json:"offset,omitempty"`
Limit string `json:"limit,omitempty"`
Start int `json:"start,omitempty"`
End int `json:"end,omitempty"`
Total int `json:"total,omitempty"`
NextStartLine int `json:"next_start_line,omitempty"`
NextOffset int `json:"next_offset,omitempty"`
EffectiveLimit int `json:"effective_limit,omitempty"`
AutoCapped bool `json:"auto_capped,omitempty"`
RangeCapped bool `json:"range_capped,omitempty"`
ByteCapped bool `json:"byte_capped,omitempty"`
HasMore bool `json:"has_more,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
type RemoteMedia ¶
func FetchRemoteMedia ¶
type Request ¶
type Request struct {
Tool ID `json:"tool"`
ToolCallID string `json:"tool_call_id,omitempty"`
Args map[string]string `json:"-"`
}
func CanonicalRequest ¶
CanonicalRequest translates a historical operation call into the current resource/action shape for provider replay. Persisted data and execution keep their original identity; only newly built model context is canonicalized.
func RequestFromMeta ¶
func (Request) ArgumentsJSON ¶
func (Request) ContextString ¶
func (Request) Identity ¶
Identity returns the permission and observability identity for a request. Resource tools include their selected action so materially different effects remain distinguishable even though they share one model-facing tool name.
func (Request) MarshalJSON ¶
func (*Request) UnmarshalJSON ¶
type Result ¶
type Result = domain.ToolResult
func MilestonePlanResult ¶
func TaskBucketResult ¶
type Runtime ¶
type Runtime struct {
Workdir string
HTTPClient *http.Client
SessionID id.ID
SessionKind domain.SessionKind
ChatID id.ID
// ChatProviderID and ChatModelID name the chat's model, for tools
// that ask it for help, such as pulling facts out of web pages.
ChatProviderID string
ChatModelID string
ChatRole chatrole.Role
InteractionMode chatinteraction.Mode
ActiveMilestoneKey string
AssignedTaskBucketKey string
AssignedTaskRef string
SessionControl SessionControl
TaskControl TaskControl
ChatStatusControl ChatStatusControl
Services map[string]any
AllowedTools map[ID]bool
ManagedSkillsDir string
DisabledSkillPaths []string
SkillCatalogMaxChars int
Exec execruntime.Control
MCP MCPExecutor
Browser browserapi.Service
Attachments *attachment.Manager
OfferedFiles *offeredfile.Manager
FileTracker FileTracker
AccessSettings accesssettings.Settings
// Memory holds the notes the model keeps across chats.
Memory *memory.Store
// OutputBudgetBytes bounds one tool's output by the room left in the
// model's context; zero means unknown and tools use their own default.
OutputBudgetBytes int
}
func (Runtime) CheckNetworkAccess ¶
func (Runtime) SessionTmpDir ¶
func (Runtime) SkillOptions ¶
func (r Runtime) SkillOptions() skills.DiscoverOptions
SkillOptions returns the skill discovery options for this runtime.
func (Runtime) VoiceInteraction ¶
VoiceInteraction reports whether tools are being offered to a voice conversation. The legacy role fallback keeps stored/test callers compatible while voice migrates to an orthogonal interaction mode.
type SessionControl ¶
type SessionControl interface {
GetMilestonePlan(context.Context, id.ID) (planning.Plan, error)
SetMilestonePlan(context.Context, id.ID, string, []planning.Milestone) (planning.Plan, error)
ArchiveMilestone(context.Context, id.ID, string, bool) (planning.Milestone, error)
DeleteMilestone(context.Context, id.ID, string) error
AddTasks(context.Context, id.ID, string, []string) ([]planning.Task, error)
UpdateTask(context.Context, string, planning.TaskStatus, string, string) (planning.Task, error)
ArchiveTask(context.Context, string, bool) (planning.Task, error)
DeleteTask(context.Context, string) error
ListTasks(context.Context, id.ID, string) ([]planning.Task, error)
}
func RequireSessionControl ¶
func RequireSessionControl(runtime Runtime) (SessionControl, error)
type ShowImageStoredResult ¶
type ShowImageStoredResult = ShowMediaStoredResult
ShowImageStoredResult is retained for decoding old show_image results.
func ShowImageStoredResultForPart ¶
func ShowImageStoredResultForPart(part domain.Part) (ShowImageStoredResult, bool)
type ShowMediaStoredItem ¶
type ShowMediaStoredItem struct {
Path string `json:"path"`
SourcePath string `json:"source_path,omitempty"`
MIMEType string `json:"mime_type"`
MediaKind string `json:"media_kind,omitempty"`
Title string `json:"title,omitempty"`
SessionID string `json:"session_id,omitempty"`
Attachment *attachment.Metadata `json:"attachment,omitempty"`
}
type ShowMediaStoredResult ¶
type ShowMediaStoredResult struct {
Path string `json:"path"`
SourcePath string `json:"source_path,omitempty"`
MIMEType string `json:"mime_type"`
MediaKind string `json:"media_kind,omitempty"`
Title string `json:"title,omitempty"`
SessionID string `json:"session_id,omitempty"`
Attachment *attachment.Metadata `json:"attachment,omitempty"`
Summary string `json:"summary,omitempty"`
Items []ShowMediaStoredItem `json:"items,omitempty"`
Errors []string `json:"errors,omitempty"`
}
func ShowMediaStoredResultForPart ¶
func ShowMediaStoredResultForPart(part domain.Part) (ShowMediaStoredResult, bool)
type SkillStoredResult ¶
type SkillStoredResult struct {
Name string `json:"name"`
Path string `json:"path"`
Content string `json:"content,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
func (SkillStoredResult) ModelText ¶
func (result SkillStoredResult) ModelText() string
ModelText adds runtime location context that a portable SKILL.md cannot know ahead of time. This lets the model use bundled scripts and references directly instead of searching the filesystem to rediscover the loaded skill directory.
type StoredResultPayload ¶
type StoredResultPayload interface {
// contains filtered or unexported methods
}
type StoredResultStatus ¶
type StoredResultStatus string
const ( StoredResultStatusOK StoredResultStatus = "ok" StoredResultStatusDenied StoredResultStatus = "denied" StoredResultStatusError StoredResultStatus = "error" )
type TaskControl ¶
type TaskControl interface {
AddTask(context.Context, id.ID, string, planning.LegacyTaskStatus) (planning.LegacyTask, error)
}
func RequireTaskControl ¶
func RequireTaskControl(runtime Runtime) (TaskControl, error)
type TaskListStoredResult ¶
type TaskListStoredResult struct {
MilestoneKey string `json:"milestone_key,omitempty"`
LegacyMilestoneKey string `json:"milestone_ref,omitempty"`
MilestoneTitle string `json:"milestone_title,omitempty"`
Message string `json:"message,omitempty"`
Items []TaskStoredItem `json:"items,omitempty"`
}
type TaskStoredItem ¶
type TaskStoredResult ¶
type TaskStoredResult struct {
Body string `json:"body"`
Status planning.LegacyTaskStatus `json:"status"`
}
type Tool ¶
type ToolInt ¶
type ToolInt int
ToolInt is the canonical integer representation used by tool arguments.
func ParseToolInt ¶
ParseToolInt accepts JSON integer syntax and integral decimal/exponent forms sometimes emitted by providers, such as "2000.00000" and "2e3".
type ToolSpec ¶
type ToolSpec struct {
Title string
Description string
Usage string
Parameters string
ExposeToLLM bool
// Legacy keeps a tool executable for stored transcripts and compatibility
// while excluding its definition from new model requests.
Legacy bool
}
ToolSpec describes a registered tool for local presentation and LLM exposure.
type UserInputAnswer ¶
type UserInputOption ¶
type UserInputQuestion ¶
type UserInputQuestion struct {
ID string `json:"id"`
Header string `json:"header"`
Question string `json:"question"`
Options []UserInputOption `json:"options"`
}
func ParseUserInputQuestions ¶
func ParseUserInputQuestions(raw string) ([]UserInputQuestion, error)
type ViewImageStoredResult ¶
type ViewImageStoredResult struct {
Path string `json:"path"`
SourcePath string `json:"source_path,omitempty"`
MIMEType string `json:"mime_type"`
Detail string `json:"detail,omitempty"`
SessionID string `json:"session_id,omitempty"`
Attachment *attachment.Metadata `json:"attachment,omitempty"`
Summary string `json:"summary,omitempty"`
Page int `json:"page,omitempty"`
PageCount int `json:"page_count,omitempty"`
}
func ViewImageStoredResultForPart ¶
func ViewImageStoredResultForPart(part domain.Part) (ViewImageStoredResult, bool)
type WebFetchStoredResult ¶
type WebFetchStoredResult struct {
URL string `json:"url"`
FinalURL string `json:"final_url,omitempty"`
Format string `json:"format,omitempty"`
Status int `json:"status"`
ContentType string `json:"content_type,omitempty"`
Body string `json:"body,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
type WebSearchStoredItem ¶
type WebSearchStoredResult ¶
type WebSearchStoredResult struct {
Query string `json:"query"`
AllowedDomains string `json:"allowed_domains,omitempty"`
BlockedDomains string `json:"blocked_domains,omitempty"`
Items []WebSearchStoredItem `json:"items,omitempty"`
}
type WriteStoredResult ¶
type WriteStoredResult struct {
Path string `json:"path"`
Action string `json:"action,omitempty"`
Summary string `json:"summary,omitempty"`
Content string `json:"content,omitempty"`
Diagnostics string `json:"diagnostics,omitempty"`
DiagnosticReport DiagnosticReportStored `json:"diagnostic_report,omitempty"`
Truncated bool `json:"truncated,omitempty"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package chatstatustool publishes descriptive chat activity to users and coordinators.
|
Package chatstatustool publishes descriptive chat activity to users and coordinators. |
|
Package memorytool lets the model read and keep notes across chats.
|
Package memorytool lets the model read and keep notes across chats. |