@massa-ai/opencode-plugin 1.7.0 → 1.8.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/config-cli.js +36 -4
- package/dist/index.js +36 -4
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -542,6 +542,9 @@ var init_massa_ai_config = __esm(() => {
|
|
|
542
542
|
},
|
|
543
543
|
handoffs: {
|
|
544
544
|
enabled: true
|
|
545
|
+
},
|
|
546
|
+
security: {
|
|
547
|
+
corsOrigins: []
|
|
545
548
|
}
|
|
546
549
|
};
|
|
547
550
|
});
|
|
@@ -563,6 +566,7 @@ __export(exports_config_loader, {
|
|
|
563
566
|
import fs from "fs";
|
|
564
567
|
import path3 from "path";
|
|
565
568
|
import os2 from "os";
|
|
569
|
+
import crypto from "crypto";
|
|
566
570
|
function getConfigDir() {
|
|
567
571
|
return CONFIG_DIR;
|
|
568
572
|
}
|
|
@@ -591,7 +595,8 @@ function loadConfig() {
|
|
|
591
595
|
llm: { ...defaultMassaAiConfig.llm, ...userConfig.llm },
|
|
592
596
|
memory: { ...defaultMassaAiConfig.memory, ...userConfig.memory },
|
|
593
597
|
hooks: { ...defaultMassaAiConfig.hooks, ...userConfig.hooks },
|
|
594
|
-
handoffs: { ...defaultMassaAiConfig.handoffs, ...userConfig.handoffs }
|
|
598
|
+
handoffs: { ...defaultMassaAiConfig.handoffs, ...userConfig.handoffs },
|
|
599
|
+
security: { ...defaultMassaAiConfig.security, ...userConfig.security }
|
|
595
600
|
};
|
|
596
601
|
} catch (error) {
|
|
597
602
|
console.error(`Error loading config from ${CONFIG_FILE}:`, error);
|
|
@@ -635,7 +640,17 @@ function saveConfig(config) {
|
|
|
635
640
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
636
641
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
637
642
|
}
|
|
638
|
-
|
|
643
|
+
const unique = `${process.pid}.${++tempFileCounter}.${crypto.randomBytes(6).toString("hex")}`;
|
|
644
|
+
const tempFile = path3.join(CONFIG_DIR, `.config.json.${unique}.tmp`);
|
|
645
|
+
try {
|
|
646
|
+
fs.writeFileSync(tempFile, JSON.stringify(config, null, 2));
|
|
647
|
+
fs.renameSync(tempFile, CONFIG_FILE);
|
|
648
|
+
} catch (error) {
|
|
649
|
+
try {
|
|
650
|
+
fs.unlinkSync(tempFile);
|
|
651
|
+
} catch {}
|
|
652
|
+
throw error;
|
|
653
|
+
}
|
|
639
654
|
}
|
|
640
655
|
function initConfig() {
|
|
641
656
|
if (!fs.existsSync(CONFIG_FILE)) {
|
|
@@ -663,7 +678,7 @@ function getConfigForEnv() {
|
|
|
663
678
|
env.ENABLE_METRICS = String(config.logging.enableMetrics);
|
|
664
679
|
return env;
|
|
665
680
|
}
|
|
666
|
-
var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false;
|
|
681
|
+
var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false, tempFileCounter = 0;
|
|
667
682
|
var init_config_loader = __esm(() => {
|
|
668
683
|
init_massa_ai_config();
|
|
669
684
|
init_xdg();
|
|
@@ -704,6 +719,10 @@ try {
|
|
|
704
719
|
if (cfg.embedding?.apiKey && !process.env.OLLAMA_API_KEY) {
|
|
705
720
|
process.env.OLLAMA_API_KEY = cfg.embedding.apiKey;
|
|
706
721
|
}
|
|
722
|
+
const securityApiKey = cfg.security?.apiKey?.trim();
|
|
723
|
+
if (securityApiKey && !process.env.MASSA_AI_API_KEY?.trim()) {
|
|
724
|
+
process.env.MASSA_AI_API_KEY = securityApiKey;
|
|
725
|
+
}
|
|
707
726
|
} catch {}
|
|
708
727
|
|
|
709
728
|
// ../../packages/shared/dist/config/index.js
|
|
@@ -711,6 +730,11 @@ init_config_loader();
|
|
|
711
730
|
init_massa_ai_config();
|
|
712
731
|
init_config_loader();
|
|
713
732
|
import path4 from "path";
|
|
733
|
+
|
|
734
|
+
// ../../packages/shared/dist/config/api-key.js
|
|
735
|
+
init_config_loader();
|
|
736
|
+
|
|
737
|
+
// ../../packages/shared/dist/config/index.js
|
|
714
738
|
var DEFAULT_LLM_MODEL = "qwen2.5:7b-instruct";
|
|
715
739
|
var DEFAULT_LLM_CODE_MODEL = "qwen2.5-coder:7b";
|
|
716
740
|
function envNum(key, fallback) {
|
|
@@ -735,6 +759,13 @@ function envString(key, fallback) {
|
|
|
735
759
|
const s = process.env[key];
|
|
736
760
|
return s === undefined || s === "" ? fallback : s;
|
|
737
761
|
}
|
|
762
|
+
function envList(key, fallback) {
|
|
763
|
+
const s = process.env[key];
|
|
764
|
+
if (s === undefined)
|
|
765
|
+
return fallback;
|
|
766
|
+
const parsed = s.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
|
|
767
|
+
return parsed.length > 0 ? parsed : fallback;
|
|
768
|
+
}
|
|
738
769
|
var MAX_IGNORE_PATTERNS = 1024;
|
|
739
770
|
function validateCapturePolicyConfig(raw) {
|
|
740
771
|
if (!raw || typeof raw !== "object")
|
|
@@ -945,7 +976,8 @@ var defaultConfig = {
|
|
|
945
976
|
"**/generated/**",
|
|
946
977
|
"*.min.js",
|
|
947
978
|
"*.min.css"
|
|
948
|
-
]
|
|
979
|
+
],
|
|
980
|
+
corsOrigins: envList("MASSA_AI_API_CORS_ORIGINS", fileConfig.security?.corsOrigins ?? [])
|
|
949
981
|
},
|
|
950
982
|
logging: {
|
|
951
983
|
level: process.env.LOG_LEVEL || fileConfig.logging?.level || "info",
|
package/dist/index.js
CHANGED
|
@@ -541,6 +541,9 @@ var init_massa_ai_config = __esm(() => {
|
|
|
541
541
|
},
|
|
542
542
|
handoffs: {
|
|
543
543
|
enabled: true
|
|
544
|
+
},
|
|
545
|
+
security: {
|
|
546
|
+
corsOrigins: []
|
|
544
547
|
}
|
|
545
548
|
};
|
|
546
549
|
});
|
|
@@ -562,6 +565,7 @@ __export(exports_config_loader, {
|
|
|
562
565
|
import fs from "fs";
|
|
563
566
|
import path3 from "path";
|
|
564
567
|
import os2 from "os";
|
|
568
|
+
import crypto from "crypto";
|
|
565
569
|
function getConfigDir() {
|
|
566
570
|
return CONFIG_DIR;
|
|
567
571
|
}
|
|
@@ -590,7 +594,8 @@ function loadConfig() {
|
|
|
590
594
|
llm: { ...defaultMassaAiConfig.llm, ...userConfig.llm },
|
|
591
595
|
memory: { ...defaultMassaAiConfig.memory, ...userConfig.memory },
|
|
592
596
|
hooks: { ...defaultMassaAiConfig.hooks, ...userConfig.hooks },
|
|
593
|
-
handoffs: { ...defaultMassaAiConfig.handoffs, ...userConfig.handoffs }
|
|
597
|
+
handoffs: { ...defaultMassaAiConfig.handoffs, ...userConfig.handoffs },
|
|
598
|
+
security: { ...defaultMassaAiConfig.security, ...userConfig.security }
|
|
594
599
|
};
|
|
595
600
|
} catch (error45) {
|
|
596
601
|
console.error(`Error loading config from ${CONFIG_FILE}:`, error45);
|
|
@@ -634,7 +639,17 @@ function saveConfig(config2) {
|
|
|
634
639
|
if (!fs.existsSync(CONFIG_DIR)) {
|
|
635
640
|
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
636
641
|
}
|
|
637
|
-
|
|
642
|
+
const unique = `${process.pid}.${++tempFileCounter}.${crypto.randomBytes(6).toString("hex")}`;
|
|
643
|
+
const tempFile = path3.join(CONFIG_DIR, `.config.json.${unique}.tmp`);
|
|
644
|
+
try {
|
|
645
|
+
fs.writeFileSync(tempFile, JSON.stringify(config2, null, 2));
|
|
646
|
+
fs.renameSync(tempFile, CONFIG_FILE);
|
|
647
|
+
} catch (error45) {
|
|
648
|
+
try {
|
|
649
|
+
fs.unlinkSync(tempFile);
|
|
650
|
+
} catch {}
|
|
651
|
+
throw error45;
|
|
652
|
+
}
|
|
638
653
|
}
|
|
639
654
|
function initConfig() {
|
|
640
655
|
if (!fs.existsSync(CONFIG_FILE)) {
|
|
@@ -662,7 +677,7 @@ function getConfigForEnv() {
|
|
|
662
677
|
env.ENABLE_METRICS = String(config2.logging.enableMetrics);
|
|
663
678
|
return env;
|
|
664
679
|
}
|
|
665
|
-
var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false;
|
|
680
|
+
var CONFIG_DIR, CONFIG_FILE, migrationAttempted = false, tempFileCounter = 0;
|
|
666
681
|
var init_config_loader = __esm(() => {
|
|
667
682
|
init_massa_ai_config();
|
|
668
683
|
init_xdg();
|
|
@@ -13023,6 +13038,10 @@ try {
|
|
|
13023
13038
|
if (cfg.embedding?.apiKey && !process.env.OLLAMA_API_KEY) {
|
|
13024
13039
|
process.env.OLLAMA_API_KEY = cfg.embedding.apiKey;
|
|
13025
13040
|
}
|
|
13041
|
+
const securityApiKey = cfg.security?.apiKey?.trim();
|
|
13042
|
+
if (securityApiKey && !process.env.MASSA_AI_API_KEY?.trim()) {
|
|
13043
|
+
process.env.MASSA_AI_API_KEY = securityApiKey;
|
|
13044
|
+
}
|
|
13026
13045
|
} catch {}
|
|
13027
13046
|
|
|
13028
13047
|
// ../../packages/shared/dist/config/index.js
|
|
@@ -13030,6 +13049,11 @@ init_config_loader();
|
|
|
13030
13049
|
init_massa_ai_config();
|
|
13031
13050
|
init_config_loader();
|
|
13032
13051
|
import path4 from "path";
|
|
13052
|
+
|
|
13053
|
+
// ../../packages/shared/dist/config/api-key.js
|
|
13054
|
+
init_config_loader();
|
|
13055
|
+
|
|
13056
|
+
// ../../packages/shared/dist/config/index.js
|
|
13033
13057
|
var DEFAULT_LLM_MODEL = "qwen2.5:7b-instruct";
|
|
13034
13058
|
var DEFAULT_LLM_CODE_MODEL = "qwen2.5-coder:7b";
|
|
13035
13059
|
function envNum(key, fallback) {
|
|
@@ -13054,6 +13078,13 @@ function envString(key, fallback) {
|
|
|
13054
13078
|
const s = process.env[key];
|
|
13055
13079
|
return s === undefined || s === "" ? fallback : s;
|
|
13056
13080
|
}
|
|
13081
|
+
function envList(key, fallback) {
|
|
13082
|
+
const s = process.env[key];
|
|
13083
|
+
if (s === undefined)
|
|
13084
|
+
return fallback;
|
|
13085
|
+
const parsed = s.split(",").map((v) => v.trim()).filter((v) => v.length > 0);
|
|
13086
|
+
return parsed.length > 0 ? parsed : fallback;
|
|
13087
|
+
}
|
|
13057
13088
|
var MAX_IGNORE_PATTERNS = 1024;
|
|
13058
13089
|
function validateCapturePolicyConfig(raw) {
|
|
13059
13090
|
if (!raw || typeof raw !== "object")
|
|
@@ -13264,7 +13295,8 @@ var defaultConfig = {
|
|
|
13264
13295
|
"**/generated/**",
|
|
13265
13296
|
"*.min.js",
|
|
13266
13297
|
"*.min.css"
|
|
13267
|
-
]
|
|
13298
|
+
],
|
|
13299
|
+
corsOrigins: envList("MASSA_AI_API_CORS_ORIGINS", fileConfig.security?.corsOrigins ?? [])
|
|
13268
13300
|
},
|
|
13269
13301
|
logging: {
|
|
13270
13302
|
level: process.env.LOG_LEVEL || fileConfig.logging?.level || "info",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/opencode-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "massa-ai plugin for OpenCode - Semantic code search, memory, and context compression",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@opencode-ai/plugin": "^1.2.15",
|
|
23
23
|
"@opencode-ai/sdk": "^1.2.15",
|
|
24
|
-
"@massa-ai/core": "^1.
|
|
25
|
-
"@massa-ai/shared": "^1.
|
|
24
|
+
"@massa-ai/core": "^1.8.0",
|
|
25
|
+
"@massa-ai/shared": "^1.8.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.10.5",
|