opencode-swarm 7.126.0 → 7.126.2
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/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -16
- package/.opencode/skills/swarm-pr-review/SKILL.md +18 -14
- package/dist/cli/{config-doctor-akxywx0c.js → config-doctor-mfx27331.js} +2 -2
- package/dist/cli/{core-v1kp7anb.js → core-wg3re04e.js} +1 -1
- package/dist/cli/{curation-policy-dptr1rfe.js → curation-policy-n944aq62.js} +2 -2
- package/dist/cli/{curator-llm-factory-r648jn8e.js → curator-llm-factory-0rf29gfq.js} +14 -14
- package/dist/cli/{curator-23hynz78.js → curator-qfh9xty4.js} +14 -14
- package/dist/cli/{guardrail-explain-6atsd4vr.js → guardrail-explain-jsrjqps1.js} +15 -15
- package/dist/cli/{guardrail-log-222xyxfp.js → guardrail-log-61gya05m.js} +3 -3
- package/dist/cli/{hive-promoter-bnkhzd46.js → hive-promoter-ktt17fyf.js} +14 -14
- package/dist/cli/{index-jt7hnr7q.js → index-3xd9a2g7.js} +1 -1
- package/dist/cli/{index-gnvg72y1.js → index-4ff0x4cg.js} +79 -1
- package/dist/cli/{index-68fpa7ff.js → index-5nq8dp63.js} +16 -16
- package/dist/cli/{index-yfzn5r9s.js → index-7bxw3v5w.js} +3 -3
- package/dist/cli/{index-kwnsatzq.js → index-88dt7c9z.js} +2 -2
- package/dist/cli/{index-qzkcy22e.js → index-bf76q8q7.js} +1 -1
- package/dist/cli/{index-16z6txq3.js → index-c48dvb6j.js} +2 -2
- package/dist/cli/{index-0ff5cm9j.js → index-d88y17ht.js} +2222 -2197
- package/dist/cli/{index-bcgfhxzv.js → index-f97dm6tz.js} +5 -5
- package/dist/cli/{index-a1c9az5e.js → index-gf9cxvp0.js} +109 -151
- package/dist/cli/{index-mgrsx5hn.js → index-gwss5btk.js} +1 -1
- package/dist/cli/{index-dezgmvtw.js → index-gxw20m1d.js} +1 -1
- package/dist/cli/{index-2bnfwmk3.js → index-nqp13m5a.js} +1 -1
- package/dist/cli/{index-2yd75hms.js → index-pb8ag9vg.js} +4 -4
- package/dist/cli/{index-cdx337js.js → index-pf3xae4s.js} +1 -1
- package/dist/cli/{index-r1gdkn2d.js → index-vcqwhe9d.js} +117 -21
- package/dist/cli/{index-g4ef4v3m.js → index-w9cb5zwh.js} +1 -1
- package/dist/cli/{index-y4ry07h8.js → index-z8ftpav0.js} +2 -2
- package/dist/cli/index.js +14 -14
- package/dist/cli/{knowledge-escalator-4hc8w7sd.js → knowledge-escalator-nna0zec3.js} +3 -3
- package/dist/cli/{knowledge-events-kyqjv1f8.js → knowledge-events-7k82xk36.js} +1 -1
- package/dist/cli/{knowledge-store-06k0p1gs.js → knowledge-store-efvtng9t.js} +1 -1
- package/dist/cli/{knowledge-validator-42xjmcmh.js → knowledge-validator-jh93eagj.js} +4 -4
- package/dist/cli/{scan-cursor-gjcvpyta.js → scan-cursor-cydz8d9q.js} +2 -2
- package/dist/cli/{schema-69z8w1ka.js → schema-fa033pqw.js} +1 -1
- package/dist/cli/{scope-persistence-habn4q8a.js → scope-persistence-dm5bab50.js} +3 -1
- package/dist/cli/{skill-generator-t6j93mwt.js → skill-generator-8v463kj7.js} +5 -5
- package/dist/config/index.d.ts +1 -0
- package/dist/config/loader.d.ts +51 -36
- package/dist/hooks/delegation-gate.d.ts +14 -2
- package/dist/hooks/pr-workflow-gate.d.ts +57 -0
- package/dist/hooks/scope-guard.d.ts +6 -1
- package/dist/index.js +55 -49
- package/dist/scope/scope-binding.d.ts +21 -2
- package/dist/scope/scope-persistence.d.ts +6 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/manifest.d.ts +3 -0
- package/dist/tools/prepare-pr-feedback-scope.d.ts +5 -0
- package/dist/tools/prepare-pr-workflow-checkout.d.ts +25 -0
- package/dist/tools/tool-metadata.d.ts +102 -0
- package/dist/tools/write-pr-review-artifact.d.ts +5 -0
- package/package.json +3 -3
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
resolveSwarmKnowledgePath,
|
|
7
7
|
transactKnowledge,
|
|
8
8
|
wordBigrams
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-pb8ag9vg.js";
|
|
10
10
|
import {
|
|
11
11
|
countEntryContradictionsInWindow,
|
|
12
12
|
countEntryViolationsInWindow,
|
|
13
13
|
readKnowledgeEvents,
|
|
14
14
|
recordKnowledgeEvent
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-nqp13m5a.js";
|
|
16
16
|
import {
|
|
17
17
|
init_knowledge_types,
|
|
18
18
|
isActiveStatus
|
|
@@ -190,11 +190,11 @@ async function maybeQuarantineOnContradiction(directory, entryId, threshold, win
|
|
|
190
190
|
alreadyInactive: true
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
193
|
+
const { quarantineEntry } = await import("./knowledge-validator-jh93eagj.js");
|
|
194
194
|
let policyConfig;
|
|
195
195
|
try {
|
|
196
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
197
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
196
|
+
const { KnowledgeConfigSchema } = await import("./schema-fa033pqw.js");
|
|
197
|
+
const { loadPluginConfigWithMeta } = await import("./index-c48dvb6j.js");
|
|
198
198
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
199
199
|
policyConfig = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
200
200
|
} catch {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
init_constants,
|
|
9
9
|
init_schema,
|
|
10
10
|
resolveExternalSkillsConfig
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-vcqwhe9d.js";
|
|
12
12
|
import {
|
|
13
13
|
advisoryWarn,
|
|
14
14
|
init_warning_buffer
|
|
@@ -100,30 +100,35 @@ function migratePresetsConfig(raw) {
|
|
|
100
100
|
}
|
|
101
101
|
function sanitizeExternalSkillsConfig(raw) {
|
|
102
102
|
if (!("external_skills" in raw) || raw.external_skills === undefined) {
|
|
103
|
-
return raw;
|
|
103
|
+
return { result: raw, strippedKeys: [] };
|
|
104
104
|
}
|
|
105
105
|
const esResult = ExternalSkillsConfigSchema.safeParse(raw.external_skills);
|
|
106
106
|
if (esResult.success) {
|
|
107
107
|
return {
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
result: {
|
|
109
|
+
...raw,
|
|
110
|
+
external_skills: resolveExternalSkillsConfig(esResult.data)
|
|
111
|
+
},
|
|
112
|
+
strippedKeys: []
|
|
110
113
|
};
|
|
111
114
|
}
|
|
112
115
|
advisoryWarn("[opencode-swarm] external_skills config validation failed:", formatZodIssues(esResult.error));
|
|
113
116
|
advisoryWarn("[opencode-swarm] External skills curation disabled due to invalid config. Fix the external_skills section to enable it.");
|
|
114
117
|
const cleaned = { ...raw };
|
|
115
118
|
delete cleaned.external_skills;
|
|
116
|
-
return cleaned;
|
|
119
|
+
return { result: cleaned, strippedKeys: ["external_skills"] };
|
|
117
120
|
}
|
|
118
121
|
function sanitizeGatesConfig(raw) {
|
|
122
|
+
const strippedKeys = [];
|
|
119
123
|
if (!("gates" in raw) || raw.gates === undefined) {
|
|
120
|
-
return raw;
|
|
124
|
+
return { result: raw, strippedKeys };
|
|
121
125
|
}
|
|
122
126
|
if (typeof raw.gates !== "object" || raw.gates === null || Array.isArray(raw.gates)) {
|
|
123
127
|
advisoryWarn("[opencode-swarm] gates config validation failed: expected an object. Quality gates will use defaults; other config sections remain active.");
|
|
124
128
|
const cleaned2 = { ...raw };
|
|
125
129
|
delete cleaned2.gates;
|
|
126
|
-
|
|
130
|
+
strippedKeys.push("gates");
|
|
131
|
+
return { result: cleaned2, strippedKeys };
|
|
127
132
|
}
|
|
128
133
|
const gateSchemas = GateConfigSchema.shape;
|
|
129
134
|
const cleanedGates = { ...raw.gates };
|
|
@@ -132,6 +137,7 @@ function sanitizeGatesConfig(raw) {
|
|
|
132
137
|
if (!schema) {
|
|
133
138
|
advisoryWarn(`[opencode-swarm] Unknown gates config section "gates.${key}" ignored. Other config sections remain active.`);
|
|
134
139
|
delete cleanedGates[key];
|
|
140
|
+
strippedKeys.push(`gates.${key}`);
|
|
135
141
|
continue;
|
|
136
142
|
}
|
|
137
143
|
const knownFields = GATE_CONFIG_KNOWN_SECTION_KEYS[key];
|
|
@@ -143,6 +149,7 @@ function sanitizeGatesConfig(raw) {
|
|
|
143
149
|
if (!knownFieldSet.has(fieldName)) {
|
|
144
150
|
advisoryWarn(`[opencode-swarm] Unknown gates config key "gates.${key}.${fieldName}" ignored. Other config sections remain active.`);
|
|
145
151
|
delete cleanedSection[fieldName];
|
|
152
|
+
strippedKeys.push(`gates.${key}.${fieldName}`);
|
|
146
153
|
}
|
|
147
154
|
}
|
|
148
155
|
sectionValue = cleanedSection;
|
|
@@ -152,22 +159,30 @@ function sanitizeGatesConfig(raw) {
|
|
|
152
159
|
if (!sectionResult.success) {
|
|
153
160
|
advisoryWarn(`[opencode-swarm] gates.${key} config validation failed; that gate section will use defaults and other config sections remain active:`, formatZodIssues(sectionResult.error));
|
|
154
161
|
delete cleanedGates[key];
|
|
162
|
+
if (!strippedKeys.includes(`gates.${key}`)) {
|
|
163
|
+
strippedKeys.push(`gates.${key}`);
|
|
164
|
+
}
|
|
155
165
|
}
|
|
156
166
|
}
|
|
157
167
|
const gatesResult = GateConfigSchema.safeParse(cleanedGates);
|
|
158
168
|
if (gatesResult.success) {
|
|
159
169
|
return {
|
|
160
|
-
...raw,
|
|
161
|
-
|
|
170
|
+
result: { ...raw, gates: gatesResult.data },
|
|
171
|
+
strippedKeys
|
|
162
172
|
};
|
|
163
173
|
}
|
|
164
174
|
advisoryWarn("[opencode-swarm] gates config validation failed after section cleanup; quality gates will use defaults and other config sections remain active:", formatZodIssues(gatesResult.error));
|
|
165
175
|
const cleaned = { ...raw };
|
|
166
176
|
delete cleaned.gates;
|
|
167
|
-
|
|
177
|
+
if (!strippedKeys.includes("gates")) {
|
|
178
|
+
strippedKeys.push("gates");
|
|
179
|
+
}
|
|
180
|
+
return { result: cleaned, strippedKeys };
|
|
168
181
|
}
|
|
169
182
|
function sanitizeSectionConfigs(raw) {
|
|
170
|
-
|
|
183
|
+
const { result: afterExternal, strippedKeys: externalStripped } = sanitizeExternalSkillsConfig(raw);
|
|
184
|
+
const { result, strippedKeys: gatesStripped } = sanitizeGatesConfig(afterExternal);
|
|
185
|
+
return { result, strippedKeys: [...externalStripped, ...gatesStripped] };
|
|
171
186
|
}
|
|
172
187
|
function formatZodIssues(error) {
|
|
173
188
|
if (error.issues.length === 0)
|
|
@@ -205,168 +220,142 @@ function stripUnrecognizedKeys(raw, error) {
|
|
|
205
220
|
}
|
|
206
221
|
return { cleaned, removed };
|
|
207
222
|
}
|
|
208
|
-
function
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
223
|
+
function warningForRemovedKeys(removedKeys) {
|
|
224
|
+
return `Ignored ${removedKeys.length} invalid or unrecognized config key(s): ${removedKeys.join(", ")}. The rest of your configuration was preserved. Fix or remove these keys.`;
|
|
225
|
+
}
|
|
226
|
+
function rawFullAutoLocked(raw) {
|
|
227
|
+
if (!raw || typeof raw !== "object")
|
|
228
|
+
return false;
|
|
229
|
+
const fullAuto = raw.full_auto;
|
|
230
|
+
if (!fullAuto || typeof fullAuto !== "object" || Array.isArray(fullAuto)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return fullAuto.locked === true;
|
|
234
|
+
}
|
|
235
|
+
function buildConfigWithMeta(rawUserConfig, rawProjectConfig, loadedFromFile, configHadErrors) {
|
|
236
|
+
let mergedRaw = rawUserConfig ?? {};
|
|
237
|
+
if (rawProjectConfig) {
|
|
238
|
+
mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
|
|
239
|
+
}
|
|
240
|
+
if (rawFullAutoLocked(rawUserConfig) || rawFullAutoLocked(rawProjectConfig)) {
|
|
241
|
+
const fa = mergedRaw.full_auto && typeof mergedRaw.full_auto === "object" && !Array.isArray(mergedRaw.full_auto) ? mergedRaw.full_auto : {};
|
|
242
|
+
mergedRaw = { ...mergedRaw, full_auto: { ...fa, locked: true } };
|
|
243
|
+
}
|
|
244
|
+
mergedRaw = migratePresetsConfig(mergedRaw);
|
|
245
|
+
const { result: sanitized, strippedKeys: gatesStripped } = sanitizeSectionConfigs(mergedRaw);
|
|
246
|
+
mergedRaw = sanitized;
|
|
247
|
+
const sanitizedWarning = gatesStripped.length > 0 ? warningForRemovedKeys(gatesStripped) : undefined;
|
|
248
|
+
const secure = (cfg) => loadedFromFile && configHadErrors ? PluginConfigSchema.parse({
|
|
249
|
+
...cfg,
|
|
212
250
|
guardrails: { enabled: true }
|
|
213
|
-
}) :
|
|
214
|
-
const
|
|
251
|
+
}) : cfg;
|
|
252
|
+
const firstResult = PluginConfigSchema.safeParse(mergedRaw);
|
|
253
|
+
if (firstResult.success) {
|
|
254
|
+
const config = secure(firstResult.data);
|
|
255
|
+
if (loadedFromFile && configHadErrors) {
|
|
256
|
+
const securityWarning = "\u26A0\uFE0F SECURITY: Falling back to conservative defaults with guardrails ENABLED. Fix the config file to restore custom configuration.";
|
|
257
|
+
advisoryWarn(`[opencode-swarm] ${securityWarning}`);
|
|
258
|
+
return {
|
|
259
|
+
config,
|
|
260
|
+
recovery: "guardrails_defaults",
|
|
261
|
+
removedKeys: [...gatesStripped],
|
|
262
|
+
warnings: [
|
|
263
|
+
...sanitizedWarning ? [sanitizedWarning] : [],
|
|
264
|
+
securityWarning
|
|
265
|
+
]
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
if (sanitizedWarning)
|
|
269
|
+
advisoryWarn(`[opencode-swarm] ${sanitizedWarning}`);
|
|
270
|
+
return {
|
|
271
|
+
config,
|
|
272
|
+
recovery: gatesStripped.length > 0 ? "stripped_keys" : "none",
|
|
273
|
+
removedKeys: [...gatesStripped],
|
|
274
|
+
warnings: sanitizedWarning ? [sanitizedWarning] : []
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
const { cleaned, removed } = stripUnrecognizedKeys(mergedRaw, firstResult.error);
|
|
215
278
|
if (removed.length > 0) {
|
|
216
279
|
const recovered = PluginConfigSchema.safeParse(cleaned);
|
|
217
280
|
if (recovered.success) {
|
|
218
|
-
const
|
|
281
|
+
const removedKeys = [...gatesStripped, ...removed];
|
|
282
|
+
const warning = warningForRemovedKeys(removedKeys);
|
|
219
283
|
advisoryWarn(`[opencode-swarm] ${warning}`);
|
|
220
284
|
return {
|
|
221
285
|
config: secure(recovered.data),
|
|
222
286
|
recovery: "stripped_keys",
|
|
223
|
-
removedKeys
|
|
287
|
+
removedKeys,
|
|
224
288
|
warnings: [warning]
|
|
225
289
|
};
|
|
226
290
|
}
|
|
227
291
|
}
|
|
228
292
|
if (rawUserConfig) {
|
|
229
|
-
const userSanitized = sanitizeSectionConfigs(rawUserConfig
|
|
293
|
+
const { result: userSanitized, strippedKeys: userGatesStripped } = sanitizeSectionConfigs(rawUserConfig);
|
|
230
294
|
const userParseResult = PluginConfigSchema.safeParse(userSanitized);
|
|
231
295
|
if (userParseResult.success) {
|
|
232
|
-
|
|
233
|
-
advisoryWarn(`[opencode-swarm] ${warning}`);
|
|
296
|
+
advisoryWarn("[opencode-swarm] Project config ignored due to validation errors. Using user config.");
|
|
234
297
|
return {
|
|
235
298
|
config: secure(userParseResult.data),
|
|
236
299
|
recovery: "user_only",
|
|
237
|
-
removedKeys: [],
|
|
238
|
-
warnings: [
|
|
300
|
+
removedKeys: [...gatesStripped, ...userGatesStripped],
|
|
301
|
+
warnings: [
|
|
302
|
+
"Project config ignored due to validation errors; using user config."
|
|
303
|
+
]
|
|
239
304
|
};
|
|
240
305
|
}
|
|
241
306
|
const userStripped = stripUnrecognizedKeys(userSanitized, userParseResult.error);
|
|
242
307
|
if (userStripped.removed.length > 0) {
|
|
243
308
|
const userRecovered = PluginConfigSchema.safeParse(userStripped.cleaned);
|
|
244
309
|
if (userRecovered.success) {
|
|
245
|
-
|
|
246
|
-
advisoryWarn(`[opencode-swarm] ${warning}`);
|
|
310
|
+
advisoryWarn(`[opencode-swarm] Project config ignored; also ignored ${userStripped.removed.length} unrecognized user-config key(s): ${userStripped.removed.join(", ")}.`);
|
|
247
311
|
return {
|
|
248
312
|
config: secure(userRecovered.data),
|
|
249
313
|
recovery: "user_only",
|
|
250
|
-
removedKeys:
|
|
251
|
-
|
|
314
|
+
removedKeys: [
|
|
315
|
+
...gatesStripped,
|
|
316
|
+
...userGatesStripped,
|
|
317
|
+
...userStripped.removed
|
|
318
|
+
],
|
|
319
|
+
warnings: [
|
|
320
|
+
"Project config ignored due to validation errors; using user config."
|
|
321
|
+
]
|
|
252
322
|
};
|
|
253
323
|
}
|
|
254
324
|
}
|
|
255
325
|
}
|
|
256
|
-
const offending = stripUnrecognizedKeys(mergedRaw,
|
|
257
|
-
const warnings = [];
|
|
326
|
+
const offending = stripUnrecognizedKeys(mergedRaw, firstResult.error).removed;
|
|
258
327
|
if (offending.length > 0) {
|
|
259
|
-
|
|
260
|
-
advisoryWarn(`[opencode-swarm] ${warning}`);
|
|
261
|
-
warnings.push(warning);
|
|
328
|
+
advisoryWarn(`[opencode-swarm] Merged config validation failed. Unrecognized key(s): ${offending.join(", ")}.`);
|
|
262
329
|
} else {
|
|
263
|
-
advisoryWarn("[opencode-swarm] Merged config validation failed:", formatZodIssues(
|
|
264
|
-
warnings.push("Merged config validation failed.");
|
|
330
|
+
advisoryWarn("[opencode-swarm] Merged config validation failed:", formatZodIssues(firstResult.error));
|
|
265
331
|
}
|
|
266
|
-
|
|
267
|
-
advisoryWarn(`[opencode-swarm] ${securityWarning}`);
|
|
268
|
-
warnings.push(securityWarning);
|
|
332
|
+
advisoryWarn("[opencode-swarm] \u26A0\uFE0F SECURITY: Falling back to conservative defaults with guardrails ENABLED. Fix the config file to restore custom configuration.");
|
|
269
333
|
return {
|
|
270
334
|
config: PluginConfigSchema.parse({ guardrails: { enabled: true } }),
|
|
271
335
|
recovery: "guardrails_defaults",
|
|
272
|
-
removedKeys:
|
|
273
|
-
warnings
|
|
336
|
+
removedKeys: [...gatesStripped],
|
|
337
|
+
warnings: [
|
|
338
|
+
"Config failed validation; using safe defaults with guardrails enabled."
|
|
339
|
+
]
|
|
274
340
|
};
|
|
275
341
|
}
|
|
276
|
-
function rawFullAutoLocked(raw) {
|
|
277
|
-
if (!raw || typeof raw !== "object")
|
|
278
|
-
return false;
|
|
279
|
-
const fullAuto = raw.full_auto;
|
|
280
|
-
if (!fullAuto || typeof fullAuto !== "object" || Array.isArray(fullAuto)) {
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
283
|
-
return fullAuto.locked === true;
|
|
284
|
-
}
|
|
285
342
|
function loadPluginConfig(directory) {
|
|
286
343
|
const userConfigPath = path.join(getUserConfigDir(), "opencode", CONFIG_FILENAME);
|
|
287
344
|
const projectConfigPath = path.join(directory, ".opencode", CONFIG_FILENAME);
|
|
288
345
|
const userResult = loadRawConfigFromPath(userConfigPath);
|
|
289
346
|
const projectResult = loadRawConfigFromPath(projectConfigPath);
|
|
290
|
-
const rawUserConfig = userResult.config;
|
|
291
|
-
const rawProjectConfig = projectResult.config;
|
|
292
347
|
const loadedFromFile = userResult.fileExisted || projectResult.fileExisted;
|
|
293
348
|
const configHadErrors = userResult.hadError || projectResult.hadError;
|
|
294
|
-
|
|
295
|
-
if (rawProjectConfig) {
|
|
296
|
-
mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
|
|
297
|
-
}
|
|
298
|
-
if (rawFullAutoLocked(rawUserConfig) || rawFullAutoLocked(rawProjectConfig)) {
|
|
299
|
-
const fullAutoRaw = mergedRaw.full_auto && typeof mergedRaw.full_auto === "object" && !Array.isArray(mergedRaw.full_auto) ? mergedRaw.full_auto : {};
|
|
300
|
-
mergedRaw = {
|
|
301
|
-
...mergedRaw,
|
|
302
|
-
full_auto: { ...fullAutoRaw, locked: true }
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
mergedRaw = migratePresetsConfig(mergedRaw);
|
|
306
|
-
mergedRaw = sanitizeSectionConfigs(mergedRaw);
|
|
307
|
-
const result = PluginConfigSchema.safeParse(mergedRaw);
|
|
308
|
-
if (result.success) {
|
|
309
|
-
if (loadedFromFile && configHadErrors) {
|
|
310
|
-
return PluginConfigSchema.parse({
|
|
311
|
-
...mergedRaw,
|
|
312
|
-
guardrails: { enabled: true }
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
return result.data;
|
|
316
|
-
}
|
|
317
|
-
const { config } = parseConfigWithFallback(mergedRaw, rawUserConfig, result, loadedFromFile, configHadErrors);
|
|
318
|
-
return config;
|
|
349
|
+
return buildConfigWithMeta(userResult.config, projectResult.config, loadedFromFile, configHadErrors).config;
|
|
319
350
|
}
|
|
320
351
|
function loadPluginConfigWithMeta(directory) {
|
|
321
352
|
const userConfigPath = path.join(getUserConfigDir(), "opencode", CONFIG_FILENAME);
|
|
322
353
|
const projectConfigPath = path.join(directory, ".opencode", CONFIG_FILENAME);
|
|
323
354
|
const userResult = loadRawConfigFromPath(userConfigPath);
|
|
324
355
|
const projectResult = loadRawConfigFromPath(projectConfigPath);
|
|
325
|
-
const rawUserConfig = userResult.config;
|
|
326
|
-
const rawProjectConfig = projectResult.config;
|
|
327
356
|
const loadedFromFile = userResult.fileExisted || projectResult.fileExisted;
|
|
328
357
|
const configHadErrors = userResult.hadError || projectResult.hadError;
|
|
329
|
-
|
|
330
|
-
if (rawProjectConfig) {
|
|
331
|
-
mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
|
|
332
|
-
}
|
|
333
|
-
if (rawFullAutoLocked(rawUserConfig) || rawFullAutoLocked(rawProjectConfig)) {
|
|
334
|
-
const fullAutoRaw = mergedRaw.full_auto && typeof mergedRaw.full_auto === "object" && !Array.isArray(mergedRaw.full_auto) ? mergedRaw.full_auto : {};
|
|
335
|
-
mergedRaw = {
|
|
336
|
-
...mergedRaw,
|
|
337
|
-
full_auto: { ...fullAutoRaw, locked: true }
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
mergedRaw = migratePresetsConfig(mergedRaw);
|
|
341
|
-
mergedRaw = sanitizeSectionConfigs(mergedRaw);
|
|
342
|
-
const result = PluginConfigSchema.safeParse(mergedRaw);
|
|
343
|
-
if (result.success) {
|
|
344
|
-
if (loadedFromFile && configHadErrors) {
|
|
345
|
-
const config2 = PluginConfigSchema.parse({
|
|
346
|
-
...mergedRaw,
|
|
347
|
-
guardrails: { enabled: true }
|
|
348
|
-
});
|
|
349
|
-
return {
|
|
350
|
-
config: config2,
|
|
351
|
-
loadedFromFile,
|
|
352
|
-
configHadErrors,
|
|
353
|
-
recovery: "guardrails_defaults",
|
|
354
|
-
removedKeys: [],
|
|
355
|
-
warnings: [
|
|
356
|
-
"\u26A0\uFE0F SECURITY: Falling back to conservative defaults with guardrails ENABLED. Fix the config file to restore custom configuration."
|
|
357
|
-
]
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
return {
|
|
361
|
-
config: result.data,
|
|
362
|
-
loadedFromFile,
|
|
363
|
-
configHadErrors,
|
|
364
|
-
recovery: "none",
|
|
365
|
-
removedKeys: [],
|
|
366
|
-
warnings: []
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
const { config, recovery, removedKeys, warnings } = parseConfigWithFallback(mergedRaw, rawUserConfig, result, loadedFromFile, configHadErrors);
|
|
358
|
+
const { config, recovery, removedKeys, warnings } = buildConfigWithMeta(userResult.config, projectResult.config, loadedFromFile, configHadErrors);
|
|
370
359
|
return {
|
|
371
360
|
config,
|
|
372
361
|
loadedFromFile,
|
|
@@ -414,37 +403,6 @@ async function loadRawConfigFromPathAsync(configPath) {
|
|
|
414
403
|
return { config: null, fileExisted: true, hadError: true };
|
|
415
404
|
}
|
|
416
405
|
}
|
|
417
|
-
function reduceParsedConfig(rawUserConfig, rawProjectConfig, loadedFromFile, configHadErrors) {
|
|
418
|
-
let mergedRaw = rawUserConfig ?? {};
|
|
419
|
-
if (rawProjectConfig) {
|
|
420
|
-
mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
|
|
421
|
-
}
|
|
422
|
-
mergedRaw = migratePresetsConfig(mergedRaw);
|
|
423
|
-
mergedRaw = sanitizeSectionConfigs(mergedRaw);
|
|
424
|
-
const result = PluginConfigSchema.safeParse(mergedRaw);
|
|
425
|
-
if (result.success) {
|
|
426
|
-
if (loadedFromFile && configHadErrors) {
|
|
427
|
-
return {
|
|
428
|
-
config: PluginConfigSchema.parse({
|
|
429
|
-
...mergedRaw,
|
|
430
|
-
guardrails: { enabled: true }
|
|
431
|
-
}),
|
|
432
|
-
recovery: "guardrails_defaults",
|
|
433
|
-
removedKeys: [],
|
|
434
|
-
warnings: [
|
|
435
|
-
"\u26A0\uFE0F SECURITY: Falling back to conservative defaults with guardrails ENABLED. Fix the config file to restore custom configuration."
|
|
436
|
-
]
|
|
437
|
-
};
|
|
438
|
-
}
|
|
439
|
-
return {
|
|
440
|
-
config: result.data,
|
|
441
|
-
recovery: "none",
|
|
442
|
-
removedKeys: [],
|
|
443
|
-
warnings: []
|
|
444
|
-
};
|
|
445
|
-
}
|
|
446
|
-
return parseConfigWithFallback(mergedRaw, rawUserConfig, result, loadedFromFile, configHadErrors);
|
|
447
|
-
}
|
|
448
406
|
async function loadPluginConfigWithMetaAsync(directory) {
|
|
449
407
|
const userConfigPath = path.join(getUserConfigDir(), "opencode", CONFIG_FILENAME);
|
|
450
408
|
const projectConfigPath = path.join(directory, ".opencode", CONFIG_FILENAME);
|
|
@@ -454,7 +412,7 @@ async function loadPluginConfigWithMetaAsync(directory) {
|
|
|
454
412
|
]);
|
|
455
413
|
const loadedFromFile = userResult.fileExisted || projectResult.fileExisted;
|
|
456
414
|
const configHadErrors = userResult.hadError || projectResult.hadError;
|
|
457
|
-
const { config, recovery, removedKeys, warnings } =
|
|
415
|
+
const { config, recovery, removedKeys, warnings } = buildConfigWithMeta(userResult.config, projectResult.config, loadedFromFile, configHadErrors);
|
|
458
416
|
return {
|
|
459
417
|
config,
|
|
460
418
|
loadedFromFile,
|
|
@@ -608,7 +608,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
|
|
|
608
608
|
deltas.push({ id, delta });
|
|
609
609
|
}
|
|
610
610
|
if (deltas.length > 0) {
|
|
611
|
-
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-
|
|
611
|
+
const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-efvtng9t.js");
|
|
612
612
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
613
613
|
}
|
|
614
614
|
return {
|
|
@@ -650,7 +650,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
650
650
|
const recovered = touched.filter((e) => e.confidence > CONFIDENCE_FLOOR + FLOOR_EPSILON && e.confidence_floor_demoted);
|
|
651
651
|
if (atFloor.length === 0 && recovered.length === 0)
|
|
652
652
|
return;
|
|
653
|
-
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-
|
|
653
|
+
const { readKnowledgeCounterRollups, effectiveRetrievalOutcomes } = await import("./knowledge-events-7k82xk36.js");
|
|
654
654
|
const rollups = await readKnowledgeCounterRollups(directory);
|
|
655
655
|
const flagIds = new Set;
|
|
656
656
|
for (const e of atFloor) {
|
|
@@ -717,11 +717,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
|
|
|
717
717
|
});
|
|
718
718
|
}
|
|
719
719
|
if (action === "quarantine" && toQuarantine.length > 0) {
|
|
720
|
-
const { quarantineEntry } = await import("./knowledge-validator-
|
|
721
|
-
const { KnowledgeConfigSchema } = await import("./schema-
|
|
720
|
+
const { quarantineEntry } = await import("./knowledge-validator-jh93eagj.js");
|
|
721
|
+
const { KnowledgeConfigSchema } = await import("./schema-fa033pqw.js");
|
|
722
722
|
let config;
|
|
723
723
|
try {
|
|
724
|
-
const { loadPluginConfigWithMeta } = await import("./index-
|
|
724
|
+
const { loadPluginConfigWithMeta } = await import("./index-c48dvb6j.js");
|
|
725
725
|
const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
|
|
726
726
|
config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
|
|
727
727
|
} catch {
|