v0.3.58 532d7f6

openrouter_server.go RawHistoryFolder

1package tools
2
3import (
4	"context"
5	"encoding/json"
6	"fmt"
7
8	"github.com/patriceckhart/zot/packages/core"
9	"github.com/patriceckhart/zot/packages/provider"
10)
11
12// OpenRouterServerToolCallLimit bounds the remote agent loop when zot
13// advertises OpenRouter server tools.
14const OpenRouterServerToolCallLimit = 4
15
16// OpenRouterServerToolNames lists every OpenRouter server tool that zot
17// can advertise on Chat Completions. Shell, bash, apply_patch, and
18// tool_search require Responses/Messages and are omitted here.
19func OpenRouterServerToolNames() []string {
20	return []string{
21		"openrouter:web_search",
22		"openrouter:web_fetch",
23		"openrouter:advisor",
24		"openrouter:subagent",
25		"openrouter:fusion",
26		"openrouter:image_generation",
27		"openrouter:datetime",
28		"openrouter:experimental__search_models",
29	}
30}
31
32// IsOpenRouterServerTool reports whether name is an OpenRouter server tool
33// that zot may inject into the live registry.
34func IsOpenRouterServerTool(name string) bool {
35	for _, n := range OpenRouterServerToolNames() {
36		if n == name {
37			return true
38		}
39	}
40	return false
41}
42
43// OpenRouterServerTool is a stub advertised to the model so OpenRouter
44// can execute the matching server tool. The agent never runs it locally.
45type OpenRouterServerTool struct {
46	name        string
47	description string
48	schema      json.RawMessage
49}
50
51func (t *OpenRouterServerTool) Name() string            { return t.name }
52func (t *OpenRouterServerTool) Description() string     { return t.description }
53func (t *OpenRouterServerTool) Schema() json.RawMessage { return t.schema }
54
55func (t *OpenRouterServerTool) Execute(context.Context, json.RawMessage, func(string)) (core.ToolResult, error) {
56	return core.ToolResult{
57		Content: []provider.Content{provider.TextBlock{Text: fmt.Sprintf("%s is executed by OpenRouter, not locally", t.name)}},
58		IsError: true,
59	}, nil
60}
61
62// OpenRouterServerTools returns stubs for every Chat Completions-capable
63// OpenRouter server tool.
64func OpenRouterServerTools() []core.Tool {
65	return []core.Tool{
66		&OpenRouterServerTool{
67			name:        "openrouter:web_search",
68			description: "Search the web for current information. Executed by OpenRouter.",
69		},
70		&OpenRouterServerTool{
71			name:        "openrouter:web_fetch",
72			description: "Fetch and extract content from a URL. Executed by OpenRouter.",
73		},
74		&OpenRouterServerTool{
75			name:        "openrouter:advisor",
76			description: "Consult a stronger model for guidance mid-generation. Executed by OpenRouter.",
77			schema:      json.RawMessage(`{"model":"openai/gpt-4.1-mini"}`),
78		},
79		&OpenRouterServerTool{
80			name:        "openrouter:subagent",
81			description: "Delegate a self-contained task to a smaller worker model. Executed by OpenRouter.",
82			schema:      json.RawMessage(`{"model":"openai/gpt-4.1-mini"}`),
83		},
84		&OpenRouterServerTool{
85			name:        "openrouter:fusion",
86			description: "Run a panel of models and an analyst for multi-model analysis. Executed by OpenRouter.",
87		},
88		&OpenRouterServerTool{
89			name:        "openrouter:image_generation",
90			description: "Generate an image from a text prompt. Executed by OpenRouter.",
91		},
92		&OpenRouterServerTool{
93			name:        "openrouter:datetime",
94			description: "Get the current date and time. Executed by OpenRouter.",
95		},
96		&OpenRouterServerTool{
97			name:        "openrouter:experimental__search_models",
98			description: "Search and filter the OpenRouter model catalog. Executed by OpenRouter.",
99			schema:      json.RawMessage(`{"max_results":5}`),
100		},
101	}
102}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 477

↑↓ moveenter openesc close