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.
Files changed (52) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +24 -16
  2. package/.opencode/skills/swarm-pr-review/SKILL.md +18 -14
  3. package/dist/cli/{config-doctor-akxywx0c.js → config-doctor-mfx27331.js} +2 -2
  4. package/dist/cli/{core-v1kp7anb.js → core-wg3re04e.js} +1 -1
  5. package/dist/cli/{curation-policy-dptr1rfe.js → curation-policy-n944aq62.js} +2 -2
  6. package/dist/cli/{curator-llm-factory-r648jn8e.js → curator-llm-factory-0rf29gfq.js} +14 -14
  7. package/dist/cli/{curator-23hynz78.js → curator-qfh9xty4.js} +14 -14
  8. package/dist/cli/{guardrail-explain-6atsd4vr.js → guardrail-explain-jsrjqps1.js} +15 -15
  9. package/dist/cli/{guardrail-log-222xyxfp.js → guardrail-log-61gya05m.js} +3 -3
  10. package/dist/cli/{hive-promoter-bnkhzd46.js → hive-promoter-ktt17fyf.js} +14 -14
  11. package/dist/cli/{index-jt7hnr7q.js → index-3xd9a2g7.js} +1 -1
  12. package/dist/cli/{index-gnvg72y1.js → index-4ff0x4cg.js} +79 -1
  13. package/dist/cli/{index-68fpa7ff.js → index-5nq8dp63.js} +16 -16
  14. package/dist/cli/{index-yfzn5r9s.js → index-7bxw3v5w.js} +3 -3
  15. package/dist/cli/{index-kwnsatzq.js → index-88dt7c9z.js} +2 -2
  16. package/dist/cli/{index-qzkcy22e.js → index-bf76q8q7.js} +1 -1
  17. package/dist/cli/{index-16z6txq3.js → index-c48dvb6j.js} +2 -2
  18. package/dist/cli/{index-0ff5cm9j.js → index-d88y17ht.js} +2222 -2197
  19. package/dist/cli/{index-bcgfhxzv.js → index-f97dm6tz.js} +5 -5
  20. package/dist/cli/{index-a1c9az5e.js → index-gf9cxvp0.js} +109 -151
  21. package/dist/cli/{index-mgrsx5hn.js → index-gwss5btk.js} +1 -1
  22. package/dist/cli/{index-dezgmvtw.js → index-gxw20m1d.js} +1 -1
  23. package/dist/cli/{index-2bnfwmk3.js → index-nqp13m5a.js} +1 -1
  24. package/dist/cli/{index-2yd75hms.js → index-pb8ag9vg.js} +4 -4
  25. package/dist/cli/{index-cdx337js.js → index-pf3xae4s.js} +1 -1
  26. package/dist/cli/{index-r1gdkn2d.js → index-vcqwhe9d.js} +117 -21
  27. package/dist/cli/{index-g4ef4v3m.js → index-w9cb5zwh.js} +1 -1
  28. package/dist/cli/{index-y4ry07h8.js → index-z8ftpav0.js} +2 -2
  29. package/dist/cli/index.js +14 -14
  30. package/dist/cli/{knowledge-escalator-4hc8w7sd.js → knowledge-escalator-nna0zec3.js} +3 -3
  31. package/dist/cli/{knowledge-events-kyqjv1f8.js → knowledge-events-7k82xk36.js} +1 -1
  32. package/dist/cli/{knowledge-store-06k0p1gs.js → knowledge-store-efvtng9t.js} +1 -1
  33. package/dist/cli/{knowledge-validator-42xjmcmh.js → knowledge-validator-jh93eagj.js} +4 -4
  34. package/dist/cli/{scan-cursor-gjcvpyta.js → scan-cursor-cydz8d9q.js} +2 -2
  35. package/dist/cli/{schema-69z8w1ka.js → schema-fa033pqw.js} +1 -1
  36. package/dist/cli/{scope-persistence-habn4q8a.js → scope-persistence-dm5bab50.js} +3 -1
  37. package/dist/cli/{skill-generator-t6j93mwt.js → skill-generator-8v463kj7.js} +5 -5
  38. package/dist/config/index.d.ts +1 -0
  39. package/dist/config/loader.d.ts +51 -36
  40. package/dist/hooks/delegation-gate.d.ts +14 -2
  41. package/dist/hooks/pr-workflow-gate.d.ts +57 -0
  42. package/dist/hooks/scope-guard.d.ts +6 -1
  43. package/dist/index.js +55 -49
  44. package/dist/scope/scope-binding.d.ts +21 -2
  45. package/dist/scope/scope-persistence.d.ts +6 -0
  46. package/dist/tools/index.d.ts +3 -0
  47. package/dist/tools/manifest.d.ts +3 -0
  48. package/dist/tools/prepare-pr-feedback-scope.d.ts +5 -0
  49. package/dist/tools/prepare-pr-workflow-checkout.d.ts +25 -0
  50. package/dist/tools/tool-metadata.d.ts +102 -0
  51. package/dist/tools/write-pr-review-artifact.d.ts +5 -0
  52. package/package.json +3 -3
