@workit-dev/opencode 2.4.4 → 2.5.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 +32 -4
- package/package.json +2 -2
package/dist/plugin.js
CHANGED
|
@@ -28045,6 +28045,19 @@ import path43 from "node:path";
|
|
|
28045
28045
|
var REQUEST_TTL_MS = 30 * 60000;
|
|
28046
28046
|
var GRANT_TTL_MS = 15 * 60000;
|
|
28047
28047
|
var ASKING_HOSTS = new Set(["claude_code", "pi"]);
|
|
28048
|
+
var INLINE_ASK_TTL_MS = 2 * 60000;
|
|
28049
|
+
var namesTicket = (text) => /WORKIT_APPROVAL_(?:TICKET|UNASKED)/u.test(text.replace(/['"\\]/gu, ""));
|
|
28050
|
+
var TICKET_DENY = "Only the host's prompt adds an approval ticket.";
|
|
28051
|
+
|
|
28052
|
+
// packages/workit-core/src/approvals/youtrack-ask.ts
|
|
28053
|
+
var TIME = "markdown file minutes text date";
|
|
28054
|
+
var FLAGS = {
|
|
28055
|
+
note: TIME,
|
|
28056
|
+
time: TIME,
|
|
28057
|
+
meeting: TIME,
|
|
28058
|
+
update: `${TIME} attach state command`,
|
|
28059
|
+
create: "project summary description file attach command"
|
|
28060
|
+
};
|
|
28048
28061
|
|
|
28049
28062
|
// packages/workit-core/src/hooks/hosts/claude-code.ts
|
|
28050
28063
|
var CLAUDE_CODE_DESCRIPTOR = {
|
|
@@ -28153,7 +28166,7 @@ var CONTEXT_EVENTS = new Set([
|
|
|
28153
28166
|
"PreToolUse",
|
|
28154
28167
|
"PostToolUse"
|
|
28155
28168
|
]);
|
|
28156
|
-
var ASKING_MODES = new Set(["default", "acceptEdits", "plan"]);
|
|
28169
|
+
var ASKING_MODES = new Set(["default", "acceptEdits", "plan", "auto"]);
|
|
28157
28170
|
|
|
28158
28171
|
// packages/workit-core/src/hooks/hosts/codex.ts
|
|
28159
28172
|
var CODEX_DESCRIPTOR = {
|
|
@@ -29230,7 +29243,13 @@ var SHELLS3 = /^(?:sh|bash|zsh|dash|ksh|ash|mksh|yash|fish)$/;
|
|
|
29230
29243
|
var MAX_DEPTH2 = 4;
|
|
29231
29244
|
var READ = new Map;
|
|
29232
29245
|
var NOT_PLAIN = gap("a ytrack call that is not a plain command of its own (a wrapper, loop, substitution or script around it can change or repeat it)");
|
|
29233
|
-
var
|
|
29246
|
+
var timeOnly = (effect) => effect?.minutes !== undefined && Object.keys(effect).every((key) => /^(?:issue|minutes|text|date)$/u.test(key));
|
|
29247
|
+
var ungrant = (write) => write.workit ? {
|
|
29248
|
+
command: write.command,
|
|
29249
|
+
...NOT_PLAIN,
|
|
29250
|
+
...timeOnly(write.effect) ? { hint: write.workit } : {}
|
|
29251
|
+
} : write;
|
|
29252
|
+
var hinted = (write) => write.hint ? { command: write.command, workit: write.hint } : write;
|
|
29234
29253
|
var ytrackArgs = (line, found, depth, names, plain) => {
|
|
29235
29254
|
const inner = (script) => void found.push(...ytrackWrites(script, "posix", depth + 1, plain));
|
|
29236
29255
|
const tail = workitCheckTail(line);
|
|
@@ -29364,6 +29383,7 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
|
29364
29383
|
found = [];
|
|
29365
29384
|
for (const line of commandLines(command, dialect))
|
|
29366
29385
|
ytrackArgs(line, found, depth, aliases(command), false);
|
|
29386
|
+
found = found.map(hinted);
|
|
29367
29387
|
}
|
|
29368
29388
|
READ.set(key, found);
|
|
29369
29389
|
if (READ.size > 64)
|
|
@@ -29371,6 +29391,8 @@ var ytrackWrites = (command, dialect = "posix", depth = 0, plain = true) => {
|
|
|
29371
29391
|
return found;
|
|
29372
29392
|
};
|
|
29373
29393
|
var ytrackGate = (cwd, command, dialect, ask) => {
|
|
29394
|
+
if (namesTicket(command))
|
|
29395
|
+
return { kind: "deny", reason: TICKET_DENY, unblock: null };
|
|
29374
29396
|
let writes;
|
|
29375
29397
|
try {
|
|
29376
29398
|
const merged = new Map;
|
|
@@ -29398,8 +29420,8 @@ var ytrackGate = (cwd, command, dialect, ask) => {
|
|
|
29398
29420
|
reason: `${bare.join(", ")} writes to YouTrack: the user decides this call (#780).`
|
|
29399
29421
|
};
|
|
29400
29422
|
const why = `A raw ytrack write posts to YouTrack without the user's yes (#780).`;
|
|
29401
|
-
const run = calls.length ? ` Run ${calls.join(", then ")} instead
|
|
29402
|
-
const user = bare.length ? ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
|
|
29423
|
+
const run = calls.length ? ` Run ${calls.join(", then ")} instead, each as its own plain call: it asks the user first.` : "";
|
|
29424
|
+
const user = bare.length ? ask ? ` For ${bare.join(", ")}, run it as its own plain call: the host asks the user.` : ` For ${bare.join(", ")}, the user decides: ask the user, and if they agree they run it in their own terminal.` : "";
|
|
29403
29425
|
const rerun = writes.some((write) => write.gap === NOT_PLAIN.gap) ? " To get the named workit youtrack call instead, rerun the ytrack call as one plain command, with no wrapper, loop, substitution or script around it." : "";
|
|
29404
29426
|
return {
|
|
29405
29427
|
kind: "deny",
|
|
@@ -31537,6 +31559,11 @@ var injectCompactionContext = (root, sessionID, system) => {
|
|
|
31537
31559
|
|
|
31538
31560
|
// packages/workit-opencode/src/v2/permissions.ts
|
|
31539
31561
|
var WRITE_ACTIONS = new Set(["edit", "write", "patch"]);
|
|
31562
|
+
var WRITE_TOOLS2 = new Set(["write", "edit", "multiedit", "patch", "apply_patch"]);
|
|
31563
|
+
var checkWriteArgs = (tool, input) => {
|
|
31564
|
+
if (WRITE_TOOLS2.has(tool) && namesTicket(JSON.stringify(input ?? {})))
|
|
31565
|
+
throw new Error(TICKET_DENY);
|
|
31566
|
+
};
|
|
31540
31567
|
var evaluateShellPermission = (root, event, workdirs = new Map) => {
|
|
31541
31568
|
if (event.effect === "deny")
|
|
31542
31569
|
return;
|
|
@@ -32303,6 +32330,7 @@ var setup = async (ctx) => {
|
|
|
32303
32330
|
const spawnNotes = new Map;
|
|
32304
32331
|
const switchNotices = new Set;
|
|
32305
32332
|
await ctx.tool.hook("execute.before", async (event) => {
|
|
32333
|
+
checkWriteArgs(event.tool, event.input);
|
|
32306
32334
|
const budgetEvent = {
|
|
32307
32335
|
tool: event.tool,
|
|
32308
32336
|
sessionID: String(event.sessionID),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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": "^2.
|
|
44
|
+
"@workit-dev/core": "^2.5.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|