opencode-resolve 0.1.7 → 0.1.8
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/README.ko.md +98 -53
- package/README.md +98 -53
- package/dist/agents.d.ts +26 -0
- package/dist/agents.js +355 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.js +398 -0
- package/dist/hooks/index.d.ts +18 -0
- package/dist/hooks/index.js +493 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -702
- package/dist/state.d.ts +33 -0
- package/dist/state.js +20 -0
- package/dist/tools/index.d.ts +252 -0
- package/dist/tools/index.js +1209 -0
- package/dist/types.d.ts +56 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +33 -0
- package/dist/utils.js +371 -0
- package/opencode-resolve.example.json +5 -2
- package/opencode-resolve.reference.jsonc +78 -19
- package/package.json +6 -2
- package/scripts/postinstall.mjs +193 -31
package/dist/config.js
ADDED
|
@@ -0,0 +1,398 @@
|
|
|
1
|
+
import { join, basename, isAbsolute, resolve } from "node:path";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { DEFAULT_AGENT_CONFIG, buildGLMResolverPrompt, GLM_CODER_PROMPT, buildGPTResolverPrompt, GPT_CODER_PROMPT, buildResolverPrompt, VALID_AGENT_NAME_SET, DEFAULT_MODELS, DEFAULT_ENABLED, VALID_AGENT_NAMES, GLM_ENABLED, GPT_ENABLED, TIER_ENABLED, GLM_AGENT_OVERRIDES, GPT_AGENT_OVERRIDES, VALID_MODEL_ALIAS_SET, VALID_PROFILES, VALID_TIERS } from "./agents.js";
|
|
4
|
+
import { readFirstJson } from "./utils.js";
|
|
5
|
+
export function applyResolveConfig(config, resolveConfig, projectContext) {
|
|
6
|
+
const profile = resolveConfig.profile;
|
|
7
|
+
const isGLM = profile === "glm";
|
|
8
|
+
const isGPT = profile === "gpt";
|
|
9
|
+
const profileEnabled = isGLM ? GLM_ENABLED : isGPT ? GPT_ENABLED : undefined;
|
|
10
|
+
const tierEnabled = resolveConfig.tier ? TIER_ENABLED[resolveConfig.tier] : undefined;
|
|
11
|
+
const enabled = new Set(resolveConfig.enabled ?? tierEnabled ?? (profileEnabled ?? DEFAULT_ENABLED));
|
|
12
|
+
const models = { ...DEFAULT_MODELS, ...resolveConfig.models };
|
|
13
|
+
const defaultModel = typeof config.model === "string" ? config.model : undefined;
|
|
14
|
+
const maxParallelSubagents = resolveConfig.maxParallelSubagents;
|
|
15
|
+
const contextInjection = buildContextInjection(projectContext);
|
|
16
|
+
config.agent ??= {};
|
|
17
|
+
for (const name of Object.keys(DEFAULT_AGENT_CONFIG)) {
|
|
18
|
+
const override = resolveConfig.agents?.[name];
|
|
19
|
+
const isEnabled = override?.enabled ?? enabled.has(name);
|
|
20
|
+
if (!isEnabled)
|
|
21
|
+
continue;
|
|
22
|
+
const base = DEFAULT_AGENT_CONFIG[name];
|
|
23
|
+
const profileOverride = isGLM ? GLM_AGENT_OVERRIDES[name] : isGPT ? GPT_AGENT_OVERRIDES[name] : undefined;
|
|
24
|
+
const { enabled: _enabled, model: requestedModel, permission: userPermission, ...agentOverride } = override ?? {};
|
|
25
|
+
const model = resolveModel(requestedModel ?? models[name] ?? defaultModel, models);
|
|
26
|
+
const permission = buildPermission(base.permission, userPermission);
|
|
27
|
+
const agentConfig = {
|
|
28
|
+
...base,
|
|
29
|
+
...profileOverride,
|
|
30
|
+
...agentOverride,
|
|
31
|
+
};
|
|
32
|
+
if (agentOverride.prompt === undefined) {
|
|
33
|
+
if (isGLM) {
|
|
34
|
+
if (name === "resolver")
|
|
35
|
+
agentConfig.prompt = buildGLMResolverPrompt(maxParallelSubagents);
|
|
36
|
+
else if (name === "coder")
|
|
37
|
+
agentConfig.prompt = GLM_CODER_PROMPT;
|
|
38
|
+
}
|
|
39
|
+
else if (isGPT) {
|
|
40
|
+
if (name === "resolver")
|
|
41
|
+
agentConfig.prompt = buildGPTResolverPrompt();
|
|
42
|
+
else if (name === "coder")
|
|
43
|
+
agentConfig.prompt = GPT_CODER_PROMPT;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
if (name === "resolver")
|
|
47
|
+
agentConfig.prompt = buildResolverPrompt(maxParallelSubagents);
|
|
48
|
+
}
|
|
49
|
+
// Inject project context into all resolver-type agents
|
|
50
|
+
if ((name === "resolver" || name === "glm") && contextInjection) {
|
|
51
|
+
agentConfig.prompt = agentConfig.prompt + "\n\n" + contextInjection;
|
|
52
|
+
}
|
|
53
|
+
// Inject verify commands into coder prompts
|
|
54
|
+
if ((name === "coder") && projectContext.verifyCommands.length > 0) {
|
|
55
|
+
agentConfig.prompt = agentConfig.prompt + "\n\nAvailable verify: " + projectContext.verifyCommands.join(", ") + ".";
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (permission)
|
|
59
|
+
agentConfig.permission = permission;
|
|
60
|
+
if (model)
|
|
61
|
+
agentConfig.model = model;
|
|
62
|
+
config.agent[name] = agentConfig;
|
|
63
|
+
}
|
|
64
|
+
if (resolveConfig.context7 !== false) {
|
|
65
|
+
config.mcp ??= {};
|
|
66
|
+
config.mcp.context7 ??= {
|
|
67
|
+
type: "remote",
|
|
68
|
+
url: "https://mcp.context7.com/mcp",
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (resolveConfig.commands) {
|
|
72
|
+
config.command ??= {};
|
|
73
|
+
config.command["resolve"] ??= {
|
|
74
|
+
template: "Drive this task to a verified resolution end-to-end. Classify, explore when needed, dispatch focused subagents within the configured per-role limit, verify, and iterate. $ARGUMENTS",
|
|
75
|
+
description: "Run the OpenCode Resolve resolver agent end-to-end",
|
|
76
|
+
agent: "resolver",
|
|
77
|
+
subtask: true,
|
|
78
|
+
};
|
|
79
|
+
config.command["resolve-review"] ??= {
|
|
80
|
+
template: "Review the current implementation against the user's requirements. Focus on correctness, tests, security, and maintainability. Do not modify anything.",
|
|
81
|
+
description: "Run the OpenCode Resolve reviewer agent (read-only)",
|
|
82
|
+
agent: "reviewer",
|
|
83
|
+
subtask: true,
|
|
84
|
+
};
|
|
85
|
+
config.command["resolve-code"] ??= {
|
|
86
|
+
template: "Implement the requested change with the smallest correct patch, then verify it when practical. $ARGUMENTS",
|
|
87
|
+
description: "Run the OpenCode Resolve coder agent",
|
|
88
|
+
agent: "coder",
|
|
89
|
+
subtask: true,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
export function buildContextInjection(ctx) {
|
|
94
|
+
const lines = [];
|
|
95
|
+
if (ctx.knowledgeFiles.length > 0) {
|
|
96
|
+
lines.push(`Project knowledge sources detected: ${ctx.knowledgeFiles.join(", ")}.`);
|
|
97
|
+
lines.push("Read these FIRST when relevant before inspecting code — they contain infra decisions, patterns, traps, and team context.");
|
|
98
|
+
}
|
|
99
|
+
if (ctx.contextFiles.length > 0) {
|
|
100
|
+
lines.push(`Relevant context documents available: ${ctx.contextFiles.slice(0, 20).join(", ")}.`);
|
|
101
|
+
lines.push("MVI rule: read only the context documents relevant to the current task, not the whole context tree.");
|
|
102
|
+
}
|
|
103
|
+
if (ctx.packageManager) {
|
|
104
|
+
lines.push(`Package manager: ${ctx.packageManager}.`);
|
|
105
|
+
}
|
|
106
|
+
if (ctx.verifyCommands.length > 0) {
|
|
107
|
+
lines.push(`Verify commands available: ${ctx.verifyCommands.join("; ")}.`);
|
|
108
|
+
lines.push("Run the relevant one after every code change. Pass = evidence. Fail = fix before reporting.");
|
|
109
|
+
}
|
|
110
|
+
if (ctx.hasTypeScript) {
|
|
111
|
+
lines.push("TypeScript project — type safety is mandatory.");
|
|
112
|
+
}
|
|
113
|
+
return lines.length > 0 ? lines.join("\n") : "";
|
|
114
|
+
}
|
|
115
|
+
export function defaultResolveConfig() {
|
|
116
|
+
return {
|
|
117
|
+
profile: "mix",
|
|
118
|
+
models: {},
|
|
119
|
+
agents: {},
|
|
120
|
+
preserveNative: true,
|
|
121
|
+
context7: true,
|
|
122
|
+
commands: false,
|
|
123
|
+
autoApprove: true,
|
|
124
|
+
autoUpdate: true,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export function mergeResolveConfig(...configs) {
|
|
128
|
+
const result = {};
|
|
129
|
+
for (const config of configs) {
|
|
130
|
+
if (!config)
|
|
131
|
+
continue;
|
|
132
|
+
result.profile = config.profile ?? result.profile;
|
|
133
|
+
result.tier = config.tier ?? result.tier;
|
|
134
|
+
result.enabled = config.enabled ?? result.enabled;
|
|
135
|
+
result.preserveNative = config.preserveNative ?? result.preserveNative;
|
|
136
|
+
result.context7 = config.context7 ?? result.context7;
|
|
137
|
+
result.commands = config.commands ?? result.commands;
|
|
138
|
+
result.autoApprove = config.autoApprove ?? result.autoApprove;
|
|
139
|
+
result.maxParallelSubagents = config.maxParallelSubagents ?? result.maxParallelSubagents;
|
|
140
|
+
result.autoUpdate = config.autoUpdate ?? result.autoUpdate;
|
|
141
|
+
result.models = { ...result.models, ...config.models };
|
|
142
|
+
result.agents = mergeAgents(result.agents, config.agents);
|
|
143
|
+
}
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
export function mergeAgents(left, right) {
|
|
147
|
+
const result = { ...left };
|
|
148
|
+
for (const name of Object.keys(right ?? {})) {
|
|
149
|
+
result[name] = { ...result[name], ...right?.[name] };
|
|
150
|
+
}
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
export function resolveModel(model, models) {
|
|
154
|
+
if (!model)
|
|
155
|
+
return undefined;
|
|
156
|
+
return models[model] ?? model;
|
|
157
|
+
}
|
|
158
|
+
export function buildPermission(basePermission, userPermission) {
|
|
159
|
+
const merged = {
|
|
160
|
+
...(basePermission ?? {}),
|
|
161
|
+
...(userPermission ?? {}),
|
|
162
|
+
};
|
|
163
|
+
if (Object.keys(merged).length === 0)
|
|
164
|
+
return undefined;
|
|
165
|
+
return merged;
|
|
166
|
+
}
|
|
167
|
+
export function getPluginOptions(config) {
|
|
168
|
+
for (const entry of config.plugin ?? []) {
|
|
169
|
+
if (Array.isArray(entry) && isResolvePluginEntry(entry[0])) {
|
|
170
|
+
return entry[1] ?? {};
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return {};
|
|
174
|
+
}
|
|
175
|
+
export function isResolvePluginEntry(entry) {
|
|
176
|
+
const name = basename(entry);
|
|
177
|
+
return name === "opencode-resolve" || name.startsWith("opencode-resolve@");
|
|
178
|
+
}
|
|
179
|
+
export function resolvePath(path, directory) {
|
|
180
|
+
if (path.startsWith("~/"))
|
|
181
|
+
return join(homedir(), path.slice(2));
|
|
182
|
+
if (isAbsolute(path))
|
|
183
|
+
return path;
|
|
184
|
+
return resolve(directory, path);
|
|
185
|
+
}
|
|
186
|
+
export function normalizeResolveConfig(value, source) {
|
|
187
|
+
if (value === undefined)
|
|
188
|
+
return {};
|
|
189
|
+
const config = expectObject(value, source);
|
|
190
|
+
for (const key of Object.keys(config)) {
|
|
191
|
+
if (!VALID_TOP_LEVEL_KEYS.has(key)) {
|
|
192
|
+
throw new Error(`Unknown top-level key "${key}" in ${source}`);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
const result = {};
|
|
196
|
+
if (config.enabled !== undefined) {
|
|
197
|
+
result.enabled = expectStringArray(config.enabled, `${source}.enabled`).map((name) => expectAgentName(name, `${source}.enabled`));
|
|
198
|
+
}
|
|
199
|
+
if (config.models !== undefined) {
|
|
200
|
+
const models = expectObject(config.models, `${source}.models`);
|
|
201
|
+
result.models = {};
|
|
202
|
+
for (const [key, model] of Object.entries(models)) {
|
|
203
|
+
if (!VALID_MODEL_ALIAS_SET.has(key)) {
|
|
204
|
+
throw new Error(`Unknown model alias "${key}" in ${source}.models`);
|
|
205
|
+
}
|
|
206
|
+
result.models[key] = expectString(model, `${source}.models.${key}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (config.agents !== undefined) {
|
|
210
|
+
const agents = expectObject(config.agents, `${source}.agents`);
|
|
211
|
+
result.agents = {};
|
|
212
|
+
for (const [name, agentConfig] of Object.entries(agents)) {
|
|
213
|
+
const agentName = expectAgentName(name, `${source}.agents`);
|
|
214
|
+
result.agents[agentName] = normalizeAgentConfig(agentConfig, `${source}.agents.${name}`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (config.preserveNative !== undefined)
|
|
218
|
+
result.preserveNative = expectBoolean(config.preserveNative, `${source}.preserveNative`);
|
|
219
|
+
if (config.context7 !== undefined)
|
|
220
|
+
result.context7 = expectBoolean(config.context7, `${source}.context7`);
|
|
221
|
+
if (config.commands !== undefined)
|
|
222
|
+
result.commands = expectBoolean(config.commands, `${source}.commands`);
|
|
223
|
+
if (config.autoApprove !== undefined)
|
|
224
|
+
result.autoApprove = expectBoolean(config.autoApprove, `${source}.autoApprove`);
|
|
225
|
+
if (config.autoUpdate !== undefined)
|
|
226
|
+
result.autoUpdate = expectBoolean(config.autoUpdate, `${source}.autoUpdate`);
|
|
227
|
+
if (config.profile !== undefined) {
|
|
228
|
+
const profile = expectString(config.profile, `${source}.profile`);
|
|
229
|
+
if (!VALID_PROFILES.has(profile)) {
|
|
230
|
+
throw new Error(`Unknown profile "${profile}" in ${source}.profile. Valid profiles: ${[...VALID_PROFILES].join(", ")}`);
|
|
231
|
+
}
|
|
232
|
+
result.profile = profile;
|
|
233
|
+
}
|
|
234
|
+
if (config.tier !== undefined) {
|
|
235
|
+
const tier = expectString(config.tier, `${source}.tier`);
|
|
236
|
+
if (!VALID_TIERS.has(tier)) {
|
|
237
|
+
throw new Error(`Unknown tier "${tier}" in ${source}.tier. Valid tiers: ${[...VALID_TIERS].join(", ")}`);
|
|
238
|
+
}
|
|
239
|
+
result.tier = tier;
|
|
240
|
+
}
|
|
241
|
+
if (config.maxParallelSubagents !== undefined) {
|
|
242
|
+
const limit = expectNumber(config.maxParallelSubagents, `${source}.maxParallelSubagents`);
|
|
243
|
+
if (!Number.isInteger(limit) || limit < 1) {
|
|
244
|
+
throw new Error(`${source}.maxParallelSubagents must be a positive integer`);
|
|
245
|
+
}
|
|
246
|
+
result.maxParallelSubagents = limit;
|
|
247
|
+
}
|
|
248
|
+
if (config.config !== undefined)
|
|
249
|
+
result.config = expectString(config.config, `${source}.config`);
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
export function normalizeAgentConfig(value, source) {
|
|
253
|
+
const config = expectObject(value, source);
|
|
254
|
+
for (const key of Object.keys(config)) {
|
|
255
|
+
if (!VALID_AGENT_KEYS.has(key)) {
|
|
256
|
+
throw new Error(`Unknown agent key "${key}" in ${source}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const result = {};
|
|
260
|
+
if (config.enabled !== undefined)
|
|
261
|
+
result.enabled = expectBoolean(config.enabled, `${source}.enabled`);
|
|
262
|
+
if (config.model !== undefined)
|
|
263
|
+
result.model = expectString(config.model, `${source}.model`);
|
|
264
|
+
if (config.mode !== undefined) {
|
|
265
|
+
const mode = expectString(config.mode, `${source}.mode`);
|
|
266
|
+
if (!VALID_MODES.has(mode))
|
|
267
|
+
throw new Error(`Invalid mode "${mode}" in ${source}.mode`);
|
|
268
|
+
result.mode = mode;
|
|
269
|
+
}
|
|
270
|
+
if (config.description !== undefined)
|
|
271
|
+
result.description = expectString(config.description, `${source}.description`);
|
|
272
|
+
if (config.prompt !== undefined)
|
|
273
|
+
result.prompt = expectString(config.prompt, `${source}.prompt`);
|
|
274
|
+
if (config.color !== undefined)
|
|
275
|
+
result.color = expectString(config.color, `${source}.color`);
|
|
276
|
+
if (config.maxSteps !== undefined) {
|
|
277
|
+
const maxSteps = expectNumber(config.maxSteps, `${source}.maxSteps`);
|
|
278
|
+
if (!Number.isInteger(maxSteps) || maxSteps < 1)
|
|
279
|
+
throw new Error(`${source}.maxSteps must be a positive integer`);
|
|
280
|
+
result.maxSteps = maxSteps;
|
|
281
|
+
}
|
|
282
|
+
if (config.tools !== undefined)
|
|
283
|
+
result.tools = normalizeTools(config.tools, `${source}.tools`);
|
|
284
|
+
if (config.permission !== undefined)
|
|
285
|
+
result.permission = normalizePermission(config.permission, `${source}.permission`);
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
export function normalizeTools(value, source) {
|
|
289
|
+
const tools = expectObject(value, source);
|
|
290
|
+
const result = {};
|
|
291
|
+
for (const [key, enabled] of Object.entries(tools)) {
|
|
292
|
+
result[key] = expectBoolean(enabled, `${source}.${key}`);
|
|
293
|
+
}
|
|
294
|
+
return result;
|
|
295
|
+
}
|
|
296
|
+
export function normalizePermission(value, source) {
|
|
297
|
+
const permission = expectObject(value, source);
|
|
298
|
+
const result = {};
|
|
299
|
+
for (const [key, entry] of Object.entries(permission)) {
|
|
300
|
+
if (key === "bash" && isObject(entry)) {
|
|
301
|
+
result.bash = {};
|
|
302
|
+
for (const [command, commandPermission] of Object.entries(entry)) {
|
|
303
|
+
result.bash[command] = expectPermissionValue(commandPermission, `${source}.bash.${command}`);
|
|
304
|
+
}
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const permissionValue = expectPermissionValue(entry, `${source}.${key}`);
|
|
308
|
+
if (key === "edit" || key === "bash" || key === "webfetch" || key === "doom_loop" || key === "external_directory") {
|
|
309
|
+
result[key] = permissionValue;
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
throw new Error(`Unknown permission key "${key}" in ${source}`);
|
|
313
|
+
}
|
|
314
|
+
return result;
|
|
315
|
+
}
|
|
316
|
+
export function expectAgentName(value, source) {
|
|
317
|
+
if (!VALID_AGENT_NAME_SET.has(value)) {
|
|
318
|
+
throw new Error(`Unknown agent "${value}" in ${source}. Valid agents: ${VALID_AGENT_NAMES.join(", ")}`);
|
|
319
|
+
}
|
|
320
|
+
return value;
|
|
321
|
+
}
|
|
322
|
+
export function expectPermissionValue(value, source) {
|
|
323
|
+
const permission = expectString(value, source);
|
|
324
|
+
if (!VALID_PERMISSION_VALUES.has(permission)) {
|
|
325
|
+
throw new Error(`${source} must be one of: ask, allow, deny`);
|
|
326
|
+
}
|
|
327
|
+
return permission;
|
|
328
|
+
}
|
|
329
|
+
export function expectStringArray(value, source) {
|
|
330
|
+
if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) {
|
|
331
|
+
throw new Error(`${source} must be an array of strings`);
|
|
332
|
+
}
|
|
333
|
+
return value;
|
|
334
|
+
}
|
|
335
|
+
export function expectObject(value, source) {
|
|
336
|
+
if (!isObject(value))
|
|
337
|
+
throw new Error(`${source} must be an object`);
|
|
338
|
+
return value;
|
|
339
|
+
}
|
|
340
|
+
export function expectString(value, source) {
|
|
341
|
+
if (typeof value !== "string" || value.length === 0)
|
|
342
|
+
throw new Error(`${source} must be a non-empty string`);
|
|
343
|
+
return value;
|
|
344
|
+
}
|
|
345
|
+
export function expectBoolean(value, source) {
|
|
346
|
+
if (typeof value !== "boolean")
|
|
347
|
+
throw new Error(`${source} must be a boolean`);
|
|
348
|
+
return value;
|
|
349
|
+
}
|
|
350
|
+
export function expectNumber(value, source) {
|
|
351
|
+
if (typeof value !== "number" || Number.isNaN(value))
|
|
352
|
+
throw new Error(`${source} must be a number`);
|
|
353
|
+
return value;
|
|
354
|
+
}
|
|
355
|
+
export function isObject(value) {
|
|
356
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
357
|
+
}
|
|
358
|
+
export async function loadResolveConfig(directory, opencodeConfig, options) {
|
|
359
|
+
const pluginOptions = normalizeResolveConfig(options ?? getPluginOptions(opencodeConfig), "plugin options");
|
|
360
|
+
const configuredPath = typeof pluginOptions.config === "string" ? pluginOptions.config : undefined;
|
|
361
|
+
const configPaths = configuredPath
|
|
362
|
+
? [resolvePath(configuredPath, directory)]
|
|
363
|
+
: [
|
|
364
|
+
join(directory, ".opencode", "resolve.json"),
|
|
365
|
+
join(directory, "opencode-resolve.json"),
|
|
366
|
+
join(homedir(), ".config", "opencode", "resolve.json"),
|
|
367
|
+
join(homedir(), ".config", "opencode", "opencode-resolve.json"),
|
|
368
|
+
];
|
|
369
|
+
const fileConfig = await readFirstJson(configPaths);
|
|
370
|
+
return mergeResolveConfig(defaultResolveConfig(), fileConfig, pluginOptions);
|
|
371
|
+
}
|
|
372
|
+
export const VALID_TOP_LEVEL_KEYS = new Set([
|
|
373
|
+
"profile",
|
|
374
|
+
"tier",
|
|
375
|
+
"enabled",
|
|
376
|
+
"models",
|
|
377
|
+
"agents",
|
|
378
|
+
"preserveNative",
|
|
379
|
+
"context7",
|
|
380
|
+
"commands",
|
|
381
|
+
"autoApprove",
|
|
382
|
+
"maxParallelSubagents",
|
|
383
|
+
"autoUpdate",
|
|
384
|
+
"config",
|
|
385
|
+
]);
|
|
386
|
+
export const VALID_AGENT_KEYS = new Set([
|
|
387
|
+
"enabled",
|
|
388
|
+
"model",
|
|
389
|
+
"mode",
|
|
390
|
+
"description",
|
|
391
|
+
"prompt",
|
|
392
|
+
"color",
|
|
393
|
+
"maxSteps",
|
|
394
|
+
"tools",
|
|
395
|
+
"permission",
|
|
396
|
+
]);
|
|
397
|
+
export const VALID_MODES = new Set(["subagent", "primary", "all"]);
|
|
398
|
+
export const VALID_PERMISSION_VALUES = new Set(["ask", "allow", "deny"]);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SessionState } from "../state.js";
|
|
2
|
+
export declare function getHooks(directory: string, options: any, sessionState: SessionState): {
|
|
3
|
+
event: (input: any) => Promise<void>;
|
|
4
|
+
config: (config: any) => Promise<void>;
|
|
5
|
+
"shell.env": (_input: any, output: any) => Promise<void>;
|
|
6
|
+
"permission.ask": (input: any, output: any) => Promise<void>;
|
|
7
|
+
"chat.params": (input: any, output: any) => Promise<void>;
|
|
8
|
+
"tool.definition": (input: any, output: any) => Promise<void>;
|
|
9
|
+
"command.execute.before": (_input: any, output: any) => Promise<void>;
|
|
10
|
+
"tool.execute.before": (input: any, output: any) => Promise<void>;
|
|
11
|
+
"chat.headers": (input: any, output: any) => Promise<void>;
|
|
12
|
+
"tool.execute.after": (input: any, output: any) => Promise<void>;
|
|
13
|
+
"experimental.session.compacting": (_input: any, output: any) => Promise<void>;
|
|
14
|
+
"experimental.chat.messages.transform": (_input: any, output: any) => Promise<void>;
|
|
15
|
+
"experimental.compaction.autocontinue": (_input: any, output: any) => Promise<void>;
|
|
16
|
+
"experimental.chat.system.transform": (_input: any, output: any) => Promise<void>;
|
|
17
|
+
"experimental.text.complete": (_input: any, output: any) => Promise<void>;
|
|
18
|
+
};
|