@workit-dev/opencode 2.18.0 → 2.19.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.
|
@@ -42,7 +42,7 @@ proposes and stops. Nothing changes until the user approves.
|
|
|
42
42
|
agent behaviour, becomes an issue or PR on BrainerVirus/workit, not a host
|
|
43
43
|
memory (one host reads it). Never fork a local copy. Use a minimal synthetic
|
|
44
44
|
repro: no private repo name, path, code, ledger text, PR, thread or transcript.
|
|
45
|
-
Paste the
|
|
45
|
+
Paste the whole `workit feedback "<title>" --body-file -` draft; `--post` once approved.
|
|
46
46
|
6. **Bloat guards.** AGENTS.md stays within 8 KB: each addition names what it
|
|
47
47
|
removes. Create `CODING_STANDARDS.md` or `GLOSSARY.md` only in the same
|
|
48
48
|
edit as its first real entry, never as a scaffold. Edit steering text by
|
|
@@ -53,7 +53,7 @@ the same check. Fix round and recheck both failed: the decider agent (call the s
|
|
|
53
53
|
with `workit check`, fix the root cause, batch every fix in one push, one focused commit per fix (unrelated hunks in one file: `workit git stage --patch <file>`, then `workit git commit -m "<msg>" --staged`). A tool warning is a finding: fix it in this PR in the right layer, or record the false positive with evidence; pre-existing ones get their own PR.
|
|
54
54
|
6. **Verified.** The lane in `workit pr status` decides: none, no verdict; self, your `--self` verdict; focused or full (or `verification: self|independent`), one non-author verifier per PR after the last push, never per push (call the skill tool with `workit-review`), on Claude Code with the `model` and `effort` of `workit models show --role verifier`. A docs-only push (or test-only under a unit verdict) keeps the verdict (`carried`); `reverify: focused` re-checks only the new diff, reusing green CI; one verdict at a stack's top covers its unchanged lower PRs. Land only when
|
|
55
55
|
granted: `workit stack land` or `workit pr merge`; `--unverified --reason` if user-asked.
|
|
56
|
-
Never pipe a delivery verb through `grep`: read its exit code, or use `--json`.
|
|
56
|
+
Never pipe a delivery verb through `grep`, `tail` or `head`: read its exit code, or use `--json`. Trunk CI after a merge: `workit ci wait --branch <trunk>`.
|
|
57
57
|
7. **Observe it landed:** `workit verify-delivery pr` or `merge`. After a failed
|
|
58
58
|
verdict or a check red 3+ times, at any endpoint: offer `/wk-retro` in one
|
|
59
59
|
line of the final or stop report; never pause the babysit loop for it.
|
package/dist/plugin.js
CHANGED
|
@@ -9496,6 +9496,7 @@ var workspaceConfigSchema = object({
|
|
|
9496
9496
|
trailers: boolean2().optional().describe("Whether commits get the `Workit-Session:` trailer (default true). With false, authorship lives in the ledger only."),
|
|
9497
9497
|
deleteBranch: boolean2().optional().describe("Whether `workit pr merge` deletes the head branch after a merge (default true); `--keep-branch` opts out for one merge."),
|
|
9498
9498
|
cleanup: unknown().optional().describe("What happens when work finishes: `auto` (default) removes the delivered branch's clean Workit worktree and local branch, switches a clean checkout on it back to the trunk, and stops the processes registered inside them; `keep` removes and stops nothing. A value Workit does not know reads as `keep`."),
|
|
9499
|
+
feedback: unknown().optional().describe('`workit feedback` for this workspace: `off` hides its contract line and makes the verb refuse; `{ "account": "<login>" }` names the GitHub login it posts with; workspaces inside this one inherit it.'),
|
|
9499
9500
|
liveSessionGuard: boolean2().optional().describe("Whether the live-session guard denies edits in a checkout another live agent session owns (default true)."),
|
|
9500
9501
|
fanout: object({
|
|
9501
9502
|
tierModels: unknown().optional().describe("The model per slice TIER (mundane, standard, hard), as one name or per host.")
|
|
@@ -9538,7 +9539,10 @@ var workspaceConfigSchema = object({
|
|
|
9538
9539
|
});
|
|
9539
9540
|
var workspacesFileSchema = object({
|
|
9540
9541
|
workspaces: array(workspaceConfigSchema).optional().describe("Workspace entries, each mapping a path glob to its forge, policies and grants."),
|
|
9541
|
-
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false).")
|
|
9542
|
+
models: object({ roles: modelRoles }).passthrough().optional().describe("The global default model and effort per role and host (roles), the lead's own advisory model (lead), how a role model applies (enforce: advise, the default, or strict) and, under strict, whether a model the lead names on a spawn wins (allowLeadOverride, default false)."),
|
|
9543
|
+
feedback: object({
|
|
9544
|
+
account: nonBlank.optional().describe("The GitHub login `workit feedback --post` uses when no workspace names one; never the workspace's work account by default.")
|
|
9545
|
+
}).passthrough().optional().describe("`workit feedback` defaults for every workspace.")
|
|
9542
9546
|
}).passthrough().superRefine((file, context) => {
|
|
9543
9547
|
const names = new Set;
|
|
9544
9548
|
for (const [index, workspace] of (file.workspaces ?? []).entries()) {
|
|
@@ -9976,6 +9980,12 @@ var resolveRuntimeReleasePackages = (cwd, dir) => {
|
|
|
9976
9980
|
return found?.source ? { workspace: found.source.name, releasePackages: found.source.releasePackages } : null;
|
|
9977
9981
|
};
|
|
9978
9982
|
var workspaceLiveSessionGuard = (cwd, dir) => inheritedSetting(cwd, dir, (entry) => typeof entry.liveSessionGuard === "boolean")?.source?.liveSessionGuard !== false;
|
|
9983
|
+
var feedbackSetting = (cwd, dir) => {
|
|
9984
|
+
const found = inheritedSetting(cwd, dir, (entry) => entry.feedback !== undefined);
|
|
9985
|
+
const value = found?.source?.feedback;
|
|
9986
|
+
return { found, value, off: value === "off" };
|
|
9987
|
+
};
|
|
9988
|
+
var workspaceFeedbackOff = (cwd, dir) => feedbackSetting(cwd, dir).off;
|
|
9979
9989
|
var changelogPathOf = (value) => {
|
|
9980
9990
|
if (typeof value !== "string")
|
|
9981
9991
|
return null;
|
|
@@ -18387,6 +18397,7 @@ function selectMethods(policy, capabilities) {
|
|
|
18387
18397
|
return [{ id, reason: reasons.join("; "), assurance: capability.assurance }];
|
|
18388
18398
|
});
|
|
18389
18399
|
}
|
|
18400
|
+
var FEEDBACK_LINE = "Workit friction: offer `workit feedback` once per problem; keep working.";
|
|
18390
18401
|
var BOOTSTRAP = `
|
|
18391
18402
|
Workit is optional coordination and proof tooling: you decide what and
|
|
18392
18403
|
whether, the CLI does how and records what it observed.
|
|
@@ -18441,6 +18452,7 @@ effect before a retry.
|
|
|
18441
18452
|
Mid-task: never silently drop or resume an objective (workit-continue).
|
|
18442
18453
|
Notes, drafts, logs, resume files: \`workit dir notes|handoffs\` (outside the
|
|
18443
18454
|
repo), never the repo tree.
|
|
18455
|
+
FEEDBACK_LINE
|
|
18444
18456
|
|
|
18445
18457
|
Skills: load the skill, never act from memory.
|
|
18446
18458
|
- brainstorm, plan, spec, grill, should we: workit-shape
|
|
@@ -18458,9 +18470,13 @@ Skills: load the skill, never act from memory.
|
|
|
18458
18470
|
- architecture, deepen modules (user-invoked; offer it): workit-architecture
|
|
18459
18471
|
`.trim();
|
|
18460
18472
|
var invariantBootstrap = (session = null) => {
|
|
18473
|
+
const feedbackOff = session !== null && workspaceFeedbackOff(session.cwd);
|
|
18474
|
+
const bootstrap = BOOTSTRAP.replace(`FEEDBACK_LINE
|
|
18475
|
+
`, () => feedbackOff ? "" : `${FEEDBACK_LINE}
|
|
18476
|
+
`);
|
|
18461
18477
|
const table = session && hostFamily(session.host) === "claude_code" ? claudeSpawnTable(session.cwd) : null;
|
|
18462
|
-
return table ? `${
|
|
18463
|
-
${table}` :
|
|
18478
|
+
return table ? `${bootstrap}
|
|
18479
|
+
${table}` : bootstrap;
|
|
18464
18480
|
};
|
|
18465
18481
|
|
|
18466
18482
|
// packages/workit-core/src/core/task-context.ts
|
|
@@ -25051,7 +25067,8 @@ var WORKIT_USER_ONLY = [
|
|
|
25051
25067
|
["install"],
|
|
25052
25068
|
["workspace", "seal"]
|
|
25053
25069
|
];
|
|
25054
|
-
var
|
|
25070
|
+
var WORKIT_ASKED_VERBS = ["feedback"];
|
|
25071
|
+
var USER_ONLY_WORD = new RegExp(`\\b(?:${[...new Set([...WORKIT_USER_ONLY.map((words) => words[0]), ...WORKIT_ASKED_VERBS])].join("|")})\\b`);
|
|
25055
25072
|
var mayRunUserOnly = (text) => {
|
|
25056
25073
|
const joined = text.replace(/\\\r?\n/g, "");
|
|
25057
25074
|
const bare = joined.replace(/['"\\]/g, "");
|
|
@@ -25899,7 +25916,7 @@ function heavyPlan(command, options) {
|
|
|
25899
25916
|
};
|
|
25900
25917
|
}
|
|
25901
25918
|
if (single) {
|
|
25902
|
-
const rewrite = leaseRewrite(command);
|
|
25919
|
+
const rewrite = leaseRewrite(command.trim().replace(TAIL_FILTER, ""));
|
|
25903
25920
|
return rewrite ? { kind: "rewrite", command: rewrite, reason: single.reason } : { kind: "none" };
|
|
25904
25921
|
}
|
|
25905
25922
|
const parts = heavy.map((match) => leaseCommand(match.line));
|
|
@@ -25944,6 +25961,7 @@ function workitOnPath2(env = process.env) {
|
|
|
25944
25961
|
}
|
|
25945
25962
|
return false;
|
|
25946
25963
|
}
|
|
25964
|
+
var TAIL_FILTER = /(?:\s+2>&1)?\s*\|\s*(?:tail|head)(?:\s+[\w=.+-]+)*\s*$/u;
|
|
25947
25965
|
var ASSIGNMENTS = /^\s*((?:[A-Za-z_]\w*=(?:'[^']*'|"(?:[^"\\]|\\.)*"|[^\s'"])*\s+)*)/u;
|
|
25948
25966
|
function leaseRewrite(command) {
|
|
25949
25967
|
const text = command.trim();
|
|
@@ -29841,6 +29859,96 @@ Retry as: ${retry}` : ""}`,
|
|
|
29841
29859
|
};
|
|
29842
29860
|
};
|
|
29843
29861
|
|
|
29862
|
+
// packages/workit-core/src/hooks/exit-pipe.ts
|
|
29863
|
+
var EXIT_VERBS = [
|
|
29864
|
+
["ci", "wait"],
|
|
29865
|
+
["check"],
|
|
29866
|
+
["pr", "merge"],
|
|
29867
|
+
["release"],
|
|
29868
|
+
["verify-delivery"]
|
|
29869
|
+
];
|
|
29870
|
+
var base2 = (word = "") => word.split(/[\\/]/u).at(-1) ?? "";
|
|
29871
|
+
var quote3 = (word) => /^[\w@%+=:,./-]+$/u.test(word) ? word : `'${word.replaceAll("'", `'\\''`)}'`;
|
|
29872
|
+
var verbPath = (words) => {
|
|
29873
|
+
const path = [];
|
|
29874
|
+
for (let at = 0;at < words.length && path.length < 2; at += 1) {
|
|
29875
|
+
const word = words[at];
|
|
29876
|
+
if (word === "--")
|
|
29877
|
+
break;
|
|
29878
|
+
if (word === "--cwd")
|
|
29879
|
+
at += 1;
|
|
29880
|
+
else if (!word.startsWith("-"))
|
|
29881
|
+
path.push(word);
|
|
29882
|
+
}
|
|
29883
|
+
return path;
|
|
29884
|
+
};
|
|
29885
|
+
var exitCall = (words) => {
|
|
29886
|
+
let at = 0;
|
|
29887
|
+
while (at < words.length && /^[A-Za-z_]\w*=/u.test(words[at]))
|
|
29888
|
+
at += 1;
|
|
29889
|
+
if (!/^workit(?:-cli)?$/u.test(base2(words[at])))
|
|
29890
|
+
return null;
|
|
29891
|
+
const path = verbPath(words.slice(at + 1));
|
|
29892
|
+
return EXIT_VERBS.some((verb) => verb.every((word, index) => path[index] === word)) ? words.slice(at) : null;
|
|
29893
|
+
};
|
|
29894
|
+
var setsPipefail = (words) => words[0] === "set" && words.some((word, at) => word === "pipefail" && /^-[a-z]*o$/u.test(words[at - 1] ?? ""));
|
|
29895
|
+
var retryOf = ({ call, dir }) => {
|
|
29896
|
+
const at = call[1]?.startsWith("-") ? 1 : 2;
|
|
29897
|
+
const words = dir && !call.includes("--cwd") ? [...call.slice(0, at), "--cwd", dir, ...call.slice(at)] : call;
|
|
29898
|
+
return ["workit", ...words.slice(1)].map(quote3).join(" ");
|
|
29899
|
+
};
|
|
29900
|
+
function exitPipeGate(command, dialect = "posix") {
|
|
29901
|
+
if (!/\bworkit/u.test(command) || !/\b(?:tail|head)\b/u.test(command))
|
|
29902
|
+
return null;
|
|
29903
|
+
const subshellPiped = /\)\s*(?:\d*>&?\d*\s*)*\|(?!\|)/u.test(command);
|
|
29904
|
+
const groups = [];
|
|
29905
|
+
let carry = null;
|
|
29906
|
+
let pipefail = false;
|
|
29907
|
+
let dir = null;
|
|
29908
|
+
for (const segment of segmentsOf(command, dialect)) {
|
|
29909
|
+
if (segment.unanalyzable)
|
|
29910
|
+
return null;
|
|
29911
|
+
let words = segment.words;
|
|
29912
|
+
let closes = segment.group === "close";
|
|
29913
|
+
if (segment.group === "open") {
|
|
29914
|
+
groups.push(null);
|
|
29915
|
+
continue;
|
|
29916
|
+
}
|
|
29917
|
+
if (words[0] === "{") {
|
|
29918
|
+
groups.push(null);
|
|
29919
|
+
words = words.slice(1);
|
|
29920
|
+
} else if (words[0] === "}") {
|
|
29921
|
+
closes = true;
|
|
29922
|
+
words = words.slice(1);
|
|
29923
|
+
}
|
|
29924
|
+
if (closes) {
|
|
29925
|
+
const inner = groups.pop() ?? null;
|
|
29926
|
+
const piped = segment.pipe === true || segment.group === "close" && subshellPiped;
|
|
29927
|
+
carry = piped ? inner ?? carry : null;
|
|
29928
|
+
continue;
|
|
29929
|
+
}
|
|
29930
|
+
if (setsPipefail(words))
|
|
29931
|
+
pipefail = true;
|
|
29932
|
+
const filter = base2(words[0]);
|
|
29933
|
+
if (carry && !pipefail && (filter === "tail" || filter === "head")) {
|
|
29934
|
+
const retry = retryOf(carry);
|
|
29935
|
+
return {
|
|
29936
|
+
kind: "deny",
|
|
29937
|
+
reason: `workit exit-pipe: piping \`workit ${verbPath(carry.call.slice(1)).join(" ")}\` into ${filter} hides its exit code.
|
|
29938
|
+
Retry as: ${retry}`,
|
|
29939
|
+
unblock: retry
|
|
29940
|
+
};
|
|
29941
|
+
}
|
|
29942
|
+
const call = exitCall(words);
|
|
29943
|
+
const found = call ? { call, dir } : null;
|
|
29944
|
+
if (found && groups.length)
|
|
29945
|
+
groups[groups.length - 1] = found;
|
|
29946
|
+
carry = segment.pipe ? found ?? carry : null;
|
|
29947
|
+
dir = words.length === 2 && words[0] === "cd" && !segment.expands?.length ? words[1] : null;
|
|
29948
|
+
}
|
|
29949
|
+
return null;
|
|
29950
|
+
}
|
|
29951
|
+
|
|
29844
29952
|
// packages/workit-core/src/hooks/handle.ts
|
|
29845
29953
|
var offered = new Set;
|
|
29846
29954
|
var PRE_TOOL = new Set(["shell.pre", "write.pre", "tool.pre"]);
|
|
@@ -31846,15 +31954,23 @@ var createV2Lifecycle = (deps) => {
|
|
|
31846
31954
|
|
|
31847
31955
|
// packages/workit-opencode/src/bootstrap.ts
|
|
31848
31956
|
var OPENCODE_ADDENDUM = "On OpenCode, run external mutations with native host tools or the workit CLI; workit_context is read-only and there is no managed external-action executor, so do not create proposals or request Workit approvals merely to invoke native tools. Record a meaningful user choice with workit_decision directly; it needs no question.";
|
|
31849
|
-
var cached2;
|
|
31850
|
-
var
|
|
31851
|
-
|
|
31852
|
-
|
|
31853
|
-
|
|
31854
|
-
|
|
31957
|
+
var cached2 = new Map;
|
|
31958
|
+
var CACHE_DIRS = 32;
|
|
31959
|
+
var getWorkitBootstrap = (cwd = process.cwd()) => {
|
|
31960
|
+
const hit = cached2.get(cwd);
|
|
31961
|
+
if (hit !== undefined) {
|
|
31962
|
+
cached2.delete(cwd);
|
|
31963
|
+
cached2.set(cwd, hit);
|
|
31964
|
+
return hit;
|
|
31965
|
+
}
|
|
31966
|
+
const block = `<workit-contract>
|
|
31967
|
+
${invariantBootstrap({ cwd, host: "opencode" })}
|
|
31855
31968
|
${OPENCODE_ADDENDUM}
|
|
31856
31969
|
</workit-contract>`;
|
|
31857
|
-
|
|
31970
|
+
cached2.set(cwd, block);
|
|
31971
|
+
if (cached2.size > CACHE_DIRS)
|
|
31972
|
+
cached2.delete(cached2.keys().next().value);
|
|
31973
|
+
return block;
|
|
31858
31974
|
};
|
|
31859
31975
|
|
|
31860
31976
|
// packages/workit-opencode/src/runtime.ts
|
|
@@ -31919,7 +32035,7 @@ var hasMarker = (system, marker) => system.some((part) => part.type === "text" &
|
|
|
31919
32035
|
var injectAgentContext = (root, session, directChildren, system) => {
|
|
31920
32036
|
if (!session || !sameWorkspace(root, session.directory))
|
|
31921
32037
|
return;
|
|
31922
|
-
const bootstrap = session.parentID === undefined ? getWorkitBootstrap() : null;
|
|
32038
|
+
const bootstrap = session.parentID === undefined ? getWorkitBootstrap(session.directory ?? root) : null;
|
|
31923
32039
|
const taskContext = compactContextFor(root, session.id);
|
|
31924
32040
|
const workerContext = session.parentID ? workerContextFor(root, session.id, session.parentID, directChildren) : null;
|
|
31925
32041
|
if (bootstrap && !hasMarker(system, "<workit-contract>"))
|
|
@@ -31969,7 +32085,7 @@ var judgeVerdictText = (root, session, workerContext) => {
|
|
|
31969
32085
|
var injectModelSwitch = (root, session, directChildren, system) => {
|
|
31970
32086
|
if (!session || !sameWorkspace(root, session.directory))
|
|
31971
32087
|
return;
|
|
31972
|
-
const contract = session.parentID ? workerContextFor(root, session.id, session.parentID, directChildren) : getWorkitBootstrap();
|
|
32088
|
+
const contract = session.parentID ? workerContextFor(root, session.id, session.parentID, directChildren) : getWorkitBootstrap(session.directory ?? root);
|
|
31973
32089
|
const taskContext = compactContextFor(root, session.id);
|
|
31974
32090
|
const parts = [
|
|
31975
32091
|
contract,
|
|
@@ -32029,6 +32145,9 @@ var evaluateShellPermission = (root, event, workdirs = new Map) => {
|
|
|
32029
32145
|
const ytrack = ytrackGate(cwd, resource, "posix", false);
|
|
32030
32146
|
if (ytrack?.kind === "deny")
|
|
32031
32147
|
return deny(ytrack.reason);
|
|
32148
|
+
const piped = exitPipeGate(resource, "posix");
|
|
32149
|
+
if (piped?.kind === "deny")
|
|
32150
|
+
return deny(piped.reason);
|
|
32032
32151
|
const raw = rawGitPre({
|
|
32033
32152
|
host: "opencode",
|
|
32034
32153
|
cwd,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workit-dev/opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.19.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.19.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=24"
|