@@ -6,13 +6,13 @@ import {
6
6
  resolveSwarmKnowledgePath,
7
7
  transactKnowledge,
8
8
  wordBigrams
9
- } from "./index-2yd75hms.js";
9
+ } from "./index-pb8ag9vg.js";
10
10
  import {
11
11
  countEntryContradictionsInWindow,
12
12
  countEntryViolationsInWindow,
13
13
  readKnowledgeEvents,
14
14
  recordKnowledgeEvent
15
- } from "./index-2bnfwmk3.js";
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-42xjmcmh.js");
193
+ const { quarantineEntry } = await import("./knowledge-validator-jh93eagj.js");
194
194
  let policyConfig;
195
195
  try {
196
- const { KnowledgeConfigSchema } = await import("./schema-69z8w1ka.js");
197
- const { loadPluginConfigWithMeta } = await import("./index-16z6txq3.js");
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-r1gdkn2d.js";
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
- ...raw,
109
- external_skills: resolveExternalSkillsConfig(esResult.data)
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
- return cleaned2;
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
- gates: gatesResult.data
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
- return cleaned;
177
+ if (!strippedKeys.includes("gates")) {
178
+ strippedKeys.push("gates");
179
+ }
180
+ return { result: cleaned, strippedKeys };
168
181
  }
169
182
  function sanitizeSectionConfigs(raw) {
170
- return sanitizeGatesConfig(sanitizeExternalSkillsConfig(raw));
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 parseConfigWithFallback(mergedRaw, rawUserConfig, failedResult, loadedFromFile, configHadErrors) {
209
- const result = failedResult;
210
- const secure = (config) => loadedFromFile && configHadErrors ? PluginConfigSchema.parse({
211
- ...config,
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
- }) : config;
214
- const { cleaned, removed } = stripUnrecognizedKeys(mergedRaw, result.error);
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 warning = `Ignored ${removed.length} unrecognized config key(s): ${removed.join(", ")}. The rest of your configuration was preserved. Fix or remove these keys.`;
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: removed,
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
- const warning = "Project config ignored due to validation errors. Using user config.";
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: [warning]
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
- const warning = `Project config ignored; also ignored ${userStripped.removed.length} unrecognized user-config key(s): ${userStripped.removed.join(", ")}.`;
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: userStripped.removed,
251
- warnings: [warning]
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, result.error).removed;
257
- const warnings = [];
326
+ const offending = stripUnrecognizedKeys(mergedRaw, firstResult.error).removed;
258
327
  if (offending.length > 0) {
259
- const warning = `Merged config validation failed. Unrecognized key(s): ${offending.join(", ")}.`;
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(result.error));
264
- warnings.push("Merged config validation failed.");
330
+ advisoryWarn("[opencode-swarm] Merged config validation failed:", formatZodIssues(firstResult.error));
265
331
  }
266
- const securityWarning = "\u26A0\uFE0F SECURITY: Falling back to conservative defaults with guardrails ENABLED. Fix the config file to restore custom configuration.";
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: offending,
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
- let mergedRaw = rawUserConfig ?? {};
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
- let mergedRaw = rawUserConfig ?? {};
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 } = reduceParsedConfig(userResult.config, projectResult.config, loadedFromFile, configHadErrors);
415
+ const { config, recovery, removedKeys, warnings } = buildConfigWithMeta(userResult.config, projectResult.config, loadedFromFile, configHadErrors);
458
416
  return {
459
417
  config,
460
418
  loadedFromFile,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-rtry5xyf.js";
5
5
  import {
6
6
  readKnowledgeEvents
7
- } from "./index-2bnfwmk3.js";
7
+ } from "./index-nqp13m5a.js";
8
8
  import {
9
9
  isLinked,
10
10
  readLinkPointer,
@@ -3,7 +3,7 @@ import {
3
3
  init_constants,
4
4
  init_schema,
5
5
  stripKnownSwarmPrefix
6
- } from "./index-r1gdkn2d.js";
6
+ } from "./index-vcqwhe9d.js";
7
7
  import {
8
8
  init_logger,
9
9
  warn
@@ -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-06k0p1gs.js");
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-kyqjv1f8.js");
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-42xjmcmh.js");
721
- const { KnowledgeConfigSchema } = await import("./schema-69z8w1ka.js");
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-16z6txq3.js");
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 {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  readKnowledge,
4
4
  transactKnowledge
5
- } from "./index-2yd75hms.js";
5
+ } from "./index-pb8ag9vg.js";
6
6
  import {
7
7
  resolveKnowledgeStoreDir
8
8
  } from "./index-q27bajqb.js";