@massa-ai/opencode-plugin 1.8.0 → 1.9.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/config-cli.js +27 -13
- package/dist/index.js +30 -16
- package/package.json +3 -3
package/dist/config-cli.js
CHANGED
|
@@ -713,8 +713,8 @@ try {
|
|
|
713
713
|
if (cfg.database?.url && !process.env.DATABASE_URL) {
|
|
714
714
|
process.env.DATABASE_URL = cfg.database.url;
|
|
715
715
|
}
|
|
716
|
-
if (cfg.llm?.apiKey && !process.env.
|
|
717
|
-
process.env.
|
|
716
|
+
if (cfg.llm?.apiKey && !process.env.MASSA_AI_LLM_API_KEY) {
|
|
717
|
+
process.env.MASSA_AI_LLM_API_KEY = cfg.llm.apiKey;
|
|
718
718
|
}
|
|
719
719
|
if (cfg.embedding?.apiKey && !process.env.OLLAMA_API_KEY) {
|
|
720
720
|
process.env.OLLAMA_API_KEY = cfg.embedding.apiKey;
|
|
@@ -808,6 +808,20 @@ function validateCapturePolicyConfig(raw) {
|
|
|
808
808
|
...p.maxIgnorePatterns !== undefined && { maxIgnorePatterns: p.maxIgnorePatterns }
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
|
+
function validateAllowedExtensionsConfig(raw) {
|
|
812
|
+
if (!Array.isArray(raw)) {
|
|
813
|
+
throw new TypeError("security.allowedExtensions must be an array of strings");
|
|
814
|
+
}
|
|
815
|
+
if (raw.length === 0) {
|
|
816
|
+
throw new TypeError("security.allowedExtensions must not be empty \u2014 an empty allow-list indexes nothing; omit the key to use the defaults");
|
|
817
|
+
}
|
|
818
|
+
for (const ext of raw) {
|
|
819
|
+
if (typeof ext !== "string" || !ext.startsWith(".") || ext.length < 2) {
|
|
820
|
+
throw new TypeError(`security.allowedExtensions[] must be dot-prefixed extensions (got ${JSON.stringify(ext)})`);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
return [...raw];
|
|
824
|
+
}
|
|
811
825
|
function getGlobalDataDir() {
|
|
812
826
|
const envOverride = process.env.MASSA_AI_DATA_DIR;
|
|
813
827
|
if (envOverride && envOverride.trim())
|
|
@@ -886,15 +900,15 @@ var defaultConfig = {
|
|
|
886
900
|
}
|
|
887
901
|
},
|
|
888
902
|
llm: {
|
|
889
|
-
enabled: envBool("
|
|
890
|
-
baseUrl: envString("
|
|
891
|
-
apiKey: envString("
|
|
892
|
-
model: envString("
|
|
893
|
-
codeModel: envString("
|
|
894
|
-
temperature: envNum("
|
|
895
|
-
maxOutputTokens: envNum("
|
|
896
|
-
timeoutMs: envNum("
|
|
897
|
-
disableThink: envBool("
|
|
903
|
+
enabled: envBool("MASSA_AI_LLM_ENABLED", fileConfig.llm?.enabled ?? false),
|
|
904
|
+
baseUrl: envString("MASSA_AI_LLM_BASE_URL", fileConfig.llm?.baseUrl ?? "http://localhost:11434/v1"),
|
|
905
|
+
apiKey: envString("MASSA_AI_LLM_API_KEY", fileConfig.llm?.apiKey ?? "ollama"),
|
|
906
|
+
model: envString("MASSA_AI_LLM_MODEL", fileConfig.llm?.model ?? DEFAULT_LLM_MODEL),
|
|
907
|
+
codeModel: envString("MASSA_AI_LLM_CODE_MODEL", fileConfig.llm?.codeModel ?? DEFAULT_LLM_CODE_MODEL),
|
|
908
|
+
temperature: envNum("MASSA_AI_LLM_TEMPERATURE", fileConfig.llm?.temperature ?? 0.2),
|
|
909
|
+
maxOutputTokens: envNum("MASSA_AI_LLM_MAX_OUTPUT_TOKENS", fileConfig.llm?.maxOutputTokens ?? 8000),
|
|
910
|
+
timeoutMs: envNum("MASSA_AI_LLM_TIMEOUT_MS", fileConfig.llm?.timeoutMs ?? 90000),
|
|
911
|
+
disableThink: envBool("MASSA_AI_LLM_DISABLE_THINK", fileConfig.llm?.disableThink ?? true)
|
|
898
912
|
},
|
|
899
913
|
memory: {
|
|
900
914
|
decay: {
|
|
@@ -944,7 +958,7 @@ var defaultConfig = {
|
|
|
944
958
|
defaultStrategy: fileConfig.compression?.defaultStrategy ?? "code_structure",
|
|
945
959
|
minTokensForCompression: envNum("MIN_TOKENS_FOR_COMPRESSION", fileConfig.compression?.minTokensForCompression ?? 100),
|
|
946
960
|
targetCompressionRatio: envNum("TARGET_COMPRESSION_RATIO", fileConfig.compression?.targetCompressionRatio ?? 0.7),
|
|
947
|
-
prompt: process.env.
|
|
961
|
+
prompt: process.env.MASSA_AI_LLM_PROMPT || fileConfig.compression?.prompt || undefined
|
|
948
962
|
},
|
|
949
963
|
impact: {
|
|
950
964
|
bfsCteEnabled: envBool("MASSA_AI_IMPACT_BFS_CTE", fileConfig.impact?.bfsCteEnabled ?? false)
|
|
@@ -965,7 +979,7 @@ var defaultConfig = {
|
|
|
965
979
|
sanitizeInputs: process.env.SANITIZE_INPUTS !== "false",
|
|
966
980
|
maxIndexSize: 1e5,
|
|
967
981
|
maxFileSize: 1024 * 1024,
|
|
968
|
-
allowedExtensions: [...DEFAULT_ALLOWED_EXTENSIONS],
|
|
982
|
+
allowedExtensions: fileConfig.security?.allowedExtensions ? validateAllowedExtensionsConfig(fileConfig.security.allowedExtensions) : [...DEFAULT_ALLOWED_EXTENSIONS],
|
|
969
983
|
excludePatterns: [
|
|
970
984
|
"node_modules/**",
|
|
971
985
|
".git/**",
|
package/dist/index.js
CHANGED
|
@@ -13032,8 +13032,8 @@ try {
|
|
|
13032
13032
|
if (cfg.database?.url && !process.env.DATABASE_URL) {
|
|
13033
13033
|
process.env.DATABASE_URL = cfg.database.url;
|
|
13034
13034
|
}
|
|
13035
|
-
if (cfg.llm?.apiKey && !process.env.
|
|
13036
|
-
process.env.
|
|
13035
|
+
if (cfg.llm?.apiKey && !process.env.MASSA_AI_LLM_API_KEY) {
|
|
13036
|
+
process.env.MASSA_AI_LLM_API_KEY = cfg.llm.apiKey;
|
|
13037
13037
|
}
|
|
13038
13038
|
if (cfg.embedding?.apiKey && !process.env.OLLAMA_API_KEY) {
|
|
13039
13039
|
process.env.OLLAMA_API_KEY = cfg.embedding.apiKey;
|
|
@@ -13127,6 +13127,20 @@ function validateCapturePolicyConfig(raw) {
|
|
|
13127
13127
|
...p.maxIgnorePatterns !== undefined && { maxIgnorePatterns: p.maxIgnorePatterns }
|
|
13128
13128
|
};
|
|
13129
13129
|
}
|
|
13130
|
+
function validateAllowedExtensionsConfig(raw) {
|
|
13131
|
+
if (!Array.isArray(raw)) {
|
|
13132
|
+
throw new TypeError("security.allowedExtensions must be an array of strings");
|
|
13133
|
+
}
|
|
13134
|
+
if (raw.length === 0) {
|
|
13135
|
+
throw new TypeError("security.allowedExtensions must not be empty \u2014 an empty allow-list indexes nothing; omit the key to use the defaults");
|
|
13136
|
+
}
|
|
13137
|
+
for (const ext of raw) {
|
|
13138
|
+
if (typeof ext !== "string" || !ext.startsWith(".") || ext.length < 2) {
|
|
13139
|
+
throw new TypeError(`security.allowedExtensions[] must be dot-prefixed extensions (got ${JSON.stringify(ext)})`);
|
|
13140
|
+
}
|
|
13141
|
+
}
|
|
13142
|
+
return [...raw];
|
|
13143
|
+
}
|
|
13130
13144
|
function getGlobalDataDir() {
|
|
13131
13145
|
const envOverride = process.env.MASSA_AI_DATA_DIR;
|
|
13132
13146
|
if (envOverride && envOverride.trim())
|
|
@@ -13205,15 +13219,15 @@ var defaultConfig = {
|
|
|
13205
13219
|
}
|
|
13206
13220
|
},
|
|
13207
13221
|
llm: {
|
|
13208
|
-
enabled: envBool("
|
|
13209
|
-
baseUrl: envString("
|
|
13210
|
-
apiKey: envString("
|
|
13211
|
-
model: envString("
|
|
13212
|
-
codeModel: envString("
|
|
13213
|
-
temperature: envNum("
|
|
13214
|
-
maxOutputTokens: envNum("
|
|
13215
|
-
timeoutMs: envNum("
|
|
13216
|
-
disableThink: envBool("
|
|
13222
|
+
enabled: envBool("MASSA_AI_LLM_ENABLED", fileConfig.llm?.enabled ?? false),
|
|
13223
|
+
baseUrl: envString("MASSA_AI_LLM_BASE_URL", fileConfig.llm?.baseUrl ?? "http://localhost:11434/v1"),
|
|
13224
|
+
apiKey: envString("MASSA_AI_LLM_API_KEY", fileConfig.llm?.apiKey ?? "ollama"),
|
|
13225
|
+
model: envString("MASSA_AI_LLM_MODEL", fileConfig.llm?.model ?? DEFAULT_LLM_MODEL),
|
|
13226
|
+
codeModel: envString("MASSA_AI_LLM_CODE_MODEL", fileConfig.llm?.codeModel ?? DEFAULT_LLM_CODE_MODEL),
|
|
13227
|
+
temperature: envNum("MASSA_AI_LLM_TEMPERATURE", fileConfig.llm?.temperature ?? 0.2),
|
|
13228
|
+
maxOutputTokens: envNum("MASSA_AI_LLM_MAX_OUTPUT_TOKENS", fileConfig.llm?.maxOutputTokens ?? 8000),
|
|
13229
|
+
timeoutMs: envNum("MASSA_AI_LLM_TIMEOUT_MS", fileConfig.llm?.timeoutMs ?? 90000),
|
|
13230
|
+
disableThink: envBool("MASSA_AI_LLM_DISABLE_THINK", fileConfig.llm?.disableThink ?? true)
|
|
13217
13231
|
},
|
|
13218
13232
|
memory: {
|
|
13219
13233
|
decay: {
|
|
@@ -13263,7 +13277,7 @@ var defaultConfig = {
|
|
|
13263
13277
|
defaultStrategy: fileConfig.compression?.defaultStrategy ?? "code_structure",
|
|
13264
13278
|
minTokensForCompression: envNum("MIN_TOKENS_FOR_COMPRESSION", fileConfig.compression?.minTokensForCompression ?? 100),
|
|
13265
13279
|
targetCompressionRatio: envNum("TARGET_COMPRESSION_RATIO", fileConfig.compression?.targetCompressionRatio ?? 0.7),
|
|
13266
|
-
prompt: process.env.
|
|
13280
|
+
prompt: process.env.MASSA_AI_LLM_PROMPT || fileConfig.compression?.prompt || undefined
|
|
13267
13281
|
},
|
|
13268
13282
|
impact: {
|
|
13269
13283
|
bfsCteEnabled: envBool("MASSA_AI_IMPACT_BFS_CTE", fileConfig.impact?.bfsCteEnabled ?? false)
|
|
@@ -13284,7 +13298,7 @@ var defaultConfig = {
|
|
|
13284
13298
|
sanitizeInputs: process.env.SANITIZE_INPUTS !== "false",
|
|
13285
13299
|
maxIndexSize: 1e5,
|
|
13286
13300
|
maxFileSize: 1024 * 1024,
|
|
13287
|
-
allowedExtensions: [...DEFAULT_ALLOWED_EXTENSIONS],
|
|
13301
|
+
allowedExtensions: fileConfig.security?.allowedExtensions ? validateAllowedExtensionsConfig(fileConfig.security.allowedExtensions) : [...DEFAULT_ALLOWED_EXTENSIONS],
|
|
13288
13302
|
excludePatterns: [
|
|
13289
13303
|
"node_modules/**",
|
|
13290
13304
|
".git/**",
|
|
@@ -13770,7 +13784,7 @@ async function massaAiGetWithQuery(endpoint, params, timeoutMs = FETCH_TIMEOUT_M
|
|
|
13770
13784
|
}
|
|
13771
13785
|
var MassaAiPlugin = async ({ project, directory, worktree, client }) => {
|
|
13772
13786
|
ensureConfig();
|
|
13773
|
-
|
|
13787
|
+
loadConfig();
|
|
13774
13788
|
const projectPath = worktree || directory;
|
|
13775
13789
|
const projectPins = new SessionProjectPin({
|
|
13776
13790
|
computeProjectId: () => computePluginProjectId({
|
|
@@ -13985,7 +13999,7 @@ var MassaAiPlugin = async ({ project, directory, worktree, client }) => {
|
|
|
13985
13999
|
includeSymbols: tool.schema.boolean().optional().default(true).describe("Include symbol metadata from graph"),
|
|
13986
14000
|
includeImports: tool.schema.boolean().optional().default(true).describe("Extract and show import statements")
|
|
13987
14001
|
},
|
|
13988
|
-
async execute(args,
|
|
14002
|
+
async execute(args, _ctx) {
|
|
13989
14003
|
const result = await massaAiFetch("/api/v1/file/read", {
|
|
13990
14004
|
filePath: args.filePath,
|
|
13991
14005
|
projectId: args.projectId || projectId,
|
|
@@ -14048,7 +14062,7 @@ var MassaAiPlugin = async ({ project, directory, worktree, client }) => {
|
|
|
14048
14062
|
exportedOnly: tool.schema.boolean().optional().default(false).describe("Return only exported symbols"),
|
|
14049
14063
|
maxResults: tool.schema.number().optional().default(20).describe("Maximum number of results to return (default: 20)")
|
|
14050
14064
|
},
|
|
14051
|
-
async execute(args,
|
|
14065
|
+
async execute(args, _ctx) {
|
|
14052
14066
|
const result = await massaAiGetWithQuery("/api/v1/symbol/definitions", {
|
|
14053
14067
|
projectId,
|
|
14054
14068
|
search: args.query,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@massa-ai/opencode-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
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.9.1",
|
|
25
|
+
"@massa-ai/shared": "^1.9.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^22.10.5",
|