opencode-swarm 7.128.0 → 7.129.1
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-vn1ybh31.js} +2 -2
- package/dist/cli/{curator-x5dzf1p7.js → curator-2nhjd2mn.js} +13 -13
- package/dist/cli/{curator-drift-24bdacdc.js → curator-drift-y1wm4atk.js} +1 -1
- package/dist/cli/{curator-llm-factory-rz4cbq28.js → curator-llm-factory-xbstvmpx.js} +13 -13
- package/dist/cli/{evidence-summary-service-thx1c3me.js → evidence-summary-service-hf7qq777.js} +2 -2
- package/dist/cli/{guardrail-explain-fwvxteqe.js → guardrail-explain-87wprr65.js} +14 -14
- package/dist/cli/{hive-promoter-z8gc80zq.js → hive-promoter-va29r2p0.js} +13 -13
- package/dist/cli/{index-nmedh7bw.js → index-3yd6bbnp.js} +14 -14
- package/dist/cli/{index-gn62e04k.js → index-5fnc76da.js} +1 -1
- package/dist/cli/{index-hv2p03f3.js → index-6w02qz7t.js} +250 -5
- package/dist/cli/{index-23zsx7dm.js → index-g4mnf3p5.js} +1 -1
- package/dist/cli/{index-npycj2tr.js → index-gczs3jy7.js} +41086 -40944
- package/dist/cli/{index-1mwdhq2p.js → index-kj86tyrs.js} +1 -1
- package/dist/cli/{index-edv27z4p.js → index-kxw2sx1d.js} +3 -1
- package/dist/cli/{index-kk1scggc.js → index-kzvwb2se.js} +1 -1
- package/dist/cli/{index-ff3j65em.js → index-m8vrw3pt.js} +4 -4
- package/dist/cli/{index-3ntrn97w.js → index-pgyp3tta.js} +1 -1
- package/dist/cli/{index-2445sx3d.js → index-s80bsjkj.js} +13 -4
- package/dist/cli/{index-rczj39pc.js → index-ty0xttaz.js} +1 -1
- package/dist/cli/{index-72envp1b.js → index-w2kp2zvf.js} +3 -3
- package/dist/cli/{index-ns62nv6t.js → index-waqvy9a5.js} +2 -2
- package/dist/cli/{index-c4mcheyz.js → index-wy5jy3m9.js} +3 -3
- package/dist/cli/{index-ecxwhwz7.js → index-y2pfmd0z.js} +1 -1
- package/dist/cli/index.js +13 -13
- package/dist/cli/{knowledge-escalator-b3k4b8pk.js → knowledge-escalator-5ytt2y9n.js} +3 -3
- package/dist/cli/{knowledge-events-4z5rkefv.js → knowledge-events-qnyfrsfv.js} +1 -1
- package/dist/cli/{knowledge-store-c0t16yr4.js → knowledge-store-yeybvcqw.js} +1 -1
- package/dist/cli/{knowledge-validator-cs33ws57.js → knowledge-validator-g2c4mbwa.js} +4 -4
- package/dist/cli/{pending-delegations-a1bbpp8b.js → pending-delegations-37t4xecr.js} +2 -2
- package/dist/cli/{pr-subscriptions-bxpqde8w.js → pr-subscriptions-zqbmctwz.js} +2 -2
- package/dist/cli/{scan-cursor-rgnarf67.js → scan-cursor-c5mcce5r.js} +2 -2
- package/dist/cli/{skill-generator-e8c2r816.js → skill-generator-c77e0y98.js} +5 -5
- package/dist/config/index.d.ts +1 -1
- package/dist/config/loader-recovery.d.ts +95 -0
- package/dist/config/loader.d.ts +26 -1
- package/dist/config/sanitize-malformed-values.d.ts +53 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +19 -19
- 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-pgyp3tta.js";
|
|
8
8
|
import"./index-rtry5xyf.js";
|
|
9
|
-
import"./index-
|
|
9
|
+
import"./index-kj86tyrs.js";
|
|
10
10
|
import"./index-ae75rja9.js";
|
|
11
11
|
import"./index-q27bajqb.js";
|
|
12
12
|
import"./index-zgwm4ryv.js";
|
|
@@ -14,28 +14,28 @@ import {
|
|
|
14
14
|
runCuratorInit,
|
|
15
15
|
runCuratorPhase,
|
|
16
16
|
writeCuratorSummary
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-gczs3jy7.js";
|
|
18
18
|
import"./index-v4n224r1.js";
|
|
19
19
|
import"./index-cpssctv1.js";
|
|
20
|
-
import"./index-
|
|
20
|
+
import"./index-kzvwb2se.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-wy5jy3m9.js";
|
|
25
|
+
import"./index-m8vrw3pt.js";
|
|
26
|
+
import"./index-5fnc76da.js";
|
|
27
27
|
import"./index-vxv732ex.js";
|
|
28
28
|
import"./index-c8s9a3zh.js";
|
|
29
29
|
import"./index-9ss2m4rs.js";
|
|
30
|
-
import"./index-
|
|
31
|
-
import"./index-
|
|
32
|
-
import"./index-
|
|
30
|
+
import"./index-g4mnf3p5.js";
|
|
31
|
+
import"./index-waqvy9a5.js";
|
|
32
|
+
import"./index-pgyp3tta.js";
|
|
33
33
|
import"./index-rtry5xyf.js";
|
|
34
|
-
import"./index-
|
|
35
|
-
import"./index-
|
|
34
|
+
import"./index-w2kp2zvf.js";
|
|
35
|
+
import"./index-kj86tyrs.js";
|
|
36
36
|
import"./index-ae75rja9.js";
|
|
37
37
|
import"./index-q27bajqb.js";
|
|
38
|
-
import"./index-
|
|
38
|
+
import"./index-6w02qz7t.js";
|
|
39
39
|
import"./index-k5jrywpr.js";
|
|
40
40
|
import"./index-n832052r.js";
|
|
41
41
|
import"./index-7ttstfv6.js";
|
|
@@ -47,8 +47,8 @@ import"./index-2tn5h2zp.js";
|
|
|
47
47
|
import"./index-1kz6da87.js";
|
|
48
48
|
import"./index-w9cb5zwh.js";
|
|
49
49
|
import"./index-4rhhvd1a.js";
|
|
50
|
-
import"./index-
|
|
51
|
-
import"./index-
|
|
50
|
+
import"./index-y2pfmd0z.js";
|
|
51
|
+
import"./index-s80bsjkj.js";
|
|
52
52
|
import"./index-z6xqpmqg.js";
|
|
53
53
|
import"./index-zjygnfay.js";
|
|
54
54
|
import"./index-zgwm4ryv.js";
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
createCuratorLLMDelegate
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-gczs3jy7.js";
|
|
5
5
|
import"./index-v4n224r1.js";
|
|
6
6
|
import"./index-cpssctv1.js";
|
|
7
|
-
import"./index-
|
|
7
|
+
import"./index-kzvwb2se.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-wy5jy3m9.js";
|
|
12
|
+
import"./index-m8vrw3pt.js";
|
|
13
|
+
import"./index-5fnc76da.js";
|
|
14
14
|
import"./index-vxv732ex.js";
|
|
15
15
|
import"./index-c8s9a3zh.js";
|
|
16
16
|
import"./index-9ss2m4rs.js";
|
|
17
|
-
import"./index-
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
17
|
+
import"./index-g4mnf3p5.js";
|
|
18
|
+
import"./index-waqvy9a5.js";
|
|
19
|
+
import"./index-pgyp3tta.js";
|
|
20
20
|
import"./index-rtry5xyf.js";
|
|
21
|
-
import"./index-
|
|
22
|
-
import"./index-
|
|
21
|
+
import"./index-w2kp2zvf.js";
|
|
22
|
+
import"./index-kj86tyrs.js";
|
|
23
23
|
import"./index-ae75rja9.js";
|
|
24
24
|
import"./index-q27bajqb.js";
|
|
25
|
-
import"./index-
|
|
25
|
+
import"./index-6w02qz7t.js";
|
|
26
26
|
import"./index-k5jrywpr.js";
|
|
27
27
|
import"./index-n832052r.js";
|
|
28
28
|
import"./index-7ttstfv6.js";
|
|
@@ -34,8 +34,8 @@ import"./index-2tn5h2zp.js";
|
|
|
34
34
|
import"./index-1kz6da87.js";
|
|
35
35
|
import"./index-w9cb5zwh.js";
|
|
36
36
|
import"./index-4rhhvd1a.js";
|
|
37
|
-
import"./index-
|
|
38
|
-
import"./index-
|
|
37
|
+
import"./index-y2pfmd0z.js";
|
|
38
|
+
import"./index-s80bsjkj.js";
|
|
39
39
|
import"./index-z6xqpmqg.js";
|
|
40
40
|
import"./index-zjygnfay.js";
|
|
41
41
|
import"./index-zgwm4ryv.js";
|
package/dist/cli/{evidence-summary-service-thx1c3me.js → evidence-summary-service-hf7qq777.js}
RENAMED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
loadPlanJsonOnly,
|
|
7
7
|
mergeDurableGateEntriesFromEvidence,
|
|
8
8
|
readDurableGateEvidence
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-kzvwb2se.js";
|
|
10
10
|
import"./index-9ss2m4rs.js";
|
|
11
11
|
import"./index-k5jrywpr.js";
|
|
12
12
|
import"./index-n832052r.js";
|
|
@@ -14,7 +14,7 @@ import"./index-q1exe2b3.js";
|
|
|
14
14
|
import"./index-2tn5h2zp.js";
|
|
15
15
|
import"./index-1kz6da87.js";
|
|
16
16
|
import"./index-4rhhvd1a.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-s80bsjkj.js";
|
|
18
18
|
import"./index-z6xqpmqg.js";
|
|
19
19
|
import"./index-zjygnfay.js";
|
|
20
20
|
import {
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-ty0xttaz.js";
|
|
5
|
+
import"./index-gczs3jy7.js";
|
|
6
6
|
import"./index-v4n224r1.js";
|
|
7
7
|
import"./index-cpssctv1.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-kzvwb2se.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-wy5jy3m9.js";
|
|
13
|
+
import"./index-m8vrw3pt.js";
|
|
14
|
+
import"./index-5fnc76da.js";
|
|
15
15
|
import"./index-vxv732ex.js";
|
|
16
16
|
import"./index-c8s9a3zh.js";
|
|
17
17
|
import"./index-9ss2m4rs.js";
|
|
18
|
-
import"./index-
|
|
19
|
-
import"./index-
|
|
20
|
-
import"./index-
|
|
18
|
+
import"./index-g4mnf3p5.js";
|
|
19
|
+
import"./index-waqvy9a5.js";
|
|
20
|
+
import"./index-pgyp3tta.js";
|
|
21
21
|
import"./index-rtry5xyf.js";
|
|
22
|
-
import"./index-
|
|
23
|
-
import"./index-
|
|
22
|
+
import"./index-w2kp2zvf.js";
|
|
23
|
+
import"./index-kj86tyrs.js";
|
|
24
24
|
import"./index-ae75rja9.js";
|
|
25
25
|
import"./index-q27bajqb.js";
|
|
26
|
-
import"./index-
|
|
26
|
+
import"./index-6w02qz7t.js";
|
|
27
27
|
import"./index-k5jrywpr.js";
|
|
28
28
|
import"./index-n832052r.js";
|
|
29
29
|
import"./index-7ttstfv6.js";
|
|
@@ -35,8 +35,8 @@ import"./index-2tn5h2zp.js";
|
|
|
35
35
|
import"./index-1kz6da87.js";
|
|
36
36
|
import"./index-w9cb5zwh.js";
|
|
37
37
|
import"./index-4rhhvd1a.js";
|
|
38
|
-
import"./index-
|
|
39
|
-
import"./index-
|
|
38
|
+
import"./index-y2pfmd0z.js";
|
|
39
|
+
import"./index-s80bsjkj.js";
|
|
40
40
|
import"./index-z6xqpmqg.js";
|
|
41
41
|
import"./index-zjygnfay.js";
|
|
42
42
|
import"./index-zgwm4ryv.js";
|
|
@@ -7,30 +7,30 @@ import {
|
|
|
7
7
|
isHiveEligible,
|
|
8
8
|
promoteFromSwarm,
|
|
9
9
|
promoteToHive
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-gczs3jy7.js";
|
|
11
11
|
import"./index-v4n224r1.js";
|
|
12
12
|
import"./index-cpssctv1.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-kzvwb2se.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-wy5jy3m9.js";
|
|
18
|
+
import"./index-m8vrw3pt.js";
|
|
19
|
+
import"./index-5fnc76da.js";
|
|
20
20
|
import"./index-vxv732ex.js";
|
|
21
21
|
import"./index-c8s9a3zh.js";
|
|
22
22
|
import"./index-9ss2m4rs.js";
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
23
|
+
import"./index-g4mnf3p5.js";
|
|
24
|
+
import"./index-waqvy9a5.js";
|
|
25
|
+
import"./index-pgyp3tta.js";
|
|
26
26
|
import"./index-rtry5xyf.js";
|
|
27
27
|
import {
|
|
28
28
|
resolveHiveKnowledgePath
|
|
29
|
-
} from "./index-
|
|
30
|
-
import"./index-
|
|
29
|
+
} from "./index-w2kp2zvf.js";
|
|
30
|
+
import"./index-kj86tyrs.js";
|
|
31
31
|
import"./index-ae75rja9.js";
|
|
32
32
|
import"./index-q27bajqb.js";
|
|
33
|
-
import"./index-
|
|
33
|
+
import"./index-6w02qz7t.js";
|
|
34
34
|
import"./index-k5jrywpr.js";
|
|
35
35
|
import"./index-n832052r.js";
|
|
36
36
|
import"./index-7ttstfv6.js";
|
|
@@ -42,8 +42,8 @@ import"./index-2tn5h2zp.js";
|
|
|
42
42
|
import"./index-1kz6da87.js";
|
|
43
43
|
import"./index-w9cb5zwh.js";
|
|
44
44
|
import"./index-4rhhvd1a.js";
|
|
45
|
-
import"./index-
|
|
46
|
-
import"./index-
|
|
45
|
+
import"./index-y2pfmd0z.js";
|
|
46
|
+
import"./index-s80bsjkj.js";
|
|
47
47
|
import"./index-z6xqpmqg.js";
|
|
48
48
|
import"./index-zjygnfay.js";
|
|
49
49
|
import"./index-zgwm4ryv.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
3
|
handleGuardrailExplain
|
|
4
|
-
} from "./index-
|
|
4
|
+
} from "./index-ty0xttaz.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-gczs3jy7.js";
|
|
87
87
|
import"./index-v4n224r1.js";
|
|
88
88
|
import"./index-cpssctv1.js";
|
|
89
|
-
import"./index-
|
|
89
|
+
import"./index-kzvwb2se.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-wy5jy3m9.js";
|
|
94
|
+
import"./index-m8vrw3pt.js";
|
|
95
|
+
import"./index-5fnc76da.js";
|
|
96
96
|
import"./index-vxv732ex.js";
|
|
97
97
|
import"./index-c8s9a3zh.js";
|
|
98
98
|
import"./index-9ss2m4rs.js";
|
|
99
|
-
import"./index-
|
|
100
|
-
import"./index-
|
|
101
|
-
import"./index-
|
|
99
|
+
import"./index-g4mnf3p5.js";
|
|
100
|
+
import"./index-waqvy9a5.js";
|
|
101
|
+
import"./index-pgyp3tta.js";
|
|
102
102
|
import"./index-rtry5xyf.js";
|
|
103
|
-
import"./index-
|
|
104
|
-
import"./index-
|
|
103
|
+
import"./index-w2kp2zvf.js";
|
|
104
|
+
import"./index-kj86tyrs.js";
|
|
105
105
|
import"./index-ae75rja9.js";
|
|
106
106
|
import"./index-q27bajqb.js";
|
|
107
|
-
import"./index-
|
|
107
|
+
import"./index-6w02qz7t.js";
|
|
108
108
|
import"./index-k5jrywpr.js";
|
|
109
109
|
import"./index-n832052r.js";
|
|
110
110
|
import {
|
|
@@ -122,8 +122,8 @@ import"./index-2tn5h2zp.js";
|
|
|
122
122
|
import"./index-1kz6da87.js";
|
|
123
123
|
import"./index-w9cb5zwh.js";
|
|
124
124
|
import"./index-4rhhvd1a.js";
|
|
125
|
-
import"./index-
|
|
126
|
-
import"./index-
|
|
125
|
+
import"./index-y2pfmd0z.js";
|
|
126
|
+
import"./index-s80bsjkj.js";
|
|
127
127
|
import"./index-z6xqpmqg.js";
|
|
128
128
|
import"./index-zjygnfay.js";
|
|
129
129
|
import"./index-zgwm4ryv.js";
|
|
@@ -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, {
|
|
@@ -30,6 +235,7 @@ __export(exports_loader, {
|
|
|
30
235
|
loadPluginConfigWithMeta: () => loadPluginConfigWithMeta,
|
|
31
236
|
loadPluginConfig: () => loadPluginConfig,
|
|
32
237
|
loadAgentPrompt: () => loadAgentPrompt,
|
|
238
|
+
getSafeDefaultConfigLoadResult: () => getSafeDefaultConfigLoadResult,
|
|
33
239
|
formatZodIssues: () => formatZodIssues,
|
|
34
240
|
deepMerge: () => deepMerge,
|
|
35
241
|
MAX_MERGE_DEPTH: () => MAX_MERGE_DEPTH,
|
|
@@ -188,8 +394,8 @@ function formatZodIssues(error) {
|
|
|
188
394
|
if (error.issues.length === 0)
|
|
189
395
|
return "";
|
|
190
396
|
return error.issues.map((issue) => {
|
|
191
|
-
const
|
|
192
|
-
return
|
|
397
|
+
const dotted2 = issue.path.map(String).join(".");
|
|
398
|
+
return dotted2 ? `${dotted2}: ${issue.message}` : issue.message;
|
|
193
399
|
}).join("; ");
|
|
194
400
|
}
|
|
195
401
|
function stripUnrecognizedKeys(raw, error) {
|
|
@@ -213,8 +419,8 @@ function stripUnrecognizedKeys(raw, error) {
|
|
|
213
419
|
for (const key of keys) {
|
|
214
420
|
if (key in node) {
|
|
215
421
|
delete node[key];
|
|
216
|
-
const
|
|
217
|
-
removed.push(
|
|
422
|
+
const dotted2 = [...issue.path.map(String), key].join(".");
|
|
423
|
+
removed.push(dotted2);
|
|
218
424
|
}
|
|
219
425
|
}
|
|
220
426
|
}
|
|
@@ -311,6 +517,33 @@ function buildConfigWithMeta(rawUserConfig, rawProjectConfig, loadedFromFile, co
|
|
|
311
517
|
}
|
|
312
518
|
}
|
|
313
519
|
}
|
|
520
|
+
const rawGuardrailsDisabled = mergedRaw.guardrails && typeof mergedRaw.guardrails === "object" && !Array.isArray(mergedRaw.guardrails) && mergedRaw.guardrails.enabled === false;
|
|
521
|
+
if (!rawGuardrailsDisabled) {
|
|
522
|
+
const valueRecovery = sanitizeMalformedValues(PluginConfigSchema, mergedRaw);
|
|
523
|
+
if (valueRecovery.recoveryWarnings.length > 0) {
|
|
524
|
+
const recoveredParse = PluginConfigSchema.safeParse(valueRecovery.config);
|
|
525
|
+
if (recoveredParse.success) {
|
|
526
|
+
const removedKeys = [
|
|
527
|
+
...gatesStripped,
|
|
528
|
+
...valueRecovery.recoveryWarnings.map((w) => w.section)
|
|
529
|
+
];
|
|
530
|
+
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.`);
|
|
531
|
+
const secureConfig = PluginConfigSchema.parse({
|
|
532
|
+
...recoveredParse.data,
|
|
533
|
+
guardrails: {
|
|
534
|
+
...recoveredParse.data.guardrails,
|
|
535
|
+
enabled: true
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
return {
|
|
539
|
+
config: secure(secureConfig),
|
|
540
|
+
recovery: "sanitized_values",
|
|
541
|
+
removedKeys,
|
|
542
|
+
warnings: []
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
314
547
|
const offending = stripUnrecognizedKeys(mergedRaw, firstResult.error).removed;
|
|
315
548
|
if (offending.length > 0) {
|
|
316
549
|
advisoryWarn(`[opencode-swarm] Merged config validation failed. Unrecognized key(s): ${offending.join(", ")}.`);
|
|
@@ -353,6 +586,17 @@ function loadPluginConfigWithMeta(directory) {
|
|
|
353
586
|
warnings
|
|
354
587
|
};
|
|
355
588
|
}
|
|
589
|
+
function getSafeDefaultConfigLoadResult() {
|
|
590
|
+
const { config, recovery, removedKeys, warnings } = buildConfigWithMeta(null, null, false, false);
|
|
591
|
+
return {
|
|
592
|
+
config,
|
|
593
|
+
recovery,
|
|
594
|
+
removedKeys,
|
|
595
|
+
warnings,
|
|
596
|
+
loadedFromFile: false,
|
|
597
|
+
configHadErrors: false
|
|
598
|
+
};
|
|
599
|
+
}
|
|
356
600
|
async function loadRawConfigFromPathAsync(configPath) {
|
|
357
601
|
try {
|
|
358
602
|
const stats = await fsPromises.stat(configPath);
|
|
@@ -434,6 +678,7 @@ function loadAgentPrompt(agentName) {
|
|
|
434
678
|
var CONFIG_FILENAME = "opencode-swarm.json", PROMPTS_DIR_NAME = "opencode-swarm", MAX_CONFIG_FILE_BYTES = 102400;
|
|
435
679
|
var init_loader = __esm(() => {
|
|
436
680
|
init_warning_buffer();
|
|
681
|
+
init_sanitize_malformed_values();
|
|
437
682
|
init_schema();
|
|
438
683
|
init_merge();
|
|
439
684
|
init_merge();
|
|
@@ -468,4 +713,4 @@ function resolveWorktreeIsolationConfig(config) {
|
|
|
468
713
|
// src/config/index.ts
|
|
469
714
|
var _internals = { loadPluginConfigWithMeta };
|
|
470
715
|
|
|
471
|
-
export { loadPluginConfig, loadPluginConfigWithMeta, loadPluginConfigWithMetaAsync, loadAgentPrompt, exports_loader, init_loader, resolveWorktreeIsolationConfig, _internals };
|
|
716
|
+
export { loadPluginConfig, loadPluginConfigWithMeta, getSafeDefaultConfigLoadResult, loadPluginConfigWithMetaAsync, loadAgentPrompt, exports_loader, init_loader, resolveWorktreeIsolationConfig, _internals };
|