@workit-dev/opencode 2.7.1 → 2.7.3
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/plugin.js +24 -7
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -25232,17 +25232,34 @@ var opencodePermission = (permission, rules) => {
|
|
|
25232
25232
|
}
|
|
25233
25233
|
return true;
|
|
25234
25234
|
};
|
|
25235
|
-
var
|
|
25236
|
-
|
|
25237
|
-
|
|
25238
|
-
if (
|
|
25235
|
+
var EFFECTS = new Set(["allow", "ask", "deny"]);
|
|
25236
|
+
var actionMatches = (pattern, action) => new RegExp(`^${pattern.split("").map((char) => char === "*" ? ".*" : char === "?" ? "." : char.replace(/[.+^${}()|[\]\\]/u, "\\$&")).join("")}$`, "su").test(action);
|
|
25237
|
+
var opencodeRuleset = (ruleset, rules) => {
|
|
25238
|
+
if (ruleset === undefined)
|
|
25239
|
+
return true;
|
|
25240
|
+
if (!Array.isArray(ruleset))
|
|
25239
25241
|
return false;
|
|
25240
|
-
|
|
25242
|
+
for (const rule of ruleset) {
|
|
25243
|
+
if (!isRecord5(rule))
|
|
25244
|
+
return false;
|
|
25245
|
+
const { action, resource, effect } = rule;
|
|
25246
|
+
if (typeof action !== "string" || typeof resource !== "string")
|
|
25247
|
+
return false;
|
|
25248
|
+
if (typeof effect !== "string" || !EFFECTS.has(effect))
|
|
25249
|
+
return false;
|
|
25250
|
+
if (actionMatches(action, "shell"))
|
|
25251
|
+
(effect === "allow" ? rules.allow : rules.deny).push(resource);
|
|
25252
|
+
}
|
|
25253
|
+
return true;
|
|
25254
|
+
};
|
|
25255
|
+
var opencodeAgents = (agents, read) => {
|
|
25256
|
+
if (agents === undefined)
|
|
25241
25257
|
return true;
|
|
25242
|
-
if (!isRecord5(
|
|
25258
|
+
if (!isRecord5(agents))
|
|
25243
25259
|
return false;
|
|
25244
|
-
return Object.values(
|
|
25260
|
+
return Object.values(agents).every((agent) => isRecord5(agent) && read(agent));
|
|
25245
25261
|
};
|
|
25262
|
+
var opencodeConfig = (value, rules) => isRecord5(value) && opencodeRuleset(value.permissions, rules) && opencodePermission(value.permission, rules) && opencodeAgents(value.agents, (agent) => opencodeRuleset(agent.permissions, rules)) && opencodeAgents(value.agent, (agent) => opencodePermission(agent.permission, rules));
|
|
25246
25263
|
function opencodeRules(cwd, env = process.env) {
|
|
25247
25264
|
const rules = EMPTY2();
|
|
25248
25265
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit OpenCode plugin — native tools, adaptive policy, and sixteen method skills",
|
|
6
6
|
"keywords": [
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@opencode/plugin": "2.0.18",
|
|
44
|
-
"@workit-dev/core": "^2.7.
|
|
44
|
+
"@workit-dev/core": "^2.7.3"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|