@mjasnikovs/pi-task 0.29.1 → 0.29.3

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.
@@ -602,7 +602,9 @@ export function ownedRequirementsFile(cwd) {
602
602
  export async function writeOwnedRequirements(cwd, owned) {
603
603
  try {
604
604
  await fsp.mkdir(tasksDir(cwd), { recursive: true });
605
- const lines = owned.map(o => `OWNED: "${o.quote}"${o.anchor ? ` [anchor: ${o.anchor}]` : ''} [title: ${o.title.replace(/\n/g, ' ')}]`);
605
+ const lines = owned.map(o => `OWNED: "${o.quote}"${o.anchor ? ` [anchor: ${o.anchor}]` : ''}`
606
+ + (o.pending && o.pending.length > 0 ? ` [pending: ${o.pending.join(', ')}]` : '')
607
+ + ` [title: ${o.title.replace(/\n/g, ' ')}]`);
606
608
  await fsp.writeFile(ownedRequirementsFile(cwd), lines.join('\n') + '\n', 'utf8');
607
609
  }
608
610
  catch {
@@ -619,23 +621,30 @@ export async function readOwnedRequirements(cwd) {
619
621
  }
620
622
  export function parseOwnedRequirements(text) {
621
623
  const out = [];
622
- for (const m of text.matchAll(/^OWNED:\s*"([^"\n]+)"(?:\s*\[anchor:\s*([^\]]*)\])?\s*\[title:\s*([^\n]+)\]\s*$/gim)) {
624
+ for (const m of text.matchAll(/^OWNED:\s*"([^"\n]+)"(?:\s*\[anchor:\s*([^\]]*)\])?(?:\s*\[pending:\s*([^\]]*)\])?\s*\[title:\s*([^\n]+)\]\s*$/gim)) {
625
+ const pending = (m[3] ?? '')
626
+ .split(',')
627
+ .map(p => p.trim())
628
+ .filter(p => p.length > 0);
623
629
  out.push({
624
630
  quote: m[1].trim(),
625
631
  anchor: (m[2] ?? '').trim(),
626
- title: m[3].replace(/\]\s*$/, '').trim()
632
+ title: m[4].replace(/\]\s*$/, '').trim(),
633
+ ...(pending.length > 0 ? { pending } : {})
627
634
  });
628
635
  }
629
636
  return out;
630
637
  }
631
638
  /** The owned entries whose plan title matches THIS task's title (normalised
632
639
  * equality — titles travel verbatim from the plan list into task creation;
633
- * spliced repair tasks simply match nothing). */
640
+ * spliced repair tasks simply match nothing). A DETACHED entry (`pending`) is
641
+ * owned by nobody until a task claims it, so it is never returned here — its
642
+ * `title` is provenance, not ownership. */
634
643
  export function ownedForTitle(owned, title) {
635
644
  const t = normalise(title);
636
645
  if (t.length === 0)
637
646
  return [];
638
- return owned.filter(o => normalise(o.title) === t);
647
+ return owned.filter(o => normalise(o.title) === t && !(o.pending && o.pending.length > 0));
639
648
  }
640
649
  /** The injection block for a task's OWN mapped obligations. Mirrors
641
650
  * buildRequirementsBlock (the directive pattern that measurably works) but is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjasnikovs/pi-task",
3
- "version": "0.29.1",
3
+ "version": "0.29.3",
4
4
  "description": "Deterministic task planning and spec-orchestration for local models — crash-safe /task pipelines with verify/enforce gates, a real-time remote web view, and web/docs/fetch/worker subagent tools.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",