@workit-dev/codex 2.27.9 → 2.27.11
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/launch-mcp.js
CHANGED
|
@@ -32787,7 +32787,7 @@ var codexAdapter = {
|
|
|
32787
32787
|
};
|
|
32788
32788
|
},
|
|
32789
32789
|
render,
|
|
32790
|
-
addendum: (input) => `<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @workit-dev/cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json${input.session.id ? ` --actor ${input.session.id}` : ""}. workit acts as this thread (CODEX_THREAD_ID${input.session.id ? `=${input.session.id}` : ""}) unless WORKIT_SESSION_ID is set. A verifier or reviewer records workit ledger verdict under its own session, never the author's: a
|
|
32790
|
+
addendum: (input) => `<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @workit-dev/cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json${input.session.id ? ` --actor ${input.session.id}` : ""}. workit acts as this thread (CODEX_THREAD_ID${input.session.id ? `=${input.session.id}` : ""}) unless WORKIT_SESSION_ID is set. A verifier or reviewer records workit ledger verdict under its own session, never the author's: a Codex subagent's shell is its own thread (CODEX_THREAD_ID), so it passes no --session or --token; <lead>:<agent id> or a made-up <lead>-v1 is refused as forged_session. Merge and release need a workspace grant (workit grant show); a question answer is not host permission.</workit-codex-mutations>`
|
|
32791
32791
|
};
|
|
32792
32792
|
|
|
32793
32793
|
// packages/workit-core/src/hooks/hosts/cursor.ts
|
|
@@ -33106,6 +33106,10 @@ var gap = (part) => ({ workit: null, gap: part });
|
|
|
33106
33106
|
var READ = new Map;
|
|
33107
33107
|
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)");
|
|
33108
33108
|
|
|
33109
|
+
// packages/workit-core/src/hooks/stamp-hint.ts
|
|
33110
|
+
var STATE_NAME = "(?:WORKIT_(?:STATE_DIR|CONFIG)\\w*|XDG_(?:STATE|CONFIG|DATA)_HOME|HOME|USERPROFILE|(?:LOCAL)?APPDATA|OPENCODE_SESSION_ID|PI_SESSION_ID|CODEX_THREAD_ID|CLAUDECODE|CLAUDE_CODE_ENTRYPOINT)";
|
|
33111
|
+
var STATE_ENV = new RegExp(`${STATE_NAME}\\s*\\+?=|(?:unset|-u|--unset)[\\s=]+${STATE_NAME}|env:|EnvironmentVariable`, "iu");
|
|
33112
|
+
|
|
33109
33113
|
// packages/workit-core/src/hooks/hook-entry.ts
|
|
33110
33114
|
var RUNNERS2 = new Set([
|
|
33111
33115
|
"node",
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
stateDir3
|
|
4
|
+
} from "./workit-hook-sxyjantk.js";
|
|
5
|
+
|
|
6
|
+
// packages/workit-core/src/hooks/stamp-hint.ts
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import fs from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
var stampHash2 = (text) => createHash("sha256").update(text).digest("hex").slice(0, 32);
|
|
11
|
+
var stampDir2 = (env, session) => path.join(stateDir3(env), "agent-stamps", stampHash2(session));
|
|
12
|
+
var callTag2 = (toolUseId) => stampHash2(toolUseId).slice(0, 8);
|
|
13
|
+
var backgrounds2 = (command) => /(?:^|[^&<>])&(?![&>])/u.test(command);
|
|
14
|
+
var dropCallStamps2 = (env, session, toolUseId) => {
|
|
15
|
+
try {
|
|
16
|
+
const dir = stampDir2(env, session);
|
|
17
|
+
const tag = `.${callTag2(toolUseId)}-`;
|
|
18
|
+
for (const name of fs.readdirSync(dir))
|
|
19
|
+
if (name.includes(tag))
|
|
20
|
+
fs.rmSync(path.join(dir, name), { force: true });
|
|
21
|
+
} catch {}
|
|
22
|
+
};
|
|
23
|
+
var mayRunWorkit2 = (text) => /(?:^|[\s;&|(])(?:\S*[\\/])?workit(?:\s|$)/u.test(text);
|
|
24
|
+
var dropPostToolStamps2 = (env, payload) => {
|
|
25
|
+
try {
|
|
26
|
+
const value = JSON.parse(payload);
|
|
27
|
+
const command = value.tool_input?.command;
|
|
28
|
+
const text = Array.isArray(command) ? command.join(" ") : String(command ?? "");
|
|
29
|
+
const thread = typeof value.agent_id === "string" && value.agent_id.trim() ? value.agent_id : value.session_id;
|
|
30
|
+
if (value.hook_event_name === "PostToolUse" && typeof thread === "string" && thread && typeof value.tool_use_id === "string" && value.tool_use_id && mayRunWorkit2(text) && !backgrounds2(text))
|
|
31
|
+
dropCallStamps2(env, thread, value.tool_use_id);
|
|
32
|
+
} catch {}
|
|
33
|
+
};
|
|
34
|
+
var IDENTITY_ENV = /WORKIT_(?:AGENT_ID|HOST|SESSION_ID|SESSION_TOKEN)|\benv\b[^\n;&|]*\s(?:-[a-z]*i|--ignore-environment|-)(?:\s|$)/u;
|
|
35
|
+
var STATE_NAME = "(?:WORKIT_(?:STATE_DIR|CONFIG)\\w*|XDG_(?:STATE|CONFIG|DATA)_HOME|HOME|USERPROFILE|(?:LOCAL)?APPDATA|OPENCODE_SESSION_ID|PI_SESSION_ID|CODEX_THREAD_ID|CLAUDECODE|CLAUDE_CODE_ENTRYPOINT)";
|
|
36
|
+
var STATE_ENV = new RegExp(`${STATE_NAME}\\s*\\+?=|(?:unset|-u|--unset)[\\s=]+${STATE_NAME}|env:|EnvironmentVariable`, "iu");
|
|
37
|
+
var mayChangeIdentity2 = (text) => {
|
|
38
|
+
const bare = text.replace(/['"\\]/gu, "");
|
|
39
|
+
return IDENTITY_ENV.test(bare) || STATE_ENV.test(bare);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export { stampHash2, stampDir2, callTag2, backgrounds2, dropCallStamps2, mayRunWorkit2, dropPostToolStamps2, mayChangeIdentity2 };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
stampHash2,
|
|
4
|
+
stampDir2,
|
|
5
|
+
callTag2,
|
|
6
|
+
backgrounds2,
|
|
7
|
+
dropCallStamps2,
|
|
8
|
+
mayRunWorkit2,
|
|
9
|
+
dropPostToolStamps2,
|
|
10
|
+
mayChangeIdentity2
|
|
11
|
+
} from "./workit-hook-28rqjzbb.js";
|
|
12
|
+
import"./workit-hook-sxyjantk.js";
|
|
13
|
+
export {
|
|
14
|
+
backgrounds2 as backgrounds,
|
|
15
|
+
callTag2 as callTag,
|
|
16
|
+
dropCallStamps2 as dropCallStamps,
|
|
17
|
+
dropPostToolStamps2 as dropPostToolStamps,
|
|
18
|
+
mayChangeIdentity2 as mayChangeIdentity,
|
|
19
|
+
mayRunWorkit2 as mayRunWorkit,
|
|
20
|
+
stampDir2 as stampDir,
|
|
21
|
+
stampHash2 as stampHash
|
|
22
|
+
};
|
|
@@ -33,6 +33,13 @@ import {
|
|
|
33
33
|
import {
|
|
34
34
|
locateWorkitCli2
|
|
35
35
|
} from "./workit-hook-agyvx03a.js";
|
|
36
|
+
import {
|
|
37
|
+
stampHash2,
|
|
38
|
+
stampDir2,
|
|
39
|
+
callTag2,
|
|
40
|
+
backgrounds2,
|
|
41
|
+
dropCallStamps2
|
|
42
|
+
} from "./workit-hook-28rqjzbb.js";
|
|
36
43
|
import {
|
|
37
44
|
recordHookRun2
|
|
38
45
|
} from "./workit-hook-p972vv1e.js";
|
|
@@ -21153,7 +21160,7 @@ var codexAdapter = {
|
|
|
21153
21160
|
};
|
|
21154
21161
|
},
|
|
21155
21162
|
render,
|
|
21156
|
-
addendum: (input) => `<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @workit-dev/cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json${input.session.id ? ` --actor ${input.session.id}` : ""}. workit acts as this thread (CODEX_THREAD_ID${input.session.id ? `=${input.session.id}` : ""}) unless WORKIT_SESSION_ID is set. A verifier or reviewer records workit ledger verdict under its own session, never the author's: a
|
|
21163
|
+
addendum: (input) => `<workit-codex-mutations>Codex MCP is read-only: unattested callers cannot mutate. Run workit verbs with the workit CLI on the shell (node_modules/.bin/workit, or npx -y @workit-dev/cli): check, git branch|commit|push, pr, ci, stack, ledger, handoff; task-family mutations take --json${input.session.id ? ` --actor ${input.session.id}` : ""}. workit acts as this thread (CODEX_THREAD_ID${input.session.id ? `=${input.session.id}` : ""}) unless WORKIT_SESSION_ID is set. A verifier or reviewer records workit ledger verdict under its own session, never the author's: a Codex subagent's shell is its own thread (CODEX_THREAD_ID), so it passes no --session or --token; <lead>:<agent id> or a made-up <lead>-v1 is refused as forged_session. Merge and release need a workspace grant (workit grant show); a question answer is not host permission.</workit-codex-mutations>`
|
|
21157
21164
|
};
|
|
21158
21165
|
|
|
21159
21166
|
// packages/workit-core/src/hooks/hosts/cursor.ts
|
|
@@ -23724,13 +23731,11 @@ Retry as: ${retry}`,
|
|
|
23724
23731
|
}
|
|
23725
23732
|
|
|
23726
23733
|
// packages/workit-core/src/agent-stamp.ts
|
|
23727
|
-
import {
|
|
23734
|
+
import { randomBytes as randomBytes4 } from "node:crypto";
|
|
23728
23735
|
import fs26 from "node:fs";
|
|
23729
23736
|
import path40 from "node:path";
|
|
23730
23737
|
var STAMP_TTL_MS = 120000;
|
|
23731
23738
|
var AGENT_ID = /^[\w-]{1,64}$/u;
|
|
23732
|
-
var hash2 = (text) => createHash17("sha256").update(text).digest("hex").slice(0, 32);
|
|
23733
|
-
var stampDir = (env, session) => path40.join(stateDir3(env), "agent-stamps", hash2(session));
|
|
23734
23739
|
var workitCalls2 = (command, dialect = "posix") => {
|
|
23735
23740
|
const calls = [];
|
|
23736
23741
|
try {
|
|
@@ -23749,28 +23754,20 @@ var noteAgentStamps = (env, session, agentId, command, options = {}) => {
|
|
|
23749
23754
|
const calls = workitCalls2(command, options.dialect);
|
|
23750
23755
|
if (!calls.length)
|
|
23751
23756
|
return;
|
|
23752
|
-
const call = options.toolUseId ?
|
|
23757
|
+
const call = options.toolUseId ? callTag2(options.toolUseId) : randomBytes4(4).toString("hex");
|
|
23753
23758
|
try {
|
|
23754
|
-
const dir =
|
|
23759
|
+
const dir = stampDir2(env, session);
|
|
23755
23760
|
fs26.mkdirSync(dir, { recursive: true, mode: 448 });
|
|
23756
23761
|
const now = Date.now();
|
|
23757
23762
|
for (const name of fs26.readdirSync(dir))
|
|
23758
23763
|
if (now - fs26.statSync(path40.join(dir, name)).mtimeMs > STAMP_TTL_MS)
|
|
23759
23764
|
fs26.rmSync(path40.join(dir, name), { force: true });
|
|
23760
|
-
calls.forEach((argv, index) => fs26.writeFileSync(path40.join(dir, `${
|
|
23765
|
+
calls.forEach((argv, index) => fs26.writeFileSync(path40.join(dir, `${stampHash2(argv.join("\x00"))}.${agentId ?? ""}.${call}-${index}`), ""));
|
|
23761
23766
|
} catch {}
|
|
23762
23767
|
};
|
|
23763
|
-
var callTag = (toolUseId) => hash2(toolUseId).slice(0, 8);
|
|
23764
23768
|
var dropAgentStamps = (env, session, toolUseId, command) => {
|
|
23765
|
-
if (
|
|
23766
|
-
|
|
23767
|
-
try {
|
|
23768
|
-
const dir = stampDir(env, session);
|
|
23769
|
-
const tag = `.${callTag(toolUseId)}-`;
|
|
23770
|
-
for (const name of fs26.readdirSync(dir))
|
|
23771
|
-
if (name.includes(tag))
|
|
23772
|
-
fs26.rmSync(path40.join(dir, name), { force: true });
|
|
23773
|
-
} catch {}
|
|
23769
|
+
if (session && toolUseId && command.includes("workit") && !backgrounds2(command))
|
|
23770
|
+
dropCallStamps2(env, session, toolUseId);
|
|
23774
23771
|
};
|
|
23775
23772
|
|
|
23776
23773
|
// packages/workit-core/src/hooks/hook-entry.ts
|
|
@@ -24543,6 +24540,8 @@ var identityEnvDeny = (change) => {
|
|
|
24543
24540
|
var usable2 = (value) => value === "native" || value === "partial";
|
|
24544
24541
|
var stampsAgents = (descriptor) => descriptor.transport === "hook-process" && usable2(descriptor.provenance.agentIdOnTool);
|
|
24545
24542
|
var NONE6 = { kind: "none" };
|
|
24543
|
+
var subagentShellIsOwnSession = (descriptor) => descriptor.host === "codex_cli" || descriptor.host === "codex_desktop";
|
|
24544
|
+
var stampKey = (input, descriptor) => subagentShellIsOwnSession(descriptor) && input.session.agentId ? { session: input.session.agentId, agentId: null } : { session: input.session.id, agentId: input.session.agentId };
|
|
24546
24545
|
var resendsOnChange = (descriptor) => descriptor.context.turnResend === "on-change" && usable2(descriptor.context.perTurn);
|
|
24547
24546
|
var offered = new Set;
|
|
24548
24547
|
var agentRole = (input, descriptor) => input.session.agentId && input.session.agentType !== null ? workitRole(descriptor, input.session.agentType) : null;
|
|
@@ -24588,7 +24587,7 @@ ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
|
|
|
24588
24587
|
const at = currentBranch(cwd) === null ? null : worktreeTop(cwd) ?? null;
|
|
24589
24588
|
const checks = judgeChecksLine(cwd);
|
|
24590
24589
|
const checksText = checks ? ` ${checks}` : "";
|
|
24591
|
-
if (descriptor
|
|
24590
|
+
if (subagentShellIsOwnSession(descriptor))
|
|
24592
24591
|
return `${readOnly} Its shell already acts as its own Workit session, so the ledger tells its verdicts apart from the author's. Record the verdict with exactly this command (pick the result${pick}, name the candidate branch if it differs, say what you ran): \`${verdictCommand({ branch, judge, cwd: at })}\`. Add no session or token option to it, and never set WORKIT_SESSION_ID by hand.${checksText}`;
|
|
24593
24592
|
const token = session ? recordIssuedSession(cwd, session, own) : null;
|
|
24594
24593
|
if (session && !token)
|
|
@@ -24761,8 +24760,10 @@ function decide(input, deps) {
|
|
|
24761
24760
|
const aside = plan.kind === "passthrough" ? plan.note : null;
|
|
24762
24761
|
noteRawCommit(input, event.command, postTool ? callKey(event.toolUseId, event.command) : NEXT_COMMAND);
|
|
24763
24762
|
const bypass = !lease && input.host === "claude_code" ? workitBypassFlag(event.command, event.dialect) : null;
|
|
24764
|
-
if (stampsAgents(descriptor))
|
|
24765
|
-
|
|
24763
|
+
if (stampsAgents(descriptor)) {
|
|
24764
|
+
const key = stampKey(input, descriptor);
|
|
24765
|
+
noteAgentStamps(process.env, key.session, key.agentId, lease?.command ?? cwdCommand ?? event.command, { dialect: event.dialect, toolUseId: event.toolUseId });
|
|
24766
|
+
}
|
|
24766
24767
|
if (bypass)
|
|
24767
24768
|
return { kind: "ask", reason: bypass };
|
|
24768
24769
|
const rewrittenTo = lease?.command ?? cwdCommand;
|
|
@@ -24792,7 +24793,7 @@ function decide(input, deps) {
|
|
|
24792
24793
|
if (usable2(descriptor.events["shell.post"].support))
|
|
24793
24794
|
rawGitPost(input, event.command, callKey(event.toolUseId, event.command));
|
|
24794
24795
|
if (stampsAgents(descriptor))
|
|
24795
|
-
dropAgentStamps(process.env, input.session
|
|
24796
|
+
dropAgentStamps(process.env, stampKey(input, descriptor).session, event.toolUseId, event.command);
|
|
24796
24797
|
return NONE6;
|
|
24797
24798
|
case "write.pre": {
|
|
24798
24799
|
if (!usable2(descriptor.events["write.pre"].support))
|
package/dist/workit-hook.js
CHANGED
|
@@ -42,6 +42,7 @@ var { recordHookRun } = await import("./workit-hook-a7qmf2t8.js");
|
|
|
42
42
|
var { observeHookBudget } = await import("./workit-hook-3g6cv3hd.js");
|
|
43
43
|
var { hasTaskStore, mayReach } = await import("./workit-hook-3c7ce65d.js");
|
|
44
44
|
var { mayHitHookGuard } = await import("./workit-hook-hhg5reqd.js");
|
|
45
|
+
var { dropPostToolStamps, mayChangeIdentity, mayRunWorkit } = await import("./workit-hook-v241dvew.js");
|
|
45
46
|
var YTRACK_WORD = /ytrack(?![\w/-]|\.(?!exe|cmd))/i;
|
|
46
47
|
var namesYtrack = (text) => {
|
|
47
48
|
const bare = text.replace(/['"\\]/g, "");
|
|
@@ -60,7 +61,7 @@ var SHELL_TOOLS = new Set(["bash", "unified-exec"]);
|
|
|
60
61
|
var WRITE_TOOLS = new Set(["applypatch", "edit", "write"]);
|
|
61
62
|
var guarded = (text) => {
|
|
62
63
|
const flat = (s) => s.replaceAll("\\", "/").toLowerCase();
|
|
63
|
-
return [flat(text), text.replace(/['"\\]/g, "").toLowerCase()].some((all) => /issued|approvals|workspaces\.json|\.config\/workit|state\/workit/.test(all) || [stateDir, configDir].some((dir) => all.includes(flat(dir(process.env)))));
|
|
64
|
+
return [flat(text), text.replace(/['"\\]/g, "").toLowerCase()].some((all) => /issued|approvals|agent-stamps|workspaces\.json|\.config\/workit|state\/workit/.test(all) || [stateDir, configDir].some((dir) => all.includes(flat(dir(process.env)))));
|
|
64
65
|
};
|
|
65
66
|
var quietEvent = () => {
|
|
66
67
|
try {
|
|
@@ -88,12 +89,15 @@ var quietEvent = () => {
|
|
|
88
89
|
return null;
|
|
89
90
|
if (event === "PostToolUse")
|
|
90
91
|
return /\bcommit\b/.test(text) ? null : event;
|
|
92
|
+
if (mayRunWorkit(text) || mayChangeIdentity(text))
|
|
93
|
+
return null;
|
|
91
94
|
const writes = /\b(?:git|gh|glab)\b|>|\b(?:tee|sponge|touch|mkdir|rm|rmdir|mv|cp|truncate|install|ln|patch|dd|sed|perl|set-content|add-content|out-file|new-item|ni|remove-item|del|copy-item|move-item)\b/i.test(text.replace(/\d*>&(?:\d+|-)(?![^\s;&|()<>])|[\d&]*>>?\s*\/dev\/(?:null|stdout|stderr|tty)(?![^\s;&|()<>])/g, " "));
|
|
92
95
|
return /\b(?:git|gh|glab|node|tsx|ts-node|bash|sh|zsh|dash|ksh|ruby|perl|php|source)\b|(?:^|[;&|(\n])\s*(?:\w+=\S*\s+)*(?:(?:time|exec|sudo|nice|nohup|env|command|builtin|timeout|stdbuf|if|then|do|while|until|!)\s+(?:-\S+\s+|\d\S*\s+)*)*(?:\.\s+\S|\.{0,2}\/)/.test(text) || guarded(text) || mayHitHookGuard(text) || namesYtrack(text) || mayRunUserOnly(text) || writes && (process.platform === "win32" || hasTaskStore(value.cwd)) || mayReach(text, value.cwd) || maybeHeavy(text, value.cwd) ? null : event;
|
|
93
96
|
} catch {
|
|
94
97
|
return null;
|
|
95
98
|
}
|
|
96
99
|
};
|
|
100
|
+
dropPostToolStamps(process.env, payload);
|
|
97
101
|
var quiet = observeHookBudget(payload) ? null : quietEvent();
|
|
98
102
|
if (quiet) {
|
|
99
103
|
if (quiet === "PreToolUse")
|
|
@@ -102,7 +106,7 @@ if (quiet) {
|
|
|
102
106
|
`);
|
|
103
107
|
} else {
|
|
104
108
|
try {
|
|
105
|
-
const { runCodexHook } = await import("./workit-hook-
|
|
109
|
+
const { runCodexHook } = await import("./workit-hook-vn2fvwba.js");
|
|
106
110
|
await runCodexHook([payload]);
|
|
107
111
|
} catch (error) {
|
|
108
112
|
const { answerRuntimeFailure } = await import("./workit-hook-2j7nwxvz.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/codex",
|
|
3
|
-
"version": "2.27.
|
|
3
|
+
"version": "2.27.11",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Workit Codex CLI/desktop plugin — shared MCP transport, hooks, method skills, and verifier/reviewer/implementer agents",
|
|
6
6
|
"keywords": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"build": "bun scripts/build.ts"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@workit-dev/core": "^2.27.
|
|
45
|
-
"@workit-dev/mcp": "^2.27.
|
|
44
|
+
"@workit-dev/core": "^2.27.11",
|
|
45
|
+
"@workit-dev/mcp": "^2.27.11"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=24"
|