@workit-dev/pi 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.
- package/dist/worker.js +37 -16
- package/dist/workit.js +42 -18
- package/package.json +1 -1
- package/skills/workit-ship/SKILL.md +1 -1
package/dist/worker.js
CHANGED
|
@@ -9736,36 +9736,54 @@ var DESCRIPTORS = {
|
|
|
9736
9736
|
pi: PI_DESCRIPTOR
|
|
9737
9737
|
};
|
|
9738
9738
|
var workerOfLead = (input) => input.session.agentType === null || workitRole(DESCRIPTORS[input.host], input.session.agentType) !== null;
|
|
9739
|
-
var worksFor = (plan, input,
|
|
9739
|
+
var worksFor = (plan, input, branches) => {
|
|
9740
9740
|
const session = input.session.id;
|
|
9741
9741
|
if (plan.leads.includes(session) && !input.session.agentId)
|
|
9742
|
-
return
|
|
9742
|
+
return null;
|
|
9743
|
+
if (branches.some((branch) => plan.branches.includes(branch)))
|
|
9744
|
+
return "slice";
|
|
9743
9745
|
const lead = leadOf(input);
|
|
9744
9746
|
if (lead && plan.leads.includes(lead) && workerOfLead(input))
|
|
9745
|
-
return
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9747
|
+
return "lead";
|
|
9748
|
+
return plan.leads.some((each) => session.startsWith(`${each}-w-`)) ? "lead" : null;
|
|
9749
|
+
};
|
|
9750
|
+
var agentBranches = (input, rows) => {
|
|
9751
|
+
const { id, agentId } = input.session;
|
|
9752
|
+
const bound = agentId ? rows.findLast((row) => row.type === "worktree.bound" && row.actor.session === id && row.actor.agentId === agentId && typeof row.worktree === "string")?.worktree : undefined;
|
|
9753
|
+
const dirs = typeof bound === "string" ? [input.cwd, bound] : [input.cwd];
|
|
9754
|
+
return dirs.map((dir) => currentBranch(dir)).filter((branch) => !!branch);
|
|
9750
9755
|
};
|
|
9751
9756
|
var standingFor = (input, store, rev) => {
|
|
9752
9757
|
const orders = new Map;
|
|
9753
9758
|
const ledger = readLedger(input.cwd);
|
|
9754
9759
|
const rows = ledger.ok ? ledger.value.rows : [];
|
|
9755
|
-
|
|
9756
|
-
const
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9760
|
+
const branches = agentBranches(input, rows);
|
|
9761
|
+
const matched = readPlans(store).map((plan) => ({
|
|
9762
|
+
plan,
|
|
9763
|
+
how: worksFor(plan, input, branches)
|
|
9764
|
+
}));
|
|
9765
|
+
const tied = matched.some(({ how }) => how === "slice");
|
|
9766
|
+
const plans = matched.filter(({ how }) => tied ? how === "slice" : how !== null);
|
|
9767
|
+
for (const { plan } of plans)
|
|
9768
|
+
for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
|
|
9769
|
+
orders.set(row.id, row);
|
|
9770
|
+
return {
|
|
9771
|
+
rev,
|
|
9772
|
+
orders,
|
|
9773
|
+
rows,
|
|
9774
|
+
fanouts: new Set(plans.map(({ plan }) => plan.name))
|
|
9775
|
+
};
|
|
9762
9776
|
};
|
|
9763
9777
|
var located = (input) => {
|
|
9764
9778
|
const store = input.session.id ? gitStoreDir(input.cwd) : null;
|
|
9765
9779
|
const rev = store ? readStandingRev(store) : null;
|
|
9766
9780
|
if (!store || rev === null)
|
|
9767
9781
|
return null;
|
|
9768
|
-
return {
|
|
9782
|
+
return {
|
|
9783
|
+
store,
|
|
9784
|
+
rev,
|
|
9785
|
+
file: standingSeenFile(store, input.session.id, input.session.agentId)
|
|
9786
|
+
};
|
|
9769
9787
|
};
|
|
9770
9788
|
var seedStanding = (input) => {
|
|
9771
9789
|
try {
|
|
@@ -9773,7 +9791,10 @@ var seedStanding = (input) => {
|
|
|
9773
9791
|
if (!where)
|
|
9774
9792
|
return;
|
|
9775
9793
|
const now = standingFor(input, where.store, where.rev);
|
|
9776
|
-
writeStandingSeen(where.file, {
|
|
9794
|
+
writeStandingSeen(where.file, {
|
|
9795
|
+
rev: where.rev,
|
|
9796
|
+
ids: [...now.orders.keys()]
|
|
9797
|
+
});
|
|
9777
9798
|
} catch {}
|
|
9778
9799
|
};
|
|
9779
9800
|
var sinceStart = new Map;
|
package/dist/workit.js
CHANGED
|
@@ -27476,36 +27476,54 @@ var DESCRIPTORS = {
|
|
|
27476
27476
|
pi: PI_DESCRIPTOR
|
|
27477
27477
|
};
|
|
27478
27478
|
var workerOfLead = (input) => input.session.agentType === null || workitRole(DESCRIPTORS[input.host], input.session.agentType) !== null;
|
|
27479
|
-
var worksFor = (plan, input,
|
|
27479
|
+
var worksFor = (plan, input, branches) => {
|
|
27480
27480
|
const session = input.session.id;
|
|
27481
27481
|
if (plan.leads.includes(session) && !input.session.agentId)
|
|
27482
|
-
return
|
|
27482
|
+
return null;
|
|
27483
|
+
if (branches.some((branch) => plan.branches.includes(branch)))
|
|
27484
|
+
return "slice";
|
|
27483
27485
|
const lead = leadOf2(input);
|
|
27484
27486
|
if (lead && plan.leads.includes(lead) && workerOfLead(input))
|
|
27485
|
-
return
|
|
27486
|
-
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
|
|
27487
|
+
return "lead";
|
|
27488
|
+
return plan.leads.some((each) => session.startsWith(`${each}-w-`)) ? "lead" : null;
|
|
27489
|
+
};
|
|
27490
|
+
var agentBranches = (input, rows) => {
|
|
27491
|
+
const { id, agentId } = input.session;
|
|
27492
|
+
const bound = agentId ? rows.findLast((row) => row.type === "worktree.bound" && row.actor.session === id && row.actor.agentId === agentId && typeof row.worktree === "string")?.worktree : undefined;
|
|
27493
|
+
const dirs = typeof bound === "string" ? [input.cwd, bound] : [input.cwd];
|
|
27494
|
+
return dirs.map((dir) => currentBranch(dir)).filter((branch) => !!branch);
|
|
27490
27495
|
};
|
|
27491
27496
|
var standingFor = (input, store, rev) => {
|
|
27492
27497
|
const orders = new Map;
|
|
27493
27498
|
const ledger = readLedger(input.cwd);
|
|
27494
27499
|
const rows = ledger.ok ? ledger.value.rows : [];
|
|
27495
|
-
|
|
27496
|
-
const
|
|
27497
|
-
|
|
27498
|
-
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
|
|
27500
|
+
const branches = agentBranches(input, rows);
|
|
27501
|
+
const matched = readPlans(store).map((plan) => ({
|
|
27502
|
+
plan,
|
|
27503
|
+
how: worksFor(plan, input, branches)
|
|
27504
|
+
}));
|
|
27505
|
+
const tied = matched.some(({ how }) => how === "slice");
|
|
27506
|
+
const plans = matched.filter(({ how }) => tied ? how === "slice" : how !== null);
|
|
27507
|
+
for (const { plan } of plans)
|
|
27508
|
+
for (const row of activeStanding(rows, plan.name, plan.leads.length ? plan.leads : null))
|
|
27509
|
+
orders.set(row.id, row);
|
|
27510
|
+
return {
|
|
27511
|
+
rev,
|
|
27512
|
+
orders,
|
|
27513
|
+
rows,
|
|
27514
|
+
fanouts: new Set(plans.map(({ plan }) => plan.name))
|
|
27515
|
+
};
|
|
27502
27516
|
};
|
|
27503
27517
|
var located = (input) => {
|
|
27504
27518
|
const store = input.session.id ? gitStoreDir(input.cwd) : null;
|
|
27505
27519
|
const rev = store ? readStandingRev(store) : null;
|
|
27506
27520
|
if (!store || rev === null)
|
|
27507
27521
|
return null;
|
|
27508
|
-
return {
|
|
27522
|
+
return {
|
|
27523
|
+
store,
|
|
27524
|
+
rev,
|
|
27525
|
+
file: standingSeenFile(store, input.session.id, input.session.agentId)
|
|
27526
|
+
};
|
|
27509
27527
|
};
|
|
27510
27528
|
var seedStanding = (input) => {
|
|
27511
27529
|
try {
|
|
@@ -27513,7 +27531,10 @@ var seedStanding = (input) => {
|
|
|
27513
27531
|
if (!where)
|
|
27514
27532
|
return;
|
|
27515
27533
|
const now = standingFor(input, where.store, where.rev);
|
|
27516
|
-
writeStandingSeen(where.file, {
|
|
27534
|
+
writeStandingSeen(where.file, {
|
|
27535
|
+
rev: where.rev,
|
|
27536
|
+
ids: [...now.orders.keys()]
|
|
27537
|
+
});
|
|
27517
27538
|
} catch {}
|
|
27518
27539
|
};
|
|
27519
27540
|
var fanoutOf = (row) => typeof row.fanout === "string" ? row.fanout : "?";
|
|
@@ -27521,7 +27542,7 @@ var changedSince = (now, ids) => {
|
|
|
27521
27542
|
const known = new Set(ids);
|
|
27522
27543
|
const added = [...now.orders.values()].filter((row) => !known.has(row.id));
|
|
27523
27544
|
const byId = new Map(now.rows.map((row) => [row.id, row]));
|
|
27524
|
-
const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined);
|
|
27545
|
+
const dropped = ids.filter((id) => !now.orders.has(id)).map((id) => byId.get(id)).filter((row) => row !== undefined && now.fanouts.has(fanoutOf(row)));
|
|
27525
27546
|
if (!added.length && !dropped.length)
|
|
27526
27547
|
return null;
|
|
27527
27548
|
const fanouts = [...new Set([...added, ...dropped].map(fanoutOf))].join(", ");
|
|
@@ -27544,7 +27565,10 @@ var standingDelta = (input) => {
|
|
|
27544
27565
|
if (seen.rev === where.rev)
|
|
27545
27566
|
return null;
|
|
27546
27567
|
const now = standingFor(input, where.store, where.rev);
|
|
27547
|
-
writeStandingSeen(where.file, {
|
|
27568
|
+
writeStandingSeen(where.file, {
|
|
27569
|
+
rev: where.rev,
|
|
27570
|
+
ids: [...now.orders.keys()]
|
|
27571
|
+
});
|
|
27548
27572
|
return changedSince(now, seen.ids);
|
|
27549
27573
|
} catch {
|
|
27550
27574
|
return null;
|
package/package.json
CHANGED
|
@@ -41,7 +41,7 @@ the same check. Fix round and recheck both failed: a decider (read the `workit-f
|
|
|
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`):
|
|
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
|