@workit-dev/opencode 1.0.4 → 1.1.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.
@@ -41,7 +41,7 @@ the same check. Fix round and recheck both failed: a decider (call the skill too
41
41
  and the stop point unless merge is granted.
42
42
  3. **Conflicts or a required rebase.** Rewrite only a branch this session or
43
43
  its stack created (yours in `workit ledger list --type commit.recorded` or
44
- `workit stack status`): rebase onto the base, `workit git push
44
+ `workit stack status`): `workit git rebase`, then `workit git push
45
45
  --force-with-lease` (`workit stack sync` in a stack). Anyone else's branch:
46
46
  report that a rebase is needed and stop.
47
47
  4. **Review threads** (`workit pr threads`). Check each claim in the code; fix
package/dist/plugin.js CHANGED
@@ -27194,36 +27194,50 @@ var DESCRIPTORS = {
27194
27194
  pi: PI_DESCRIPTOR
27195
27195
  };
27196
27196
  var workerOfLead = (input) => input.session.agentType === null || workitRole(DESCRIPTORS[input.host], input.session.agentType) !== null;
27197
- var worksFor = (plan, input, branch) => {
27197
+ var worksFor = (plan, input, branches) => {
27198
27198
  const session = input.session.id;
27199
27199
  if (plan.leads.includes(session) && !input.session.agentId)
27200
- return false;
27200
+ return null;
27201
+ if (branches.some((branch) => plan.branches.includes(branch)))
27202
+ return "slice";
27201
27203
  const lead = leadOf2(input);
27202
27204
  if (lead && plan.leads.includes(lead) && workerOfLead(input))
27203
- return true;
27204
- if (plan.leads.some((each) => session.startsWith(`${each}-w-`)))
27205
- return true;
27206
- const current = branch();
27207
- return current !== null && plan.branches.includes(current);
27205
+ return "lead";
27206
+ return plan.leads.some((each) => session.startsWith(`${each}-w-`)) ? "lead" : null;
27207
+ };
27208
+ var agentBranches = (input, rows) => {
27209
+ const { id, agentId } = input.session;
27210
+ const bound = agentId ? rows.findLast((row) => row.type === "worktree.bound" && row.actor.session === id && row.actor.agentId === agentId && typeof row.worktree === "string")?.worktree : undefined;
27211
+ const dirs = typeof bound === "string" ? [input.cwd, bound] : [input.cwd];
27212
+ return dirs.map((dir) => currentBranch(dir)).filter((branch) => !!branch);
27208
27213
  };
27209
27214
  var standingFor = (input, store, rev) => {
27210
27215
  const orders = new Map;
27211
27216
  const ledger = readLedger(input.cwd);
27212
27217
  const rows = ledger.ok ? ledger.value.rows : [];
27213
- let branch;
27214
- const lazyBranch = () => branch === undefined ? branch = currentBranch(input.cwd) : branch;
27215
- for (const plan of readPlans(store))
27216
- if (worksFor(plan, input, lazyBranch))
27217
- for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
27218
- orders.set(row.id, row);
27219
- return { rev, orders, rows };
27218
+ const branches = agentBranches(input, rows);
27219
+ const matched = readPlans(store).map((plan) => ({
27220
+ plan,
27221
+ how: worksFor(plan, input, branches)
27222
+ }));
27223
+ const tied = matched.some(({ how }) => how === "slice");
27224
+ const plans = matched.filter(({ how }) => tied ? how === "slice" : how !== null);
27225
+ for (const { plan } of plans)
27226
+ for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
27227
+ orders.set(row.id, row);
27228
+ return {
27229
+ rev,
27230
+ orders,
27231
+ rows,
27232
+ fanouts: new Set(plans.map(({ plan }) => plan.name))
27233
+ };
27220
27234
  };
27221
27235
  var fanoutOf = (row) => typeof row.fanout === "string" ? row.fanout : "?";
27222
27236
  var changedSince = (now, ids) => {
27223
27237
  const known = new Set(ids);
27224
27238
  const added = [...now.orders.values()].filter((row) => !known.has(row.id));
27225
27239
  const byId = new Map(now.rows.map((row) => [row.id, row]));
27226
- const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined);
27240
+ const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined && now.fanouts.has(fanoutOf(row)));
27227
27241
  if (!added.length && !dropped.length)
27228
27242
  return null;
27229
27243
  const fanouts = [...new Set([...added, ...dropped].map(fanoutOf))].join(", ");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workit-dev/opencode",
3
- "version": "1.0.4",
3
+ "version": "1.1.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.0.4"
44
+ "@workit-dev/core": "^1.1.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=24"