@workit-dev/opencode 1.5.1 → 1.6.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 +57 -20
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -24513,7 +24513,8 @@ var WORKIT_USER_ONLY = [
|
|
|
24513
24513
|
["release", "notes", "approve"],
|
|
24514
24514
|
["grant", "set"],
|
|
24515
24515
|
["grant", "raise"],
|
|
24516
|
-
["ledger", "void"]
|
|
24516
|
+
["ledger", "void"],
|
|
24517
|
+
["approve"]
|
|
24517
24518
|
];
|
|
24518
24519
|
var ALLOWED = new Set(WORKIT_ALLOWED_VERBS);
|
|
24519
24520
|
var hasWordsInOrder = (words, needle) => {
|
|
@@ -26305,7 +26306,12 @@ var segmentTargets = (cwd, command, dialect, depth = 0, strict = false, inherite
|
|
|
26305
26306
|
};
|
|
26306
26307
|
for (const segment of segments) {
|
|
26307
26308
|
if (segment.group === "open") {
|
|
26308
|
-
groups.push({
|
|
26309
|
+
groups.push({
|
|
26310
|
+
dir,
|
|
26311
|
+
stack: [...stack],
|
|
26312
|
+
vars: new Map(vars),
|
|
26313
|
+
loops: new Map(loops)
|
|
26314
|
+
});
|
|
26309
26315
|
continue;
|
|
26310
26316
|
}
|
|
26311
26317
|
if (segment.group === "close") {
|
|
@@ -26513,39 +26519,60 @@ var claimAll = (owner, targets, deps) => {
|
|
|
26513
26519
|
claimLiveSession(target, owner, deps);
|
|
26514
26520
|
};
|
|
26515
26521
|
var liveTargets = (cwd, paths) => paths?.length ? paths.map((file) => path39.resolve(cwd, file)) : [path39.join(cwd, DIR_TARGET)];
|
|
26516
|
-
var
|
|
26522
|
+
var registryTarget = (cwd, targets) => {
|
|
26517
26523
|
const state = resolveStateDir();
|
|
26518
|
-
const
|
|
26519
|
-
|
|
26524
|
+
for (const target of targets) {
|
|
26525
|
+
const registry = underRegistry(state, cwd, homeExpanded(target), process.platform, canonical3);
|
|
26526
|
+
if (registry)
|
|
26527
|
+
return { file: target, registry };
|
|
26528
|
+
}
|
|
26529
|
+
return null;
|
|
26520
26530
|
};
|
|
26521
|
-
var
|
|
26531
|
+
var underRegistry = (state, cwd, target, platform = process.platform, real = (file) => file) => {
|
|
26522
26532
|
const win = platform === "win32";
|
|
26523
26533
|
const p = win ? path39.win32 : path39.posix;
|
|
26524
26534
|
const fold = (value) => win || platform === "darwin" ? value.toLowerCase() : value;
|
|
26525
26535
|
const named = win ? target.replace(/^\/([a-zA-Z])(?=\/|$)/, "$1:") : target;
|
|
26526
26536
|
const relative = p.relative(fold(real(p.resolve(state))), fold(real(p.resolve(cwd, named))));
|
|
26527
26537
|
if (relative.startsWith("..") || p.isAbsolute(relative))
|
|
26528
|
-
return
|
|
26529
|
-
|
|
26538
|
+
return null;
|
|
26539
|
+
const first = relative.split(p.sep)[0];
|
|
26540
|
+
if (first.startsWith("issued"))
|
|
26541
|
+
return "issued";
|
|
26542
|
+
return first === "approvals" ? "approvals" : null;
|
|
26530
26543
|
};
|
|
26531
|
-
var
|
|
26544
|
+
var unquotedWindowsRegistry = (command) => {
|
|
26532
26545
|
if (process.platform !== "win32" || !command.includes("\\"))
|
|
26533
|
-
return
|
|
26546
|
+
return null;
|
|
26534
26547
|
const flat = (value) => value.replaceAll("\\", "/").toLowerCase();
|
|
26535
|
-
|
|
26548
|
+
const text = flat(command);
|
|
26549
|
+
const state = flat(resolveStateDir());
|
|
26550
|
+
const registry = text.includes(`${state}/issued`) ? "issued" : text.includes(`${state}/approvals`) ? "approvals" : null;
|
|
26551
|
+
return registry && shellWrites(command).writes ? registry : null;
|
|
26552
|
+
};
|
|
26553
|
+
var REGISTRY_DENY = {
|
|
26554
|
+
issued: {
|
|
26555
|
+
label: "issued-registry guard",
|
|
26556
|
+
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."
|
|
26557
|
+
},
|
|
26558
|
+
approvals: {
|
|
26559
|
+
label: "approvals guard",
|
|
26560
|
+
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."
|
|
26561
|
+
}
|
|
26536
26562
|
};
|
|
26537
|
-
var
|
|
26538
|
-
const
|
|
26563
|
+
var registryDeny = ({ file, registry }) => {
|
|
26564
|
+
const { label, unblock } = REGISTRY_DENY[registry];
|
|
26565
|
+
const what = registry === "issued" ? "issued-session state" : "host-approval state";
|
|
26539
26566
|
return {
|
|
26540
26567
|
kind: "deny",
|
|
26541
|
-
reason: `workit
|
|
26568
|
+
reason: `workit ${label}: ${file} is under Workit's ${what}. ${unblock}`,
|
|
26542
26569
|
unblock
|
|
26543
26570
|
};
|
|
26544
26571
|
};
|
|
26545
26572
|
function writeGate(cwd, paths, owner, deps) {
|
|
26546
|
-
const forged = paths?.length ?
|
|
26573
|
+
const forged = paths?.length ? registryTarget(cwd, paths) : null;
|
|
26547
26574
|
if (forged)
|
|
26548
|
-
return
|
|
26575
|
+
return registryDeny(forged);
|
|
26549
26576
|
if (!owner)
|
|
26550
26577
|
return beforeWriteGate(cwd, paths);
|
|
26551
26578
|
const targets = liveTargets(cwd, paths);
|
|
@@ -26559,9 +26586,10 @@ function writeGate(cwd, paths, owner, deps) {
|
|
|
26559
26586
|
}
|
|
26560
26587
|
function shellGate(cwd, command, owner, dialect = "posix", deps) {
|
|
26561
26588
|
try {
|
|
26562
|
-
const
|
|
26589
|
+
const windows = unquotedWindowsRegistry(command);
|
|
26590
|
+
const forged = registryTarget(cwd, segmentTargets(cwd, command, dialect)) ?? (windows ? { file: `the ${windows} registry`, registry: windows } : null);
|
|
26563
26591
|
if (forged)
|
|
26564
|
-
return
|
|
26592
|
+
return registryDeny(forged);
|
|
26565
26593
|
} catch {}
|
|
26566
26594
|
const writes = shellWrites(command);
|
|
26567
26595
|
let targets = [];
|
|
@@ -27130,6 +27158,10 @@ var WRITE_TOOLS = new Set([
|
|
|
27130
27158
|
import fs28 from "node:fs";
|
|
27131
27159
|
import path41 from "node:path";
|
|
27132
27160
|
|
|
27161
|
+
// packages/workit-core/src/approvals/store.ts
|
|
27162
|
+
var REQUEST_TTL_MS = 30 * 60000;
|
|
27163
|
+
var GRANT_TTL_MS = 15 * 60000;
|
|
27164
|
+
|
|
27133
27165
|
// packages/workit-core/src/hooks/hosts/claude-code.ts
|
|
27134
27166
|
var CLAUDE_CODE_DESCRIPTOR = {
|
|
27135
27167
|
host: "claude_code",
|
|
@@ -27171,7 +27203,11 @@ var CLAUDE_CODE_DESCRIPTOR = {
|
|
|
27171
27203
|
maxConcurrency: "undocumented",
|
|
27172
27204
|
agentPrefix: "workit:"
|
|
27173
27205
|
},
|
|
27174
|
-
provenance: {
|
|
27206
|
+
provenance: {
|
|
27207
|
+
sessionId: "native",
|
|
27208
|
+
agentIdOnTool: "native",
|
|
27209
|
+
postToolObserve: "native"
|
|
27210
|
+
},
|
|
27175
27211
|
interaction: { questions: "undocumented", writeBoundary: "partial" },
|
|
27176
27212
|
stopControl: "native",
|
|
27177
27213
|
shellAvailable: "native",
|
|
@@ -27233,6 +27269,7 @@ var CONTEXT_EVENTS = new Set([
|
|
|
27233
27269
|
"PreToolUse",
|
|
27234
27270
|
"PostToolUse"
|
|
27235
27271
|
]);
|
|
27272
|
+
var ASKING_MODES = new Set(["default", "acceptEdits", "plan"]);
|
|
27236
27273
|
|
|
27237
27274
|
// packages/workit-core/src/hooks/hosts/codex.ts
|
|
27238
27275
|
var CODEX_DESCRIPTOR = {
|
|
@@ -28742,7 +28779,7 @@ var DEFAULT_MAX_HOLD_MS = 15 * 60000;
|
|
|
28742
28779
|
var SILENT_MS = 5 * 60000;
|
|
28743
28780
|
var UNITS2 = { "": 1, K: 1024, M: 1024 ** 2, G: 1024 ** 3, T: 1024 ** 4 };
|
|
28744
28781
|
var START_CACHE = new Map;
|
|
28745
|
-
var
|
|
28782
|
+
var GRANT_TTL_MS2 = 2 * 3600000;
|
|
28746
28783
|
var NOTICE_TTL_MS = 7 * 86400000;
|
|
28747
28784
|
|
|
28748
28785
|
// packages/workit-core/src/stack.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.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.6.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|