opencode-agent-variants 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +257 -0
- package/agent-variants.example.jsonc +96 -0
- package/dist/config.d.ts +211 -0
- package/dist/config.js +227 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +406 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +5 -0
- package/dist/tui.d.ts +6 -0
- package/dist/tui.js +849 -0
- package/docs/CONFIG.md +134 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Agent Variants contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# OpenCode Agent Variants
|
|
2
|
+
|
|
3
|
+
OpenCode Agent Variants creates model-specific versions of your agents without copying prompts by hand.
|
|
4
|
+
|
|
5
|
+
Use it when you want the main model to choose between agents like:
|
|
6
|
+
|
|
7
|
+
- `general` for the default or strongest model
|
|
8
|
+
- `general-light` for a cheaper/faster model
|
|
9
|
+
- `explore` for normal codebase exploration
|
|
10
|
+
- `explore-light` for routine exploration on a smaller model
|
|
11
|
+
|
|
12
|
+
The plugin adds generated variants to OpenCode's normal `task` tool list and provides one TUI wizard for editing the variant config.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Generate variants from existing agents with model, temperature, prompt, description, options, and color overrides.
|
|
17
|
+
- Keep OpenCode's built-in agent prompts and permissions up to date by routing built-in variants to their native parent agent.
|
|
18
|
+
- Create real copied variants for agents defined in config or markdown.
|
|
19
|
+
- Manage variants from a single TUI command: `Agent Variants: Configure`.
|
|
20
|
+
- Store all plugin settings in a sidecar file instead of editing `opencode.json` for every variant.
|
|
21
|
+
- Avoid agent-tool pollution: the plugin does not register management tools for the assistant.
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Install it with OpenCode's plugin installer:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
opencode plugin opencode-agent-variants --global
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The installer detects both plugin targets and updates the right config files:
|
|
32
|
+
|
|
33
|
+
- server target in `opencode.json` or `opencode.jsonc`
|
|
34
|
+
- TUI target in `tui.json` or `tui.jsonc`
|
|
35
|
+
|
|
36
|
+
Restart OpenCode after installation.
|
|
37
|
+
|
|
38
|
+
## Manual Install
|
|
39
|
+
|
|
40
|
+
If you prefer to configure it manually, add the package to your OpenCode config:
|
|
41
|
+
|
|
42
|
+
```jsonc
|
|
43
|
+
{
|
|
44
|
+
"plugin": ["opencode-agent-variants"]
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
And add the same package to your TUI config:
|
|
49
|
+
|
|
50
|
+
```jsonc
|
|
51
|
+
{
|
|
52
|
+
"plugin": ["opencode-agent-variants"]
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
For local development, use a file URL or local path instead of the npm package name.
|
|
57
|
+
|
|
58
|
+
## Wizard
|
|
59
|
+
|
|
60
|
+
Open the wizard from the command palette:
|
|
61
|
+
|
|
62
|
+
```txt
|
|
63
|
+
Agent Variants: Configure
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If your TUI build exposes plugin slash commands, you can also run:
|
|
67
|
+
|
|
68
|
+
```txt
|
|
69
|
+
/agent-variants
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The wizard supports:
|
|
73
|
+
|
|
74
|
+
- adding variants
|
|
75
|
+
- editing parent overrides
|
|
76
|
+
- editing variant overrides
|
|
77
|
+
- enabling or disabling parents and variants
|
|
78
|
+
- toggling debug mode
|
|
79
|
+
- running diagnostics
|
|
80
|
+
- viewing and clearing the debug log
|
|
81
|
+
- deleting variants
|
|
82
|
+
- previewing the generated config
|
|
83
|
+
- saving changes with timestamped backups
|
|
84
|
+
|
|
85
|
+
Agent/variant list changes take effect after restarting OpenCode because agents and plugins are assembled at startup. Debug mode is hot-read and takes effect immediately after the wizard saves it.
|
|
86
|
+
|
|
87
|
+
## Config File
|
|
88
|
+
|
|
89
|
+
The plugin writes a sidecar config file at:
|
|
90
|
+
|
|
91
|
+
```txt
|
|
92
|
+
~/.config/opencode/agent-variants.jsonc
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This file is separate from `opencode.json`. Your normal OpenCode config remains the source of truth for providers, base agents, permissions, and any explicit model overrides you already have.
|
|
96
|
+
|
|
97
|
+
See `docs/CONFIG.md` for the complete config reference and `agent-variants.example.jsonc` for a fully commented starter file.
|
|
98
|
+
|
|
99
|
+
## Example
|
|
100
|
+
|
|
101
|
+
```jsonc
|
|
102
|
+
{
|
|
103
|
+
"debug": false,
|
|
104
|
+
"models": {
|
|
105
|
+
"light": {
|
|
106
|
+
"model": "zai-coding-plan/glm-5.1",
|
|
107
|
+
"label": "GLM 5.1"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"agents": {
|
|
111
|
+
"general": {
|
|
112
|
+
"parent": {
|
|
113
|
+
"description_append": "Uses the default smartest model. Expensive; use for hard tasks."
|
|
114
|
+
},
|
|
115
|
+
"variants": {
|
|
116
|
+
"light": {
|
|
117
|
+
"model": "light",
|
|
118
|
+
"description_append": "Use for most tasks that do not need the best model."
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"explore": {
|
|
123
|
+
"parent": {
|
|
124
|
+
"description_append": "Uses the default smartest model. Use for difficult investigations."
|
|
125
|
+
},
|
|
126
|
+
"variants": {
|
|
127
|
+
"light": {
|
|
128
|
+
"model": "light",
|
|
129
|
+
"description_append": "Use for most code search, reading, and exploration tasks."
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Variant names default to `${parent}-${variantKey}`. In the example above, `general` plus variant key `light` becomes `general-light`.
|
|
138
|
+
|
|
139
|
+
Description and prompt fields support template variables such as `{parent}`, `{alias}`, `{variant_key}`, `{model}`, `{model_label}`, and `{routed_agent}`.
|
|
140
|
+
|
|
141
|
+
## Supported Fields
|
|
142
|
+
|
|
143
|
+
Parents and variants support these fields:
|
|
144
|
+
|
|
145
|
+
- `model`
|
|
146
|
+
- `variant`
|
|
147
|
+
- `temperature`
|
|
148
|
+
- `top_p`
|
|
149
|
+
- `prompt`
|
|
150
|
+
- `prompt_prepend`
|
|
151
|
+
- `prompt_append`
|
|
152
|
+
- `description`
|
|
153
|
+
- `description_prepend`
|
|
154
|
+
- `description_append`
|
|
155
|
+
- `options`
|
|
156
|
+
- `color`
|
|
157
|
+
- `disable`
|
|
158
|
+
|
|
159
|
+
Variants also support:
|
|
160
|
+
|
|
161
|
+
- `name`
|
|
162
|
+
|
|
163
|
+
`permission`, `tools`, and `mode` are inherited from the parent and are intentionally not configured in the sidecar.
|
|
164
|
+
|
|
165
|
+
## Built-In Agents
|
|
166
|
+
|
|
167
|
+
Built-in agents such as `general` and `explore` cannot be copied externally without vendoring OpenCode internals. For these agents, the plugin creates a virtual alias:
|
|
168
|
+
|
|
169
|
+
- The variant appears in the task tool list.
|
|
170
|
+
- The main model can call `task` once with the variant name.
|
|
171
|
+
- The plugin routes the call to the native parent before execution.
|
|
172
|
+
- The plugin applies configured model, request parameter, and explicit prompt overrides.
|
|
173
|
+
- The plugin annotates task result metadata/output with the selected variant alias, routed native agent, and effective model.
|
|
174
|
+
|
|
175
|
+
This preserves native prompts and permissions. The child session may internally show the parent agent name for built-in variants; that is expected.
|
|
176
|
+
|
|
177
|
+
## Config Agents
|
|
178
|
+
|
|
179
|
+
Agents defined in `opencode.json`, `.opencode/agent/*.md`, or global agent markdown can be copied directly. Their variants are real generated config agents with the supported overrides applied.
|
|
180
|
+
|
|
181
|
+
## Disable Rules
|
|
182
|
+
|
|
183
|
+
- If the parent is disabled in OpenCode config, variants are skipped.
|
|
184
|
+
- If a sidecar parent has `disable: true`, the parent override and all variants are skipped.
|
|
185
|
+
- If a variant has `disable: true`, only that variant is skipped.
|
|
186
|
+
- Parent overrides apply only when the parent has at least one enabled variant.
|
|
187
|
+
- If a variant resolves to a definitely missing model, it is skipped for that run and a warning toast is shown.
|
|
188
|
+
- Conflicting aliases are skipped instead of overwriting existing agents.
|
|
189
|
+
|
|
190
|
+
Use the wizard's `Run diagnostics` action to inspect model validation, alias conflicts, disabled parents, and plugin installation state.
|
|
191
|
+
|
|
192
|
+
## Debug Mode
|
|
193
|
+
|
|
194
|
+
Debug mode is off by default. Enable it from the wizard with `Debug mode: off`.
|
|
195
|
+
|
|
196
|
+
When enabled, the server plugin emits diagnostic log lines and TUI toast notifications for built-in virtual variants:
|
|
197
|
+
|
|
198
|
+
- when a variant is routed, such as `general-light -> general`
|
|
199
|
+
- the short internal route token used for correlation
|
|
200
|
+
- the target model and model variant
|
|
201
|
+
- when the model override is applied to the child session message
|
|
202
|
+
|
|
203
|
+
Logs are written to `~/.config/opencode/agent-variants.debug.log`. The plugin does not write debug lines to stdout, because that can corrupt the terminal UI.
|
|
204
|
+
|
|
205
|
+
Debug mode is stored in `agent-variants.jsonc` and takes effect immediately for future variant calls. The wizard can also view and clear the debug log.
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
Install dependencies:
|
|
210
|
+
|
|
211
|
+
```sh
|
|
212
|
+
npm install
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Typecheck:
|
|
216
|
+
|
|
217
|
+
```sh
|
|
218
|
+
npm run typecheck
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Build:
|
|
222
|
+
|
|
223
|
+
```sh
|
|
224
|
+
npm run build
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Check package contents before publishing:
|
|
228
|
+
|
|
229
|
+
```sh
|
|
230
|
+
npm pack --dry-run
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Release
|
|
234
|
+
|
|
235
|
+
CI runs on pushes and pull requests. It installs with `npm ci`, typechecks, builds, and verifies package contents with `npm pack --dry-run`.
|
|
236
|
+
|
|
237
|
+
Automated releases run when a version tag is pushed:
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
git tag v0.1.0
|
|
241
|
+
git push origin v0.1.0
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
The release workflow:
|
|
245
|
+
|
|
246
|
+
- installs dependencies
|
|
247
|
+
- typechecks
|
|
248
|
+
- builds `dist`
|
|
249
|
+
- verifies package contents
|
|
250
|
+
- publishes to npm with provenance
|
|
251
|
+
- creates a GitHub release with generated notes
|
|
252
|
+
|
|
253
|
+
Before the first automated publish, add an npm automation token as the repository secret `NPM_TOKEN`.
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Toggle route/model diagnostics. This can be changed from the wizard and
|
|
3
|
+
// takes effect immediately for future variant calls. Logs are written to
|
|
4
|
+
// ~/.config/opencode/agent-variants.debug.log.
|
|
5
|
+
"debug": false,
|
|
6
|
+
|
|
7
|
+
// Optional model shortcuts. Variants can use either a shortcut key like
|
|
8
|
+
// "light" or a full provider/model reference like "anthropic/claude-sonnet-4-6".
|
|
9
|
+
"models": {
|
|
10
|
+
"light": {
|
|
11
|
+
"model": "zai-coding-plan/glm-5.1",
|
|
12
|
+
"label": "GLM 5.1"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// "heavy": {
|
|
16
|
+
// "model": "anthropic/claude-opus-4-5",
|
|
17
|
+
// "label": "Opus 4.5"
|
|
18
|
+
// }
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
"agents": {
|
|
22
|
+
// Built-in agents are virtual-routed. The model sees general-light, but
|
|
23
|
+
// OpenCode executes native general to preserve the native prompt and permissions.
|
|
24
|
+
"general": {
|
|
25
|
+
// Disable the whole parent entry and all variants without deleting them.
|
|
26
|
+
// "disable": true,
|
|
27
|
+
|
|
28
|
+
"parent": {
|
|
29
|
+
// Parent fields apply only when this parent has at least one enabled variant.
|
|
30
|
+
"description_append": "Uses the default strongest model. Use for the hardest tasks."
|
|
31
|
+
|
|
32
|
+
// Optional parent overrides:
|
|
33
|
+
// "model": "heavy",
|
|
34
|
+
// "variant": "default",
|
|
35
|
+
// "temperature": 0.2,
|
|
36
|
+
// "top_p": 0.9,
|
|
37
|
+
// "prompt": "Replace the parent prompt/system prompt.",
|
|
38
|
+
// "prompt_prepend": "Text before the parent prompt/system prompt.",
|
|
39
|
+
// "prompt_append": "Text after the parent prompt/system prompt.",
|
|
40
|
+
// "description": "Replace the parent description.",
|
|
41
|
+
// "description_prepend": "Text before the parent description.",
|
|
42
|
+
// "options": { "reasoningEffort": "high" },
|
|
43
|
+
// "color": "primary"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"variants": {
|
|
47
|
+
"light": {
|
|
48
|
+
// Variant names default to parent-key, so this becomes general-light.
|
|
49
|
+
// "name": "general-cheap",
|
|
50
|
+
"model": "light",
|
|
51
|
+
"description_append": "Use {alias} for most tasks that do not need {parent}'s strongest model. Runs on {model_label}."
|
|
52
|
+
|
|
53
|
+
// Optional variant overrides:
|
|
54
|
+
// "variant": "default",
|
|
55
|
+
// "temperature": 0.1,
|
|
56
|
+
// "top_p": 0.95,
|
|
57
|
+
// "prompt": "Replace the prompt/system prompt for this variant only.",
|
|
58
|
+
// "prompt_prepend": "Text before this variant prompt/system prompt.",
|
|
59
|
+
// "prompt_append": "Text after this variant prompt/system prompt.",
|
|
60
|
+
// "description": "Replace the generated copy-of description.",
|
|
61
|
+
// "description_prepend": "Text before the generated description.",
|
|
62
|
+
// "options": { "reasoningEffort": "medium" },
|
|
63
|
+
// "color": "secondary",
|
|
64
|
+
// "disable": true
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Another built-in example.
|
|
70
|
+
"explore": {
|
|
71
|
+
"parent": {
|
|
72
|
+
"description_append": "Uses the default strongest model. Use for difficult investigations."
|
|
73
|
+
},
|
|
74
|
+
"variants": {
|
|
75
|
+
"light": {
|
|
76
|
+
"model": "light",
|
|
77
|
+
"description_append": "Use for most code search, reading, and exploration tasks."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// Config/markdown agents can be copied directly when they exist in OpenCode config.
|
|
83
|
+
// "frontend-designer": {
|
|
84
|
+
// "parent": {
|
|
85
|
+
// "description_append": "Uses the default strongest model. Use for high-quality frontend work."
|
|
86
|
+
// },
|
|
87
|
+
// "variants": {
|
|
88
|
+
// "light": {
|
|
89
|
+
// "name": "frontend-light",
|
|
90
|
+
// "model": "light",
|
|
91
|
+
// "description_append": "Use for routine frontend edits and reviews."
|
|
92
|
+
// }
|
|
93
|
+
// }
|
|
94
|
+
// }
|
|
95
|
+
}
|
|
96
|
+
}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const BUILTIN_AGENT_DESCRIPTIONS: Record<string, string>;
|
|
3
|
+
declare const Patch: z.ZodObject<{
|
|
4
|
+
model: z.ZodOptional<z.ZodString>;
|
|
5
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
6
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
9
|
+
prompt_prepend: z.ZodOptional<z.ZodString>;
|
|
10
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
description_prepend: z.ZodOptional<z.ZodString>;
|
|
13
|
+
description_append: z.ZodOptional<z.ZodString>;
|
|
14
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
15
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
16
|
+
error: "error";
|
|
17
|
+
success: "success";
|
|
18
|
+
primary: "primary";
|
|
19
|
+
secondary: "secondary";
|
|
20
|
+
accent: "accent";
|
|
21
|
+
warning: "warning";
|
|
22
|
+
info: "info";
|
|
23
|
+
}>]>>;
|
|
24
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
declare const Variant: z.ZodObject<{
|
|
27
|
+
model: z.ZodOptional<z.ZodString>;
|
|
28
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
29
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
32
|
+
prompt_prepend: z.ZodOptional<z.ZodString>;
|
|
33
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
34
|
+
description: z.ZodOptional<z.ZodString>;
|
|
35
|
+
description_prepend: z.ZodOptional<z.ZodString>;
|
|
36
|
+
description_append: z.ZodOptional<z.ZodString>;
|
|
37
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
38
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
39
|
+
error: "error";
|
|
40
|
+
success: "success";
|
|
41
|
+
primary: "primary";
|
|
42
|
+
secondary: "secondary";
|
|
43
|
+
accent: "accent";
|
|
44
|
+
warning: "warning";
|
|
45
|
+
info: "info";
|
|
46
|
+
}>]>>;
|
|
47
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export declare const SidecarConfig: z.ZodObject<{
|
|
51
|
+
debug: z.ZodDefault<z.ZodBoolean>;
|
|
52
|
+
models: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
53
|
+
model: z.ZodString;
|
|
54
|
+
label: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$strip>>>;
|
|
56
|
+
agents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
57
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
parent: z.ZodDefault<z.ZodObject<{
|
|
59
|
+
model: z.ZodOptional<z.ZodString>;
|
|
60
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
61
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
64
|
+
prompt_prepend: z.ZodOptional<z.ZodString>;
|
|
65
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
66
|
+
description: z.ZodOptional<z.ZodString>;
|
|
67
|
+
description_prepend: z.ZodOptional<z.ZodString>;
|
|
68
|
+
description_append: z.ZodOptional<z.ZodString>;
|
|
69
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
70
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
71
|
+
error: "error";
|
|
72
|
+
success: "success";
|
|
73
|
+
primary: "primary";
|
|
74
|
+
secondary: "secondary";
|
|
75
|
+
accent: "accent";
|
|
76
|
+
warning: "warning";
|
|
77
|
+
info: "info";
|
|
78
|
+
}>]>>;
|
|
79
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
80
|
+
}, z.core.$strip>>;
|
|
81
|
+
variants: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
82
|
+
model: z.ZodOptional<z.ZodString>;
|
|
83
|
+
variant: z.ZodOptional<z.ZodString>;
|
|
84
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
86
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
87
|
+
prompt_prepend: z.ZodOptional<z.ZodString>;
|
|
88
|
+
prompt_append: z.ZodOptional<z.ZodString>;
|
|
89
|
+
description: z.ZodOptional<z.ZodString>;
|
|
90
|
+
description_prepend: z.ZodOptional<z.ZodString>;
|
|
91
|
+
description_append: z.ZodOptional<z.ZodString>;
|
|
92
|
+
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
93
|
+
color: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodEnum<{
|
|
94
|
+
error: "error";
|
|
95
|
+
success: "success";
|
|
96
|
+
primary: "primary";
|
|
97
|
+
secondary: "secondary";
|
|
98
|
+
accent: "accent";
|
|
99
|
+
warning: "warning";
|
|
100
|
+
info: "info";
|
|
101
|
+
}>]>>;
|
|
102
|
+
disable: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
name: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strip>>>;
|
|
105
|
+
}, z.core.$strip>>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type AgentPatch = z.infer<typeof Patch>;
|
|
108
|
+
export type VariantConfig = z.infer<typeof Variant>;
|
|
109
|
+
export type SidecarConfig = z.infer<typeof SidecarConfig>;
|
|
110
|
+
export type DiagnosticLevel = "error" | "warning" | "info";
|
|
111
|
+
export type Diagnostic = {
|
|
112
|
+
level: DiagnosticLevel;
|
|
113
|
+
message: string;
|
|
114
|
+
agent?: string;
|
|
115
|
+
variant?: string;
|
|
116
|
+
alias?: string;
|
|
117
|
+
};
|
|
118
|
+
export type ModelCatalog = {
|
|
119
|
+
providers: Set<string>;
|
|
120
|
+
providersWithModelList: Set<string>;
|
|
121
|
+
refs: Set<string>;
|
|
122
|
+
};
|
|
123
|
+
export type TemplateContext = {
|
|
124
|
+
parent: string;
|
|
125
|
+
alias?: string;
|
|
126
|
+
variant_key?: string;
|
|
127
|
+
model?: string;
|
|
128
|
+
model_label?: string;
|
|
129
|
+
routed_agent?: string;
|
|
130
|
+
};
|
|
131
|
+
export declare function defaultConfigDir(): string;
|
|
132
|
+
export declare function defaultSidecarPath(configDir?: string): string;
|
|
133
|
+
export declare function debugLogPath(configDir?: string): string;
|
|
134
|
+
export declare function emptyConfig(): SidecarConfig;
|
|
135
|
+
export declare function loadSidecar(filePath?: string): {
|
|
136
|
+
debug: boolean;
|
|
137
|
+
models: Record<string, {
|
|
138
|
+
model: string;
|
|
139
|
+
label?: string | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
agents: Record<string, {
|
|
142
|
+
parent: {
|
|
143
|
+
model?: string | undefined;
|
|
144
|
+
variant?: string | undefined;
|
|
145
|
+
temperature?: number | undefined;
|
|
146
|
+
top_p?: number | undefined;
|
|
147
|
+
prompt?: string | undefined;
|
|
148
|
+
prompt_prepend?: string | undefined;
|
|
149
|
+
prompt_append?: string | undefined;
|
|
150
|
+
description?: string | undefined;
|
|
151
|
+
description_prepend?: string | undefined;
|
|
152
|
+
description_append?: string | undefined;
|
|
153
|
+
options?: Record<string, unknown> | undefined;
|
|
154
|
+
color?: string | undefined;
|
|
155
|
+
disable?: boolean | undefined;
|
|
156
|
+
};
|
|
157
|
+
variants: Record<string, {
|
|
158
|
+
model?: string | undefined;
|
|
159
|
+
variant?: string | undefined;
|
|
160
|
+
temperature?: number | undefined;
|
|
161
|
+
top_p?: number | undefined;
|
|
162
|
+
prompt?: string | undefined;
|
|
163
|
+
prompt_prepend?: string | undefined;
|
|
164
|
+
prompt_append?: string | undefined;
|
|
165
|
+
description?: string | undefined;
|
|
166
|
+
description_prepend?: string | undefined;
|
|
167
|
+
description_append?: string | undefined;
|
|
168
|
+
options?: Record<string, unknown> | undefined;
|
|
169
|
+
color?: string | undefined;
|
|
170
|
+
disable?: boolean | undefined;
|
|
171
|
+
name?: string | undefined;
|
|
172
|
+
}>;
|
|
173
|
+
disable?: boolean | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
};
|
|
176
|
+
export declare function saveSidecar(config: SidecarConfig, filePath?: string): void;
|
|
177
|
+
export declare function renderTemplate(input: string | undefined, context?: TemplateContext): string | undefined;
|
|
178
|
+
export declare function applyTextPatch(base: string | undefined, patch: Pick<AgentPatch, "description" | "description_prepend" | "description_append">, context?: TemplateContext): string;
|
|
179
|
+
export declare function applyPromptPatch(base: string | undefined, patch: Pick<AgentPatch, "prompt" | "prompt_prepend" | "prompt_append">, context?: TemplateContext): string;
|
|
180
|
+
export declare function resolveModel(input: string | undefined, config: SidecarConfig): string | undefined;
|
|
181
|
+
export declare function modelLabel(input: string | undefined, config: SidecarConfig): string;
|
|
182
|
+
export declare function splitModelRef(model: string | undefined): {
|
|
183
|
+
providerID: string;
|
|
184
|
+
modelID: string;
|
|
185
|
+
} | undefined;
|
|
186
|
+
export declare function variantName(parent: string, key: string, variant: Pick<VariantConfig, "name">): string;
|
|
187
|
+
export declare function templateContext(parent: string, key: string | undefined, variant: Pick<VariantConfig, "name" | "model">, config: SidecarConfig): {
|
|
188
|
+
parent: string;
|
|
189
|
+
alias: string;
|
|
190
|
+
variant_key: string | undefined;
|
|
191
|
+
model: string | undefined;
|
|
192
|
+
model_label: string;
|
|
193
|
+
routed_agent: string;
|
|
194
|
+
};
|
|
195
|
+
export declare function generatedVariantDescription(parent: string, key: string, variant: VariantConfig, config: SidecarConfig): string;
|
|
196
|
+
export declare function modelCatalogFromProviders(providers: unknown): ModelCatalog;
|
|
197
|
+
export declare function validateModel(modelInput: string | undefined, config: SidecarConfig, catalog: ModelCatalog): string | undefined;
|
|
198
|
+
export declare function diagnoseConfig(config: SidecarConfig, input: {
|
|
199
|
+
agents: string[];
|
|
200
|
+
providers: unknown;
|
|
201
|
+
pluginEntries?: unknown[];
|
|
202
|
+
}): Diagnostic[];
|
|
203
|
+
export declare function fingerprint(input: {
|
|
204
|
+
parentSessionID: string;
|
|
205
|
+
agent: string;
|
|
206
|
+
prompt: string;
|
|
207
|
+
description?: string;
|
|
208
|
+
}): string;
|
|
209
|
+
export declare function hasPromptPatch(patch: AgentPatch): boolean;
|
|
210
|
+
export declare function hasRequestPatch(patch: AgentPatch): boolean;
|
|
211
|
+
export {};
|