@workit-dev/opencode 1.7.4 → 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/plugin.js +27 -13
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -26670,53 +26670,67 @@ var claimAll = (owner, targets, deps) => {
|
|
|
26670
26670
|
claimLiveSession(target, owner, deps);
|
|
26671
26671
|
};
|
|
26672
26672
|
var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path40.resolve(cwd, file)) : [path40.join(cwd, DIR_TARGET)];
|
|
26673
|
+
var configDirs = () => [resolveConfigDir(), grantsDir()];
|
|
26673
26674
|
var registryTarget = (cwd, targets) => {
|
|
26674
26675
|
const state = resolveStateDir();
|
|
26676
|
+
const configs = configDirs();
|
|
26675
26677
|
for (const target of targets) {
|
|
26676
|
-
const
|
|
26678
|
+
const file = homeExpanded(target);
|
|
26679
|
+
const registry = underRegistry(state, cwd, file, process.platform, canonical3) ?? (configs.some((dir) => underConfig(dir, cwd, file, process.platform, canonical3)) ? "grants" : null);
|
|
26677
26680
|
if (registry)
|
|
26678
26681
|
return { file: target, registry };
|
|
26679
26682
|
}
|
|
26680
26683
|
return null;
|
|
26681
26684
|
};
|
|
26682
|
-
var
|
|
26685
|
+
var partsUnder = (dir, cwd, target, platform, real) => {
|
|
26683
26686
|
const win = platform === "win32";
|
|
26684
26687
|
const p = win ? path40.win32 : path40.posix;
|
|
26685
26688
|
const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
|
|
26686
26689
|
const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
|
|
26687
|
-
const relative = p.relative(fold(real(p.resolve(
|
|
26688
|
-
|
|
26689
|
-
|
|
26690
|
-
|
|
26691
|
-
|
|
26690
|
+
const relative = p.relative(fold(real(p.resolve(dir))), fold(real(p.resolve(cwd, named))));
|
|
26691
|
+
return relative.startsWith("..") || p.isAbsolute(relative) ? null : relative.split(p.sep);
|
|
26692
|
+
};
|
|
26693
|
+
var underRegistry = (state, cwd, target, platform = process.platform, real = (file) => file) => {
|
|
26694
|
+
const first = partsUnder(state, cwd, target, platform, real)?.[0];
|
|
26695
|
+
if (first?.startsWith("issued"))
|
|
26692
26696
|
return "issued";
|
|
26693
26697
|
return first === "approvals" ? "approvals" : null;
|
|
26694
26698
|
};
|
|
26695
|
-
var
|
|
26696
|
-
|
|
26699
|
+
var underConfig = (dir, cwd, target, platform = process.platform, real = (file) => file) => {
|
|
26700
|
+
const parts = partsUnder(dir, cwd, target, platform, real);
|
|
26701
|
+
return parts?.length === 1 && (parts[0] === "" || parts[0] === "workspaces.json");
|
|
26702
|
+
};
|
|
26703
|
+
var unquotedWindowsRegistry = (command, platform = process.platform) => {
|
|
26704
|
+
if (platform !== "win32" || !command.includes("\\"))
|
|
26697
26705
|
return null;
|
|
26698
26706
|
const flat = (value) => value.replaceAll("\\", "/").toLowerCase();
|
|
26699
26707
|
const text = flat(command);
|
|
26700
26708
|
const state = flat(resolveStateDir());
|
|
26701
|
-
const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : null;
|
|
26709
|
+
const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : configDirs().some((dir) => text.includes(`${flat(dir)}/workspaces.json`)) ? "grants" : null;
|
|
26702
26710
|
return registry && shellWrites(command).writes ? registry : null;
|
|
26703
26711
|
};
|
|
26704
26712
|
var REGISTRY_DENY = {
|
|
26705
26713
|
issued: {
|
|
26706
26714
|
label: "issued-registry guard",
|
|
26715
|
+
what: "Workit's issued-session state",
|
|
26707
26716
|
unblock: "Issued ids and tokens are written only by Workit's SubagentStart hook. Run the verifier or reviewer agent so the host issues its own session; never edit the issued registries by hand."
|
|
26708
26717
|
},
|
|
26709
26718
|
approvals: {
|
|
26710
26719
|
label: "approvals guard",
|
|
26720
|
+
what: "Workit's host-approval state",
|
|
26711
26721
|
unblock: "Approval requests and the user's yes are written only by Workit: run `workit approve <id>` as its own call so the host asks the user, or ask the user to run it in their own terminal; never edit the approvals registry by hand."
|
|
26722
|
+
},
|
|
26723
|
+
grants: {
|
|
26724
|
+
label: "config guard",
|
|
26725
|
+
what: "the user's Workit config (grants, roles, youtrack.writes)",
|
|
26726
|
+
unblock: "Only the user changes it: ask them to run `workit grant set <ws> <kind>=<value>` or `workit workspace set <ws> <key>=<value>` in a terminal outside this host. `workit grant show` and `workit workspace list` read it."
|
|
26712
26727
|
}
|
|
26713
26728
|
};
|
|
26714
26729
|
var registryDeny = ({ file, registry }) => {
|
|
26715
|
-
const { label, unblock } = REGISTRY_DENY[registry];
|
|
26716
|
-
const what = registry === "issued" ? "issued-session state" : "host-approval state";
|
|
26730
|
+
const { label, what, unblock } = REGISTRY_DENY[registry];
|
|
26717
26731
|
return {
|
|
26718
26732
|
kind: "deny",
|
|
26719
|
-
reason: `workit ${label}: ${file} is under
|
|
26733
|
+
reason: `workit ${label}: ${file} is under ${what}. ${unblock}`,
|
|
26720
26734
|
unblock
|
|
26721
26735
|
};
|
|
26722
26736
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
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": "^1.
|
|
44
|
+
"@workit-dev/core": "^1.8.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|