opencode-swarm 7.127.1 → 7.129.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/dist/cli/{curation-policy-82czah39.js → curation-policy-qwj9yxvp.js} +2 -2
- package/dist/cli/{curator-llm-factory-4t2h2p60.js → curator-llm-factory-j35jd864.js} +9 -9
- package/dist/cli/{curator-qqd1fvvg.js → curator-wywrxn1j.js} +9 -9
- package/dist/cli/{guardrail-explain-4yg67c3t.js → guardrail-explain-850vrn06.js} +10 -10
- package/dist/cli/{hive-promoter-14jh86kj.js → hive-promoter-w2hf8w69.js} +9 -9
- package/dist/cli/{index-pbw1ncre.js → index-3a0dthh5.js} +10 -10
- package/dist/cli/{index-edv27z4p.js → index-4gsqjp9p.js} +1 -1
- package/dist/cli/{index-c4mcheyz.js → index-9s0ztmmz.js} +3 -3
- package/dist/cli/{index-ns62nv6t.js → index-b2m6mtde.js} +2 -2
- package/dist/cli/{index-1mwdhq2p.js → index-d4zjjtqs.js} +1 -1
- package/dist/cli/{index-hv2p03f3.js → index-dbn9d4kj.js} +237 -4
- package/dist/cli/{index-bn3w6ym4.js → index-e3xtpsmf.js} +26 -26
- package/dist/cli/{index-72envp1b.js → index-gy9h08cg.js} +3 -3
- package/dist/cli/{index-ff3j65em.js → index-her5rv14.js} +4 -4
- package/dist/cli/{index-3ntrn97w.js → index-jmsnbct2.js} +1 -1
- package/dist/cli/{index-8cnpsbk5.js → index-rmyxgxpj.js} +1 -1
- package/dist/cli/{index-gn62e04k.js → index-zty6p8ps.js} +1 -1
- package/dist/cli/index.js +9 -9
- package/dist/cli/{knowledge-escalator-b3k4b8pk.js → knowledge-escalator-h6jhw20r.js} +3 -3
- package/dist/cli/{knowledge-events-4z5rkefv.js → knowledge-events-wtyjkcg0.js} +1 -1
- package/dist/cli/{knowledge-store-c0t16yr4.js → knowledge-store-a1xr70yg.js} +1 -1
- package/dist/cli/{knowledge-validator-cs33ws57.js → knowledge-validator-afpv79e3.js} +4 -4
- package/dist/cli/{scan-cursor-rgnarf67.js → scan-cursor-hh6gdzrg.js} +2 -2
- package/dist/cli/{skill-generator-e8c2r816.js → skill-generator-dmshq3p6.js} +5 -5
- package/dist/config/loader-recovery.d.ts +95 -0
- package/dist/config/loader.d.ts +5 -1
- package/dist/config/sanitize-malformed-values.d.ts +53 -0
- package/dist/hooks/auto-review.d.ts +9 -1
- package/dist/index.js +19 -19
- package/dist/turbo/lean/integration.d.ts +2 -1
- package/dist/utils/inline-fallback-advancer.d.ts +75 -0
- package/package.json +1 -1
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
authorizeCuration,
|
|
5
5
|
buildConfigFingerprintInput,
|
|
6
6
|
readCohortConfigFingerprint
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-jmsnbct2.js";
|
|
8
8
|
import"./index-rtry5xyf.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-d4zjjtqs.js";
|
|
10
10
|
import"./index-ae75rja9.js";
|
|
11
11
|
import"./index-q27bajqb.js";
|
|
12
12
|
import"./index-zgwm4ryv.js";
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCuratorLLMDelegate
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-e3xtpsmf.js";
|
|
5
5
|
import"./index-v4n224r1.js";
|
|
6
6
|
import"./index-cpssctv1.js";
|
|
7
7
|
import"./index-kk1scggc.js";
|
|
8
8
|
import"./index-4905hd2m.js";
|
|
9
9
|
import"./index-134d35c1.js";
|
|
10
10
|
import"./index-6n2jpz7x.js";
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
11
|
+
import"./index-9s0ztmmz.js";
|
|
12
|
+
import"./index-her5rv14.js";
|
|
13
|
+
import"./index-zty6p8ps.js";
|
|
14
14
|
import"./index-vxv732ex.js";
|
|
15
15
|
import"./index-c8s9a3zh.js";
|
|
16
16
|
import"./index-9ss2m4rs.js";
|
|
17
17
|
import"./index-23zsx7dm.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
18
|
+
import"./index-b2m6mtde.js";
|
|
19
|
+
import"./index-jmsnbct2.js";
|
|
20
20
|
import"./index-rtry5xyf.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-gy9h08cg.js";
|
|
22
|
+
import"./index-d4zjjtqs.js";
|
|
23
23
|
import"./index-ae75rja9.js";
|
|
24
24
|
import"./index-q27bajqb.js";
|
|
25
|
-
import"./index-
|
|
25
|
+
import"./index-dbn9d4kj.js";
|
|
26
26
|
import"./index-k5jrywpr.js";
|
|
27
27
|
import"./index-n832052r.js";
|
|
28
28
|
import"./index-7ttstfv6.js";
|
|
@@ -14,28 +14,28 @@ import {
|
|
|
14
14
|
runCuratorInit,
|
|
15
15
|
runCuratorPhase,
|
|
16
16
|
writeCuratorSummary
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-e3xtpsmf.js";
|
|
18
18
|
import"./index-v4n224r1.js";
|
|
19
19
|
import"./index-cpssctv1.js";
|
|
20
20
|
import"./index-kk1scggc.js";
|
|
21
21
|
import"./index-4905hd2m.js";
|
|
22
22
|
import"./index-134d35c1.js";
|
|
23
23
|
import"./index-6n2jpz7x.js";
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
26
|
-
import"./index-
|
|
24
|
+
import"./index-9s0ztmmz.js";
|
|
25
|
+
import"./index-her5rv14.js";
|
|
26
|
+
import"./index-zty6p8ps.js";
|
|
27
27
|
import"./index-vxv732ex.js";
|
|
28
28
|
import"./index-c8s9a3zh.js";
|
|
29
29
|
import"./index-9ss2m4rs.js";
|
|
30
30
|
import"./index-23zsx7dm.js";
|
|
31
|
-
import"./index-
|
|
32
|
-
import"./index-
|
|
31
|
+
import"./index-b2m6mtde.js";
|
|
32
|
+
import"./index-jmsnbct2.js";
|
|
33
33
|
import"./index-rtry5xyf.js";
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
34
|
+
import"./index-gy9h08cg.js";
|
|
35
|
+
import"./index-d4zjjtqs.js";
|
|
36
36
|
import"./index-ae75rja9.js";
|
|
37
37
|
import"./index-q27bajqb.js";
|
|
38
|
-
import"./index-
|
|
38
|
+
import"./index-dbn9d4kj.js";
|
|
39
39
|
import"./index-k5jrywpr.js";
|
|
40
40
|
import"./index-n832052r.js";
|
|
41
41
|
import"./index-7ttstfv6.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-rmyxgxpj.js";
|
|
5
|
+
import"./index-e3xtpsmf.js";
|
|
6
6
|
import"./index-v4n224r1.js";
|
|
7
7
|
import"./index-cpssctv1.js";
|
|
8
8
|
import"./index-kk1scggc.js";
|
|
9
9
|
import"./index-4905hd2m.js";
|
|
10
10
|
import"./index-134d35c1.js";
|
|
11
11
|
import"./index-6n2jpz7x.js";
|
|
12
|
-
import"./index-
|
|
13
|
-
import"./index-
|
|
14
|
-
import"./index-
|
|
12
|
+
import"./index-9s0ztmmz.js";
|
|
13
|
+
import"./index-her5rv14.js";
|
|
14
|
+
import"./index-zty6p8ps.js";
|
|
15
15
|
import"./index-vxv732ex.js";
|
|
16
16
|
import"./index-c8s9a3zh.js";
|
|
17
17
|
import"./index-9ss2m4rs.js";
|
|
18
18
|
import"./index-23zsx7dm.js";
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
19
|
+
import"./index-b2m6mtde.js";
|
|
20
|
+
import"./index-jmsnbct2.js";
|
|
21
21
|
import"./index-rtry5xyf.js";
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
22
|
+
import"./index-gy9h08cg.js";
|
|
23
|
+
import"./index-d4zjjtqs.js";
|
|
24
24
|
import"./index-ae75rja9.js";
|
|
25
25
|
import"./index-q27bajqb.js";
|
|
26
|
-
import"./index-
|
|
26
|
+
import"./index-dbn9d4kj.js";
|
|
27
27
|
import"./index-k5jrywpr.js";
|
|
28
28
|
import"./index-n832052r.js";
|
|
29
29
|
import"./index-7ttstfv6.js";
|
|
@@ -7,30 +7,30 @@ import {
|
|
|
7
7
|
isHiveEligible,
|
|
8
8
|
promoteFromSwarm,
|
|
9
9
|
promoteToHive
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-e3xtpsmf.js";
|
|
11
11
|
import"./index-v4n224r1.js";
|
|
12
12
|
import"./index-cpssctv1.js";
|
|
13
13
|
import"./index-kk1scggc.js";
|
|
14
14
|
import"./index-4905hd2m.js";
|
|
15
15
|
import"./index-134d35c1.js";
|
|
16
16
|
import"./index-6n2jpz7x.js";
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
17
|
+
import"./index-9s0ztmmz.js";
|
|
18
|
+
import"./index-her5rv14.js";
|
|
19
|
+
import"./index-zty6p8ps.js";
|
|
20
20
|
import"./index-vxv732ex.js";
|
|
21
21
|
import"./index-c8s9a3zh.js";
|
|
22
22
|
import"./index-9ss2m4rs.js";
|
|
23
23
|
import"./index-23zsx7dm.js";
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
24
|
+
import"./index-b2m6mtde.js";
|
|
25
|
+
import"./index-jmsnbct2.js";
|
|
26
26
|
import"./index-rtry5xyf.js";
|
|
27
27
|
import {
|
|
28
28
|
resolveHiveKnowledgePath
|
|
29
|
-
} from "./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
} from "./index-gy9h08cg.js";
|
|
30
|
+
import"./index-d4zjjtqs.js";
|
|
31
31
|
import"./index-ae75rja9.js";
|
|
32
32
|
import"./index-q27bajqb.js";
|
|
33
|
-
import"./index-
|
|
33
|
+
import"./index-dbn9d4kj.js";
|
|
34
34
|
import"./index-k5jrywpr.js";
|
|
35
35
|
import"./index-n832052r.js";
|
|
36
36
|
import"./index-7ttstfv6.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-rmyxgxpj.js";
|
|
5
5
|
import {
|
|
6
6
|
handleGuardrailLog
|
|
7
7
|
} from "./index-8etcyr9r.js";
|
|
@@ -83,28 +83,28 @@ import {
|
|
|
83
83
|
handleWriteRetroCommand,
|
|
84
84
|
normalizeSwarmCommandInput,
|
|
85
85
|
resolveCommand
|
|
86
|
-
} from "./index-
|
|
86
|
+
} from "./index-e3xtpsmf.js";
|
|
87
87
|
import"./index-v4n224r1.js";
|
|
88
88
|
import"./index-cpssctv1.js";
|
|
89
89
|
import"./index-kk1scggc.js";
|
|
90
90
|
import"./index-4905hd2m.js";
|
|
91
91
|
import"./index-134d35c1.js";
|
|
92
92
|
import"./index-6n2jpz7x.js";
|
|
93
|
-
import"./index-
|
|
94
|
-
import"./index-
|
|
95
|
-
import"./index-
|
|
93
|
+
import"./index-9s0ztmmz.js";
|
|
94
|
+
import"./index-her5rv14.js";
|
|
95
|
+
import"./index-zty6p8ps.js";
|
|
96
96
|
import"./index-vxv732ex.js";
|
|
97
97
|
import"./index-c8s9a3zh.js";
|
|
98
98
|
import"./index-9ss2m4rs.js";
|
|
99
99
|
import"./index-23zsx7dm.js";
|
|
100
|
-
import"./index-
|
|
101
|
-
import"./index-
|
|
100
|
+
import"./index-b2m6mtde.js";
|
|
101
|
+
import"./index-jmsnbct2.js";
|
|
102
102
|
import"./index-rtry5xyf.js";
|
|
103
|
-
import"./index-
|
|
104
|
-
import"./index-
|
|
103
|
+
import"./index-gy9h08cg.js";
|
|
104
|
+
import"./index-d4zjjtqs.js";
|
|
105
105
|
import"./index-ae75rja9.js";
|
|
106
106
|
import"./index-q27bajqb.js";
|
|
107
|
-
import"./index-
|
|
107
|
+
import"./index-dbn9d4kj.js";
|
|
108
108
|
import"./index-k5jrywpr.js";
|
|
109
109
|
import"./index-n832052r.js";
|
|
110
110
|
import {
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
import {
|
|
3
3
|
ALLOWED_SKILL_PATH_PREFIXES,
|
|
4
4
|
validateSkillPath
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-b2m6mtde.js";
|
|
6
6
|
import {
|
|
7
7
|
computeOutcomeSignal,
|
|
8
8
|
readKnowledge,
|
|
9
9
|
resolveHiveKnowledgePath,
|
|
10
10
|
resolveSwarmKnowledgePath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-gy9h08cg.js";
|
|
13
13
|
import {
|
|
14
14
|
effectiveRetrievalOutcomes,
|
|
15
15
|
readKnowledgeCounterRollups
|
|
16
|
-
} from "./index-
|
|
16
|
+
} from "./index-d4zjjtqs.js";
|
|
17
17
|
import {
|
|
18
18
|
init_knowledge_types,
|
|
19
19
|
isActiveStatus
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
authorizeCuration
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-jmsnbct2.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearDuplicate,
|
|
7
7
|
inferTags,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
resolveSwarmKnowledgePath,
|
|
10
10
|
resolveSwarmRejectedPath,
|
|
11
11
|
transactKnowledge
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-gy9h08cg.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveKnowledgeStoreDir
|
|
15
15
|
} from "./index-q27bajqb.js";
|
|
@@ -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-a1xr70yg.js");
|
|
612
612
|
await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
|
|
613
613
|
}
|
|
614
614
|
return {
|
|
@@ -23,6 +23,211 @@ import {
|
|
|
23
23
|
__export
|
|
24
24
|
} from "./index-a76rekgs.js";
|
|
25
25
|
|
|
26
|
+
// src/config/sanitize-malformed-values.ts
|
|
27
|
+
function dotted(p) {
|
|
28
|
+
return p.map(String).join(".");
|
|
29
|
+
}
|
|
30
|
+
function deepClone(obj) {
|
|
31
|
+
try {
|
|
32
|
+
return structuredClone(obj);
|
|
33
|
+
} catch {
|
|
34
|
+
return JSON.parse(JSON.stringify(obj));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function countNodes(obj) {
|
|
38
|
+
if (obj === null || obj === undefined)
|
|
39
|
+
return 0;
|
|
40
|
+
if (typeof obj !== "object")
|
|
41
|
+
return 1;
|
|
42
|
+
if (Array.isArray(obj)) {
|
|
43
|
+
let count2 = 0;
|
|
44
|
+
for (const el of obj)
|
|
45
|
+
count2 += 1 + countNodes(el);
|
|
46
|
+
return count2;
|
|
47
|
+
}
|
|
48
|
+
let count = 0;
|
|
49
|
+
for (const _key of Object.keys(obj)) {
|
|
50
|
+
count += 1;
|
|
51
|
+
}
|
|
52
|
+
for (const val of Object.values(obj)) {
|
|
53
|
+
count += countNodes(val);
|
|
54
|
+
}
|
|
55
|
+
return count;
|
|
56
|
+
}
|
|
57
|
+
function selectDeepest(paths) {
|
|
58
|
+
const sorted = [...paths].sort((a, b) => b.length - a.length);
|
|
59
|
+
const kept = [];
|
|
60
|
+
for (const p of sorted) {
|
|
61
|
+
if (!kept.some((q) => q.length > p.length && startsWith(q, p))) {
|
|
62
|
+
kept.push(p);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return kept;
|
|
66
|
+
}
|
|
67
|
+
function startsWith(path, prefix) {
|
|
68
|
+
if (prefix.length > path.length)
|
|
69
|
+
return false;
|
|
70
|
+
for (let i = 0;i < prefix.length; i++) {
|
|
71
|
+
if (path[i] !== prefix[i])
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
function removeAtPath(obj, path) {
|
|
77
|
+
if (path.length === 0)
|
|
78
|
+
return false;
|
|
79
|
+
let node = obj;
|
|
80
|
+
for (let i = 0;i < path.length - 1; i++) {
|
|
81
|
+
if (node === null || node === undefined || typeof node !== "object") {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const key = path[i];
|
|
85
|
+
if (Array.isArray(node)) {
|
|
86
|
+
const idx = Number(key);
|
|
87
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
node = node[idx];
|
|
91
|
+
} else {
|
|
92
|
+
node = node[String(key)];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (node === null || node === undefined || typeof node !== "object") {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
const lastSegment = path[path.length - 1];
|
|
99
|
+
if (Array.isArray(node)) {
|
|
100
|
+
const idx = Number(lastSegment);
|
|
101
|
+
if (!Number.isInteger(idx) || idx < 0 || idx >= node.length) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
node.splice(idx, 1);
|
|
105
|
+
} else {
|
|
106
|
+
delete node[String(lastSegment)];
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
function hasRemovedAncestor(p, removed) {
|
|
111
|
+
for (let len = 1;len < p.length; len++) {
|
|
112
|
+
if (removed.has(keyOf(p.slice(0, len)))) {
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
function dedupeByKey(paths) {
|
|
119
|
+
const seen = new Set;
|
|
120
|
+
const result = [];
|
|
121
|
+
for (const p of paths) {
|
|
122
|
+
const k = keyOf(p);
|
|
123
|
+
if (!seen.has(k)) {
|
|
124
|
+
seen.add(k);
|
|
125
|
+
result.push(p);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
function recordFor(path, issues) {
|
|
131
|
+
const key = keyOf(path);
|
|
132
|
+
for (const issue of issues) {
|
|
133
|
+
if (keyOf(issue.path) === key) {
|
|
134
|
+
return { path, code: issue.code, message: issue.message };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return { path, code: "unknown", message: "no matching issue found" };
|
|
138
|
+
}
|
|
139
|
+
function sanitizeMalformedValues(schema, rawConfig) {
|
|
140
|
+
if (rawConfig === null || rawConfig === undefined || typeof rawConfig !== "object" || Array.isArray(rawConfig)) {
|
|
141
|
+
return {
|
|
142
|
+
config: {},
|
|
143
|
+
recoveryWarnings: [
|
|
144
|
+
{
|
|
145
|
+
section: "<root>",
|
|
146
|
+
severity: "warn",
|
|
147
|
+
message: "Config input is not a plain object (received " + String(rawConfig === null ? "null" : typeof rawConfig) + "); schema defaults will apply."
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const fastResult = schema.safeParse(rawConfig);
|
|
153
|
+
if (fastResult.success) {
|
|
154
|
+
return { config: rawConfig, recoveryWarnings: [] };
|
|
155
|
+
}
|
|
156
|
+
const current = deepClone(rawConfig);
|
|
157
|
+
const removed = new Map;
|
|
158
|
+
const fuel = 2 * countNodes(rawConfig) + 8;
|
|
159
|
+
let recovered = false;
|
|
160
|
+
for (let iter = 0;iter < fuel; iter++) {
|
|
161
|
+
const res = schema.safeParse(current);
|
|
162
|
+
if (res.success) {
|
|
163
|
+
recovered = true;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
const issues = res.error.issues;
|
|
167
|
+
const leafCandidates = [];
|
|
168
|
+
let anyPathIssue = false;
|
|
169
|
+
for (const issue of issues) {
|
|
170
|
+
const p = issue.path;
|
|
171
|
+
if (p.length === 0)
|
|
172
|
+
continue;
|
|
173
|
+
anyPathIssue = true;
|
|
174
|
+
if (issue.code === "unrecognized_keys" && Array.isArray(issue.keys)) {
|
|
175
|
+
for (const k of issue.keys) {
|
|
176
|
+
leafCandidates.push([...p, k]);
|
|
177
|
+
}
|
|
178
|
+
} else {
|
|
179
|
+
leafCandidates.push(p);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let batch = selectDeepest(leafCandidates).filter((p) => !removed.has(keyOf(p)));
|
|
183
|
+
if (batch.length === 0 && anyPathIssue) {
|
|
184
|
+
for (const issue of issues) {
|
|
185
|
+
let q = issue.path;
|
|
186
|
+
while (q !== null && removed.has(keyOf(q))) {
|
|
187
|
+
q = q.length > 1 ? q.slice(0, -1) : null;
|
|
188
|
+
}
|
|
189
|
+
if (q !== null && !removed.has(keyOf(q))) {
|
|
190
|
+
batch.push(q);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
batch = dedupeByKey(batch);
|
|
194
|
+
}
|
|
195
|
+
if (batch.length === 0) {
|
|
196
|
+
const sections = dedupeByKey(issues.filter((i) => i.path.length > 0).map((i) => [i.path[0]])).filter((p) => !removed.has(keyOf(p)));
|
|
197
|
+
if (sections.length === 0)
|
|
198
|
+
break;
|
|
199
|
+
batch = sections;
|
|
200
|
+
}
|
|
201
|
+
for (const p of batch) {
|
|
202
|
+
if (removeAtPath(current, p)) {
|
|
203
|
+
removed.set(keyOf(p), recordFor(p, issues));
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (!recovered) {
|
|
208
|
+
const finalRes = schema.safeParse(current);
|
|
209
|
+
if (!finalRes.success) {
|
|
210
|
+
const topLevelKeys = [...Object.keys(current)];
|
|
211
|
+
for (const key of topLevelKeys) {
|
|
212
|
+
if (key in current) {
|
|
213
|
+
delete current[key];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const emptyRes = schema.safeParse(current);
|
|
217
|
+
if (!emptyRes.success) {}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
const surviving = [...removed.values()].filter((r) => !hasRemovedAncestor(r.path, removed)).sort((a, b) => a.path.length - b.path.length || keyOf(a.path).localeCompare(keyOf(b.path))).map((r) => ({
|
|
221
|
+
section: dotted(r.path),
|
|
222
|
+
severity: "warn",
|
|
223
|
+
message: `Config ${r.path.length === 1 ? "section" : "field"} "${dotted(r.path)}" was invalid (${r.code}) and was dropped; schema defaults will apply.`,
|
|
224
|
+
path: dotted(r.path)
|
|
225
|
+
}));
|
|
226
|
+
return { config: current, recoveryWarnings: surviving };
|
|
227
|
+
}
|
|
228
|
+
var keyOf = (p) => JSON.stringify(p);
|
|
229
|
+
var init_sanitize_malformed_values = () => {};
|
|
230
|
+
|
|
26
231
|
// src/config/loader.ts
|
|
27
232
|
var exports_loader = {};
|
|
28
233
|
__export(exports_loader, {
|
|
@@ -188,8 +393,8 @@ function formatZodIssues(error) {
|
|
|
188
393
|
if (error.issues.length === 0)
|
|
189
394
|
return "";
|
|
190
395
|
return error.issues.map((issue) => {
|
|
191
|
-
const
|
|
192
|
-
return
|
|
396
|
+
const dotted2 = issue.path.map(String).join(".");
|
|
397
|
+
return dotted2 ? `${dotted2}: ${issue.message}` : issue.message;
|
|
193
398
|
}).join("; ");
|
|
194
399
|
}
|
|
195
400
|
function stripUnrecognizedKeys(raw, error) {
|
|
@@ -213,8 +418,8 @@ function stripUnrecognizedKeys(raw, error) {
|
|
|
213
418
|
for (const key of keys) {
|
|
214
419
|
if (key in node) {
|
|
215
420
|
delete node[key];
|
|
216
|
-
const
|
|
217
|
-
removed.push(
|
|
421
|
+
const dotted2 = [...issue.path.map(String), key].join(".");
|
|
422
|
+
removed.push(dotted2);
|
|
218
423
|
}
|
|
219
424
|
}
|
|
220
425
|
}
|
|
@@ -311,6 +516,33 @@ function buildConfigWithMeta(rawUserConfig, rawProjectConfig, loadedFromFile, co
|
|
|
311
516
|
}
|
|
312
517
|
}
|
|
313
518
|
}
|
|
519
|
+
const rawGuardrailsDisabled = mergedRaw.guardrails && typeof mergedRaw.guardrails === "object" && !Array.isArray(mergedRaw.guardrails) && mergedRaw.guardrails.enabled === false;
|
|
520
|
+
if (!rawGuardrailsDisabled) {
|
|
521
|
+
const valueRecovery = sanitizeMalformedValues(PluginConfigSchema, mergedRaw);
|
|
522
|
+
if (valueRecovery.recoveryWarnings.length > 0) {
|
|
523
|
+
const recoveredParse = PluginConfigSchema.safeParse(valueRecovery.config);
|
|
524
|
+
if (recoveredParse.success) {
|
|
525
|
+
const removedKeys = [
|
|
526
|
+
...gatesStripped,
|
|
527
|
+
...valueRecovery.recoveryWarnings.map((w) => w.section)
|
|
528
|
+
];
|
|
529
|
+
advisoryWarn(`[opencode-swarm] Ignored ${removedKeys.length} invalid or unrecognized config key(s): ${removedKeys.join(", ")}. The rest of your configuration was preserved. Fix or remove these keys.`);
|
|
530
|
+
const secureConfig = PluginConfigSchema.parse({
|
|
531
|
+
...recoveredParse.data,
|
|
532
|
+
guardrails: {
|
|
533
|
+
...recoveredParse.data.guardrails,
|
|
534
|
+
enabled: true
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
return {
|
|
538
|
+
config: secure(secureConfig),
|
|
539
|
+
recovery: "sanitized_values",
|
|
540
|
+
removedKeys,
|
|
541
|
+
warnings: []
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
}
|
|
314
546
|
const offending = stripUnrecognizedKeys(mergedRaw, firstResult.error).removed;
|
|
315
547
|
if (offending.length > 0) {
|
|
316
548
|
advisoryWarn(`[opencode-swarm] Merged config validation failed. Unrecognized key(s): ${offending.join(", ")}.`);
|
|
@@ -434,6 +666,7 @@ function loadAgentPrompt(agentName) {
|
|
|
434
666
|
var CONFIG_FILENAME = "opencode-swarm.json", PROMPTS_DIR_NAME = "opencode-swarm", MAX_CONFIG_FILE_BYTES = 102400;
|
|
435
667
|
var init_loader = __esm(() => {
|
|
436
668
|
init_warning_buffer();
|
|
669
|
+
init_sanitize_malformed_values();
|
|
437
670
|
init_schema();
|
|
438
671
|
init_merge();
|
|
439
672
|
init_merge();
|