runtime

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ToolSearchToolName = "tool_search"

ToolSearchToolName is the search tool injected into the initial tool list (E2).

Variables

This section is empty.

Functions

func NewCommandTool

func NewCommandTool(workspace string) types.Tool

func NewJobKillTool

func NewJobKillTool() types.Tool

func NewJobOutputTool

func NewJobOutputTool() types.Tool

func NewQuestionTool added in v1.6.16

func NewQuestionTool() types.Tool

Types

type CommandTool

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

func (*CommandTool) Description

func (t *CommandTool) Description() string

func (*CommandTool) Execute

func (t *CommandTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)

func (*CommandTool) Metadata

func (t *CommandTool) Metadata() types.ToolMetadata

func (*CommandTool) Name

func (t *CommandTool) Name() string

func (*CommandTool) Schema

func (t *CommandTool) Schema() map[string]interface{}

type DiscoverResult added in v1.10.0

type DiscoverResult struct {
	// Matched tools (name/description/category), sorted by relevance.
	Results []SearchResult `json:"results"`
	// Discovered lists the tool names injected into the next turn's tool list.
	Discovered []string `json:"discovered,omitempty"`
	// LimitReached is true when the session-level discovery cap was hit and no
	// more tools can be injected (R1).
	LimitReached bool `json:"limit_reached,omitempty"`
}

DiscoverResult is the structured payload returned by tool_search. `discovered` lists the tool names that became available starting the next turn (pure hint under mechanism A — injection already happened inside Execute).

type JobKillTool

type JobKillTool struct{}

func (*JobKillTool) Description

func (t *JobKillTool) Description() string

func (*JobKillTool) Execute

func (t *JobKillTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)

func (*JobKillTool) Metadata

func (t *JobKillTool) Metadata() types.ToolMetadata

func (*JobKillTool) Name

func (t *JobKillTool) Name() string

func (*JobKillTool) Schema

func (t *JobKillTool) Schema() map[string]interface{}

type JobOutputTool

type JobOutputTool struct{}

func (*JobOutputTool) Description

func (t *JobOutputTool) Description() string

func (*JobOutputTool) Execute

func (t *JobOutputTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)

func (*JobOutputTool) Metadata

func (t *JobOutputTool) Metadata() types.ToolMetadata

func (*JobOutputTool) Name

func (t *JobOutputTool) Name() string

func (*JobOutputTool) Schema

func (t *JobOutputTool) Schema() map[string]interface{}

type QuestionTool added in v1.6.16

type QuestionTool struct{}

func (*QuestionTool) Description added in v1.6.16

func (t *QuestionTool) Description() string

func (*QuestionTool) Execute added in v1.6.16

func (t *QuestionTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)

This tool is special. It's handled by the agent runner, not executed directly. The agent should see this tool and halt execution, passing the question to the UI. The Execute function here is a fallback and should indicate that it needs special handling.

func (*QuestionTool) Metadata added in v1.6.16

func (t *QuestionTool) Metadata() types.ToolMetadata

func (*QuestionTool) Name added in v1.6.16

func (t *QuestionTool) Name() string

func (*QuestionTool) Schema added in v1.6.16

func (t *QuestionTool) Schema() map[string]interface{}

type SearchInfo added in v1.10.0

type SearchInfo struct {
	Keywords []string // 额外关键词(除 Name/Description 外的同义词、动作词)
	Category string   // 分组:e.g. "mcp:github", "memory"
	// SearchOnly 预留:true 表示仅可搜索(默认 false,发现后也可调用)。
	SearchOnly bool
}

SearchInfo 工具的搜索元信息(E2)。

type SearchResult added in v1.10.0

type SearchResult struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Category    string `json:"category,omitempty"`
}

SearchResult 返回给模型的命中项。

type SearchableTool added in v1.10.0

type SearchableTool interface {
	SearchInfo() SearchInfo
}

SearchableTool 声明工具可被 tool_search 按关键词检索。实现方返回搜索信息。 不实现此接口的 Deferred 工具回退用 Name+Description 分词 (ToolMetadata.SearchKeywords 优先于 Description 分词)。

type SentinelQuestionResult added in v1.10.0

type SentinelQuestionResult struct {
	Ok       bool   `json:"ok"`
	Question string `json:"question"`
	AskUser  bool   `json:"ask_user"`
}

SentinelQuestionResult is the structured payload QuestionTool.Execute returns (option A of the F7 design): instead of hard-erroring, it reports that the question must be surfaced to the user and that the agent loop should not continue waiting on a result it cannot produce. dino's runner is expected to detect this shape and emit an EventTypeQuestion; until then the sentinel is at least not a fatal error.

type ToolSearchIndex added in v1.10.0

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

ToolSearchIndex 简单的 token → tool 倒排 + 词频评分(轻量替代 BM25)。 只索引 Deferred 工具(E2);对工具名检索("github"/"memory"/"search")足够, 无 BM25 的 IDF。可选第二阶段换 BM25。

func NewToolSearchIndex added in v1.10.0

func NewToolSearchIndex(tools []types.Tool) *ToolSearchIndex

NewToolSearchIndex builds the inverted index from the given tools. Deferred tools not implementing SearchableTool fall back to Name + Description (+ ToolMetadata.SearchKeywords).

func (*ToolSearchIndex) Search added in v1.10.0

func (ix *ToolSearchIndex) Search(query string, max int) []SearchResult

Search returns up to max results, sorted by score descending. No match returns an empty slice (never an error).

type ToolSearchTool added in v1.10.0

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

ToolSearchTool 检索所有 Deferred 工具并返回匹配(E2 轻量版)。 发现逻辑(把命中的工具注入 ae.tools)由 factory 在构造时经 SetDiscover 注入 Execute 闭包完成(机制 A,见 docs/design/tools-codex-eval.md §3.3)。

func NewToolSearchTool added in v1.10.0

func NewToolSearchTool(index *ToolSearchIndex) *ToolSearchTool

NewToolSearchTool creates a tool_search bound to the given index.

func (*ToolSearchTool) Description added in v1.10.0

func (t *ToolSearchTool) Description() string

func (*ToolSearchTool) Execute added in v1.10.0

func (t *ToolSearchTool) Execute(ctx context.Context, input map[string]interface{}) (interface{}, error)

func (*ToolSearchTool) Metadata added in v1.10.0

func (t *ToolSearchTool) Metadata() types.ToolMetadata

func (*ToolSearchTool) Name added in v1.10.0

func (t *ToolSearchTool) Name() string

func (*ToolSearchTool) Schema added in v1.10.0

func (t *ToolSearchTool) Schema() map[string]interface{}

func (*ToolSearchTool) SetDiscover added in v1.10.0

func (t *ToolSearchTool) SetDiscover(fn func(ctx context.Context, name string) error)

SetDiscover wires the discovery callback. Called by dino/factory at session construction; nil is a no-op (tool still searches but never injects).

Jump to

Keyboard shortcuts

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