@phren/cli 0.3.45 → 0.3.47

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.
Files changed (75) hide show
  1. package/dist/bridge/agent-hook-asks.d.ts +34 -0
  2. package/dist/bridge/agent-hook-asks.js +72 -0
  3. package/dist/bridge/agent-hook-callback.d.ts +22 -0
  4. package/dist/bridge/agent-hook-callback.js +114 -0
  5. package/dist/bridge/agent-hooks.d.ts +7 -74
  6. package/dist/bridge/agent-hooks.js +22 -186
  7. package/dist/bridge/claude-question-dialog.d.ts +6 -0
  8. package/dist/bridge/claude-question-dialog.js +29 -7
  9. package/dist/bridge/codex-app-server.d.ts +5 -0
  10. package/dist/bridge/codex-app-server.js +15 -0
  11. package/dist/bridge/codex-auth-refresh.d.ts +7 -0
  12. package/dist/bridge/codex-auth-refresh.js +22 -0
  13. package/dist/bridge/dispatch-command.js +7 -1
  14. package/dist/bridge/file-write.js +3 -1
  15. package/dist/bridge/git-host-auth.d.ts +6 -0
  16. package/dist/bridge/git-host-auth.js +45 -0
  17. package/dist/bridge/git-publish.d.ts +1 -1
  18. package/dist/bridge/git-publish.js +75 -8
  19. package/dist/bridge/git-review.js +23 -2
  20. package/dist/bridge/git-write-policy.d.ts +13 -0
  21. package/dist/bridge/git-write-policy.js +39 -0
  22. package/dist/bridge/git.d.ts +5 -1
  23. package/dist/bridge/git.js +103 -8
  24. package/dist/bridge/health.d.ts +1 -0
  25. package/dist/bridge/health.js +8 -5
  26. package/dist/bridge/lookup-cache.d.ts +17 -0
  27. package/dist/bridge/lookup-cache.js +70 -0
  28. package/dist/bridge/memory-store.js +40 -14
  29. package/dist/bridge/pair.js +4 -0
  30. package/dist/bridge/peers.js +36 -0
  31. package/dist/bridge/projects.d.ts +14 -0
  32. package/dist/bridge/projects.js +48 -1
  33. package/dist/bridge/prompt-deliveries.d.ts +38 -3
  34. package/dist/bridge/prompt-deliveries.js +196 -36
  35. package/dist/bridge/schedule-format.d.ts +7 -0
  36. package/dist/bridge/schedule-format.js +73 -2
  37. package/dist/bridge/schedule-problems.js +4 -0
  38. package/dist/bridge/schedule-update.d.ts +6 -0
  39. package/dist/bridge/schedule-update.js +63 -0
  40. package/dist/bridge/schedules.js +16 -4
  41. package/dist/bridge/scoped-gateway.d.ts +1 -0
  42. package/dist/bridge/scoped-gateway.js +10 -1
  43. package/dist/bridge/server-launch.js +6 -2
  44. package/dist/bridge/server-pane-routes.d.ts +4 -2
  45. package/dist/bridge/server-pane-routes.js +8 -2
  46. package/dist/bridge/server-routes.js +14 -4
  47. package/dist/bridge/session-servers.js +3 -0
  48. package/dist/bridge/{codex-thread-origin.d.ts → thread-origin.d.ts} +8 -0
  49. package/dist/bridge/{codex-thread-origin.js → thread-origin.js} +24 -6
  50. package/dist/bridge/usage.d.ts +4 -0
  51. package/dist/bridge/usage.js +22 -8
  52. package/dist/bridge-hook.mjs +1420 -553
  53. package/dist/cli/actions.js +4 -0
  54. package/dist/cli/namespaces-tasks.js +19 -5
  55. package/dist/cli/ops.d.ts +1 -1
  56. package/dist/cli/ops.js +2 -2
  57. package/dist/cli/schedules.js +16 -9
  58. package/dist/content/summarize.js +46 -6
  59. package/dist/content/validate.d.ts +3 -1
  60. package/dist/content/validate.js +33 -4
  61. package/dist/data/access.d.ts +8 -1
  62. package/dist/data/access.js +27 -9
  63. package/dist/data/notes.d.ts +2 -0
  64. package/dist/data/notes.js +2 -1
  65. package/dist/entrypoint.js +2 -1
  66. package/dist/generated/memory-ui-graph.browser.js +1 -1
  67. package/dist/governance/locks.js +17 -1
  68. package/dist/governance/policy.js +37 -23
  69. package/dist/mcp/profile.js +23 -4
  70. package/dist/memory-ui-graph.runtime.js +1 -1
  71. package/dist/modules/registry.js +2 -2
  72. package/dist/sync/conflict-resolve.d.ts +1 -1
  73. package/dist/sync/conflict-resolve.js +91 -8
  74. package/dist/task/lifecycle.js +5 -3
  75. package/package.json +1 -1
@@ -505,11 +505,6 @@ function writeJsonFileUnlocked(filePath, data) {
505
505
  fs.writeFileSync(tmpPath, JSON.stringify(data, null, 2) + "\n");
506
506
  fs.renameSync(tmpPath, filePath);
507
507
  }
508
- function writeJsonFile(filePath, data) {
509
- withFileLock(filePath, () => {
510
- writeJsonFileUnlocked(filePath, data);
511
- });
512
- }
513
508
  function getRetentionPolicyGlobal(phrenPath) {
514
509
  const parsed = readJsonFile(govFile(phrenPath, "retention-policy"), {});
515
510
  return withDefaults(parsed, DEFAULT_POLICY);
@@ -520,16 +515,21 @@ export function getRetentionPolicy(phrenPath, projectName) {
520
515
  return getRetentionPolicyGlobal(phrenPath);
521
516
  }
522
517
  export function updateRetentionPolicy(phrenPath, patch) {
523
- const current = getRetentionPolicy(phrenPath);
524
- const next = {
525
- ...current,
526
- ...patch,
527
- decay: {
528
- ...current.decay,
529
- ...(patch.decay || {}),
530
- },
531
- };
532
- writeJsonFile(govFile(phrenPath, "retention-policy"), next);
518
+ // Read and write under one lock, or a concurrent patch's fields are lost.
519
+ const file = govFile(phrenPath, "retention-policy");
520
+ const next = withFileLock(file, () => {
521
+ const current = getRetentionPolicy(phrenPath);
522
+ const merged = {
523
+ ...current,
524
+ ...patch,
525
+ decay: {
526
+ ...current.decay,
527
+ ...(patch.decay || {}),
528
+ },
529
+ };
530
+ writeJsonFileUnlocked(file, merged);
531
+ return merged;
532
+ });
533
533
  appendAuditLog(phrenPath, "update_policy", JSON.stringify(next));
534
534
  return phrenOk(next);
535
535
  }
@@ -554,7 +554,16 @@ export function getWorkflowPolicy(phrenPath, projectName) {
554
554
  return getWorkflowPolicyGlobal(phrenPath);
555
555
  }
556
556
  export function updateWorkflowPolicy(phrenPath, patch) {
557
- const current = getWorkflowPolicy(phrenPath);
557
+ const file = govFile(phrenPath, "workflow-policy");
558
+ const next = withFileLock(file, () => {
559
+ const merged = patchedWorkflowPolicy(getWorkflowPolicy(phrenPath), patch);
560
+ writeJsonFileUnlocked(file, merged);
561
+ return merged;
562
+ });
563
+ appendAuditLog(phrenPath, "update_workflow_policy", JSON.stringify(next));
564
+ return phrenOk(next);
565
+ }
566
+ function patchedWorkflowPolicy(current, patch) {
558
567
  const riskySections = Array.isArray(patch.riskySections)
559
568
  ? patch.riskySections.filter((section) => ["Review", "Stale", "Conflicts"].includes(String(section)))
560
569
  : current.riskySections;
@@ -571,9 +580,7 @@ export function updateWorkflowPolicy(phrenPath, patch) {
571
580
  taskMode,
572
581
  findingSensitivity,
573
582
  };
574
- writeJsonFile(govFile(phrenPath, "workflow-policy"), next);
575
- appendAuditLog(phrenPath, "update_workflow_policy", JSON.stringify(next));
576
- return phrenOk(next);
583
+ return next;
577
584
  }
578
585
  export function getIndexPolicy(phrenPath) {
579
586
  const parsed = readJsonFile(govFile(phrenPath, "index-policy"), {});
@@ -587,7 +594,16 @@ export function getIndexPolicy(phrenPath) {
587
594
  return merged;
588
595
  }
589
596
  export function updateIndexPolicy(phrenPath, patch) {
590
- const current = getIndexPolicy(phrenPath);
597
+ const file = govFile(phrenPath, "index-policy");
598
+ const next = withFileLock(file, () => {
599
+ const merged = patchedIndexPolicy(getIndexPolicy(phrenPath), patch);
600
+ writeJsonFileUnlocked(file, merged);
601
+ return merged;
602
+ });
603
+ appendAuditLog(phrenPath, "update_index_policy", JSON.stringify(next));
604
+ return phrenOk(next);
605
+ }
606
+ function patchedIndexPolicy(current, patch) {
591
607
  const next = {
592
608
  schemaVersion: current.schemaVersion ?? GOVERNANCE_SCHEMA_VERSION,
593
609
  includeGlobs: Array.isArray(patch.includeGlobs)
@@ -598,9 +614,7 @@ export function updateIndexPolicy(phrenPath, patch) {
598
614
  : current.excludeGlobs,
599
615
  includeHidden: patch.includeHidden ?? current.includeHidden,
600
616
  };
601
- writeJsonFile(govFile(phrenPath, "index-policy"), next);
602
- appendAuditLog(phrenPath, "update_index_policy", JSON.stringify(next));
603
- return phrenOk(next);
617
+ return next;
604
618
  }
605
619
  export function getRuntimeHealth(phrenPath) {
606
620
  const parsed = readJsonFile(runtimeHealthFile(phrenPath), {});
@@ -190,8 +190,22 @@ function firstSentence(text) {
190
190
  const s = end === -1 ? flat : flat.slice(0, end + 1);
191
191
  return s.length > 140 ? `${s.slice(0, 139)}…` : s;
192
192
  }
193
- function actionLine(action, entry) {
194
- const required = paramDocs(entry).filter((p) => p.required).map((p) => p.name);
193
+ /**
194
+ * `phren_admin` takes the action's name in `action`, so a target with its own
195
+ * `action` parameter (manage_review_item, manage_project) takes it as
196
+ * `operation` there, as owner_inbox already does.
197
+ */
198
+ const INNER_ACTION = "operation";
199
+ function hasInnerAction(entry) {
200
+ const shape = schemaOf(entry)?.shape;
201
+ return !!shape && "action" in shape && !(INNER_ACTION in shape);
202
+ }
203
+ function adminParamDocs(entry) {
204
+ const docs = paramDocs(entry);
205
+ return hasInnerAction(entry) ? docs.map((p) => p.name === "action" ? { ...p, name: INNER_ACTION } : p) : docs;
206
+ }
207
+ function actionLine(action, entry, docs = paramDocs(entry)) {
208
+ const required = docs.filter((p) => p.required).map((p) => p.name);
195
209
  const req = required.length ? ` (required: ${required.join(", ")})` : "";
196
210
  return `${action} — ${firstSentence(entry.config.description)}${req}`;
197
211
  }
@@ -297,7 +311,7 @@ export function buildCompositeTools(catalog) {
297
311
  .filter((n) => !CORE_TOOLS.includes(n) && !folded.has(n) && !(n in COMPOSITES))
298
312
  .sort();
299
313
  if (adminTargets.length) {
300
- const lines = adminTargets.map((n) => actionLine(n, catalog.get(n)));
314
+ const lines = adminTargets.map((n) => actionLine(n, catalog.get(n), adminParamDocs(catalog.get(n))));
301
315
  const actionNames = ["list_actions", ...adminTargets];
302
316
  out.push({
303
317
  name: "phren_admin",
@@ -313,10 +327,15 @@ export function buildCompositeTools(catalog) {
313
327
  if (action === "list_actions") {
314
328
  const actions = adminTargets.map((n) => {
315
329
  const entry = catalog.get(n);
316
- return { name: n, description: entry.config.description ?? "", params: paramDocs(entry) };
330
+ return { name: n, description: entry.config.description ?? "", params: adminParamDocs(entry) };
317
331
  });
318
332
  return { content: [{ type: "text", text: JSON.stringify({ ok: true, actions }, null, 2) }] };
319
333
  }
334
+ const entry = catalog.get(action);
335
+ if (entry && hasInnerAction(entry) && INNER_ACTION in rest) {
336
+ const { [INNER_ACTION]: operation, ...others } = rest;
337
+ return dispatch(catalog, action, { ...others, action: operation });
338
+ }
320
339
  return dispatch(catalog, action, rest);
321
340
  },
322
341
  });
@@ -6328,4 +6328,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
6328
6328
  ${r.map(p=>`<option value="${rt(p)}"${B.filterStore===p?" selected":""}>${rt(p)}</option>`).join("")}
6329
6329
  </select>`:"",'<div class="phren-hud-heading">Type</div>',`<div class="phren-hud-grid">${o}</div>`,a?'<div class="phren-hud-heading">Topics</div>':"",a?`<div class="phren-hud-grid">${a}</div>`:"",'<div class="phren-hud-heading">Health</div>',`<div class="phren-hud-grid">${l}</div>`,'<div class="phren-hud-heading">Node limit</div>',`<input type="number" class="phren-hud-limit" data-limit-input min="50" max="50000" value="${B.nodeLimit}" />`,"</div>","</div>",`<span class="phren-hud-counter" data-filter-counter>${B.visibleNodes.length} / ${B.rawNodes.length}</span>`,'<div class="phren-hud-results" data-search-results hidden>','<div class="phren-hud-results-head">','<span class="phren-hud-results-title" data-match-title>MATCHES</span>','<span class="phren-hud-results-nav">','<button type="button" data-match-prev aria-label="Previous match">\u25B2</button>','<span class="phren-hud-results-count" data-match-count>\u2013 / 0</span>','<button type="button" data-match-next aria-label="Next match">\u25BC</button>',"</span>","</div>",'<div class="phren-hud-results-list" data-match-list></div>',"</div>","</div>"].join(""),e&&(e.style.display="none",e.innerHTML=""),t&&(t.style.display="none",t.innerHTML="");let c=n.querySelector("[data-search-filter]");c?.addEventListener("input",()=>{B.searchQuery=c.value,uA(),B.currentMatchIndex=-1,no(),Qd(),Gp()}),c?.addEventListener("keydown",p=>{p.key==="Enter"?(lT(p.shiftKey?-1:1),p.preventDefault(),p.stopPropagation()):p.key==="Escape"&&(c.value="",B.searchQuery="",uA(),B.currentMatchIndex=-1,no(),Qd(),Gp(),c.blur(),p.stopPropagation())}),n.querySelector("[data-match-list]")?.addEventListener("click",p=>{let g=p.target?.closest("[data-match-index]");if(!g)return;let x=Number.parseInt(g.getAttribute("data-match-index")||"",10);Number.isFinite(x)&&nX(x)}),n.querySelector("[data-match-prev]")?.addEventListener("click",()=>lT(-1)),n.querySelector("[data-match-next]")?.addEventListener("click",()=>lT(1)),n.querySelectorAll("[data-filter-type-check]").forEach(p=>{p.addEventListener("change",()=>{let g=p.getAttribute("data-filter-type-check");B.filterTypes[g]=p.checked,is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})}),n.querySelectorAll("[data-filter-topic-check]").forEach(p=>{p.addEventListener("change",()=>{let g=p.getAttribute("data-filter-topic-check")||"";B.filterTopics[g]=p.checked,is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})}),n.querySelectorAll('input[name="graph-health-filter"]').forEach(p=>{p.addEventListener("change",()=>{p.checked&&(B.filterHealth=p.value,is({resetCamera:!1,emitSelection:!!B.selectedNodeId}))})});let h=n.querySelector("[data-project-filter]");h?.addEventListener("change",()=>{B.filterProject=h.value||"all",is({resetCamera:!0,emitSelection:!!B.selectedNodeId})});let d=n.querySelector("[data-store-filter]");d?.addEventListener("change",()=>{B.filterStore=d.value||"all",is({resetCamera:!0,emitSelection:!!B.selectedNodeId})});let f=n.querySelector("[data-limit-input]");f?.addEventListener("change",()=>{let p=Number.parseInt(f.value,10);Number.isFinite(p)&&(B.nodeLimit=qt(p,50,5e4),f.value=String(B.nodeLimit),is({resetCamera:!1,emitSelection:!!B.selectedNodeId}))});let A=n.querySelector("[data-filter-toggle]"),m=n.querySelector("[data-filter-panel]");if(A&&m){A.addEventListener("click",g=>{g.stopPropagation(),m.style.display=m.style.display==="block"?"none":"block"}),m.addEventListener("click",g=>g.stopPropagation());let p=()=>{m.style.display="none"};document.addEventListener("click",p),B.cleanupFns.push(()=>document.removeEventListener("click",p))}Gp()}function Qd(){let n=document.getElementById("graph-filter");if(!n)return;let e=n.querySelector("[data-filter-counter]");if(!e)return;let t=B.searchQuery.trim();if(t&&B.currentMatchIndex>=0&&B.searchResults.length){e.textContent=`${B.currentMatchIndex+1} / ${B.searchResults.length}`;return}let i=t?B.searchMatchIds.size:B.visibleNodes.length;e.textContent=`${i} / ${B.rawNodes.length}`}function cT(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function nU(n){let e=B.searchResults[n];e&&(B.currentMatchIndex=n,tr(e.id),cT()||Sd(e.id),Gp(),Qd())}function lT(n){let e=B.searchResults.length;if(!e)return;let t=B.currentMatchIndex,i=t<0?n>0?0:e-1:(t+n+e)%e;nU(i)}function nX(n){let e=B.searchResults.length;e&&nU(qt(n,0,e-1))}function iU(n){let e=B.searchResults.length;if(!e)B.currentMatchIndex=-1;else if(B.currentMatchIndex>=0){let t=n?B.searchResults.findIndex(i=>i.id===n):-1;B.currentMatchIndex=t>=0?t:Math.min(B.currentMatchIndex,e-1)}Gp(),Qd()}function Gp(){let n=document.getElementById("graph-filter");if(!n)return;let e=n.querySelector("[data-search-results]");if(!e)return;let t=B.searchResults,i=t.length;if(i===0){e.classList.remove("visible"),e.setAttribute("hidden","");return}let r=B.currentMatchIndex,s=e.querySelector("[data-match-title]"),o=e.querySelector("[data-match-count]"),a=e.querySelector("[data-match-list]");if(s&&(s.textContent=`MATCHES (${i})`),o&&(o.textContent=`${r>=0?r+1:"\u2013"} / ${i}`),a){let u=0;if(i>200){let f=r>=0?r:0;u=qt(f-Math.floor(200/2),0,i-200)}let h=Math.min(i,u+200),d=[];u>0&&d.push(`<div class="phren-hud-result-more">\u2026${u} above</div>`);for(let f=u;f<h;f++){let A=t[f],m=`${rt(A.kind)}\xB7${rt(A.project||"\u2014")}`;d.push(`<button type="button" class="phren-hud-result-row${f===r?" active":""}" data-match-index="${f}"><span class="phren-hud-result-label">${rt(A.label)}</span><span class="phren-hud-result-chip">${m}</span></button>`)}h<i&&d.push(`<div class="phren-hud-result-more">+${i-h} more\u2026</div>`),a.innerHTML=d.join("")}e.removeAttribute("hidden"),cT()?e.classList.add("visible"):requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.add("visible"))),a?.querySelector(".phren-hud-result-row.active")?.scrollIntoView({block:"nearest",behavior:cT()?"auto":"smooth"})}var Xl=null,rs=null;function rU(){B.container&&(eU(),(!Xl||!Xl.isConnected)&&(Xl=document.createElement("div"),Xl.className="phren-hud-stats",Xl.setAttribute("aria-hidden","true"),B.container.appendChild(Xl)),(!rs||!rs.isConnected)&&(rs=document.createElement("div"),rs.className="phren-hud-legend",B.container.appendChild(rs)),iX(),uT(),Gw(),Vi({data:!0}))}function iX(){if(!rs)return;let n=[{key:"project",label:"Projects",color:Pn.project},{key:"finding",label:"Findings",color:hl.general},{key:"task",label:"Tasks",color:Pn["task-active"]},{key:"entity",label:"Fragments",color:Pn.entity},{key:"reference",label:"Refs",color:Pn.reference},{key:"topic",label:"Topics",color:hl.general},{key:"note",label:"Notes",color:Pn.note}];rs.innerHTML=n.map(e=>`<span class="phren-legend-chip${B.filterTypes[e.key]?"":" off"}" data-legend-kind="${e.key}">
6330
6330
  <span class="phren-hud-dot" style="background:${e.color}"></span>${rt(e.label)}
6331
- </span>`).join(""),rs.querySelectorAll("[data-legend-kind]").forEach(e=>{e.addEventListener("click",()=>{let t=e.getAttribute("data-legend-kind");B.filterTypes[t]=!B.filterTypes[t],$2(),is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})}),rs.querySelectorAll("[data-legend-topic]").forEach(e=>{e.addEventListener("click",()=>{let t=e.getAttribute("data-legend-topic")||"";B.filterTopics[t]=B.filterTopics[t]===!1,$2(),is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})})}function $2(){let n=document.getElementById("graph-filter");n&&(n.querySelectorAll("[data-filter-type-check]").forEach(e=>{let t=e.getAttribute("data-filter-type-check");e.checked=B.filterTypes[t]}),n.querySelectorAll("[data-filter-topic-check]").forEach(e=>{let t=e.getAttribute("data-filter-topic-check")||"";e.checked=B.filterTopics[t]!==!1}))}function Jw(){rs&&(rs.querySelectorAll("[data-legend-kind]").forEach(n=>{let e=n.getAttribute("data-legend-kind");n.classList.toggle("off",!B.filterTypes[e])}),rs.querySelectorAll("[data-legend-topic]").forEach(n=>{let e=n.getAttribute("data-legend-topic")||"";n.classList.toggle("off",B.filterTopics[e]===!1)}))}function uT(){if(!Xl)return;let n=B.visibleNodes.reduce((e,t)=>e+(t.kind==="project"?1:0),0);Xl.textContent=`${B.visibleNodes.length} NODES \xB7 ${B.visibleLinks.length} LINKS \xB7 ${n} PROJECTS`}var rX={primary:"#6076a6"},sU=["#9a6bd0","#4d9a8f","#c98a4a","#5a8fd0","#cf6b9a"];function oU(n,e){return rX[n]||sU[e%sU.length]}function aU(n){let e=new Map,t=new Map,i=d=>{if(d.raw.kind!=="entity")return{store:d.raw.store||"primary",project:d.raw.project||d.raw.id};let f=B.fullAdjacency.get(d.id);if(f){let A=null;for(let m of f){let p=B.nodeById.get(m);if(p?.kind!=="project")continue;let g={store:p.store||"primary",project:p.project||p.id};if(A||(A=g),B.visibleIds.has(m))return g}if(A)return A}return{store:"primary",project:d.raw.connectedProjects?.[0]||"shared"}};for(let d of n){let{store:f,project:A}=i(d);e.has(f)||e.set(f,new Map);let m=e.get(f);m.has(A)||m.set(A,[]),d.raw.kind==="project"?t.set(`${f} ${A}`,d):m.get(A).push(d)}let r=[],s=[...e.keys()].sort((d,f)=>d==="primary"?-1:f==="primary"?1:d.localeCompare(f)),o=d=>{let f=e.get(d).size;return f<=1?0:40+Math.sqrt(f)*24},a=84,l=new Map,c=o(s[0]);l.set(s[0],new D(0,0,0));let u=c,h=-c;s.slice(1).forEach((d,f)=>{let A=o(d),m=f%2===0,p=m?u+a+A:h-a-A;m?u=p+A:h=p-A,l.set(d,new D(p,(bn(d,"sy")-.5)*44,(bn(d,"sz")-.5)*70))}),s.forEach((d,f)=>{let A=e.get(d),m=l.get(d),p=[...A.keys()].sort(),g=p.length,x=o(d),w=new D(1/0,1/0,1/0),C=new D(-1/0,-1/0,-1/0),y=Math.PI*(3-Math.sqrt(5));p.forEach((b,E)=>{let v=A.get(b),S=g<=1?0:E/(g-1),_=g<=1?0:(S*2-1)*.85,P=Math.sqrt(Math.max(0,1-_*_)),N=E*y+bn(b,"pa")*.5,Q=x*(.55+bn(b,"pr")*.6),I=new D(m.x+Math.cos(N)*P*Q,m.y+_*Q*.9,m.z+Math.sin(N)*P*Q),R=Math.max(1,v.length),U=10+Math.sqrt(R)*3.2,G=new D(1/0,1/0,1/0),$=new D(-1/0,-1/0,-1/0),J=(ie,pe=1)=>{let ot=(bn(ie.id,"x")+bn(ie.id,"x2")+bn(ie.id,"x3")-1.5)/1.5,nt=(bn(ie.id,"y")+bn(ie.id,"y2")+bn(ie.id,"y3")-1.5)/1.5,$e=(bn(ie.id,"z")+bn(ie.id,"z2")+bn(ie.id,"z3")-1.5)/1.5,ee=I.x+ot*U*pe,ue=I.y+nt*U*.85*pe,Pe=I.z+$e*U*pe;ie.x=ie.fx=ee,ie.y=ie.fy=ue,ie.z=ie.fz=Pe,G.min(new D(ee,ue,Pe)),$.max(new D(ee,ue,Pe))};v.forEach(ie=>J(ie));let te=t.get(`${d} ${b}`);te&&(te.x=te.fx=I.x,te.y=te.fy=I.y,te.z=te.fz=I.z,G.min(I),$.max(I)),Number.isFinite(G.x)||(G.copy(I).subScalar(5),$.copy(I).addScalar(5)),G.subScalar(4),$.addScalar(4),w.min(G),C.max($);let V=te?.raw.baseColor||oU(d,f);r.push({id:`project:${d}:${b}`,kind:"project",min:G.clone(),max:$.clone(),color:V,label:b,count:v.length})}),Number.isFinite(w.x)&&(w.subScalar(12),C.addScalar(12),r.push({id:`store:${d}`,kind:"store",min:w.clone(),max:C.clone(),color:oU(d,f),label:d,count:[...A.values()].reduce((b,E)=>b+E.length,0)}))});for(let d of n)d.__group?.position.set(d.x??0,d.y??0,d.z??0);return r}var Od=null,lU=null,ma=null,hT=null,cU=null,Ww=null,kp=null;function sX(){let n=document.createElement("div");n.className="graph-cinematic",n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:4;overflow:hidden;";let e=document.createElement("div");return e.className="graph-vignette",e.style.cssText="position:absolute;inset:0;background:radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);",n.appendChild(e),cU=n,n}function oX(n){try{let e=n.getContext(),t=e.getExtension("WEBGL_debug_renderer_info"),i=[t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):"",e.getParameter(e.RENDERER),e.getParameter(e.VERSION)];return/swiftshader/i.test(i.join(" "))}catch{return!1}}function aX(n){let e=B.fgNodeById.get(n.id);if(e)e.raw=n;else{e={id:n.id,raw:n};let t=600;e.x=(bn(n.id,"x")-.5)*t,e.y=(bn(n.id,"y")-.5)*t,e.z=(bn(n.id,"z")-.5)*t,B.fgNodeById.set(n.id,e)}return e}function lX(){let n=B.visibleNodes.map(aX),e=new Set(n.map(r=>r.id)),t=B.visibleLinks.filter(r=>e.has(r.source)&&e.has(r.target)).map(r=>({source:r.source,target:r.target})),i=aU(n);B.fg.graphData({nodes:n,links:t}),X2(),B.fg.scene&&(kp=B.fg.scene(),O_(kp,i,Ud())),no()}function is(n={}){let e=c_();B.visibleNodes=e.nodes,B.visibleLinks=e.links,B.visibleIds=new Set(e.nodes.map(i=>i.id)),u_();let t=B.currentMatchIndex>=0?B.searchResults[B.currentMatchIndex]?.id??null:null;if(uA(),B.fg&&lX(),Qd(),iU(t),uT(),Gw(),Vi({data:!0}),B.selectedNodeId&&!B.visibleAdjacency.has(B.selectedNodeId)?(B.selectedNodeId=null,sT()):n.emitSelection&&B.selectedNodeId&&setTimeout(()=>Ld(B.selectedNodeId),0),n.resetCamera&&B.fg){let i=B.fg,r=B.lastInteractionAt;setTimeout(()=>{B.fg===i&&!B.selectedNodeId&&!B.focusedProjectId&&B.lastInteractionAt===r&&Wl(600)},180)}}function uU(){if(!B.container||B.fg)return;B.theme=xm(),B.container.style.position="relative",M_(),B.fxOff=B.container.getAttribute("data-fx")==="off",Ww=S_();let n=new p2(B.container,{controlType:"orbit",extraRenderers:[Ww]}).backgroundColor(Sv).showNavInfo(!1).nodeId("id").nodeThreeObject(m=>K_(m)).nodeThreeObjectExtend(!1).linkColor(m=>x2(m)).linkWidth(()=>w2()).linkCurvature(.2).linkOpacity(1).linkDirectionalParticles(m=>C2(m)).linkDirectionalParticleSpeed(.006).linkDirectionalParticleWidth(1.2).linkDirectionalParticleColor(()=>aA).enableNodeDrag(!1).warmupTicks(0).cooldownTicks(0).d3AlphaDecay(1).onNodeHover(m=>W2(m)).onNodeClick((m,p)=>jw(p,m)).onLinkClick((m,p)=>jw(p,null)).onNodeRightClick((m,p)=>q2(m,p)).onNodeDragEnd(m=>{m.fx=m.x,m.fy=m.y,m.fz=m.z}).onBackgroundClick(m=>jw(m,null));B.fg=n;let e=n.renderer();e.toneMapping=Mc,e.toneMappingExposure=1.05;let t=oX(e),i=t?.5:Math.min(window.devicePixelRatio||1,1.5);e.setPixelRatio(i),n.postProcessingComposer().setPixelRatio(i),n.controls().autoRotate=!1,n.controls().autoRotateSpeed=.22;let r=n.controls(),s=()=>{aT(),j2()};r.addEventListener("start",s),r.addEventListener("end",rT),B.cleanupFns.push(()=>{r.removeEventListener("start",s),r.removeEventListener("end",rT)});let o=()=>aT();B.container.addEventListener("pointerdown",o),B.container.addEventListener("wheel",o,{passive:!0}),B.cleanupFns.push(()=>{B.container?.removeEventListener("pointerdown",o),B.container?.removeEventListener("wheel",o)});let a=n.d3Force("charge");if(a&&a.strength(0),n.d3Force("link",null),n.d3Force("center",null),!B.fxOff&&!t){let m=Ud();hT=new Md(new se(Math.max(1,m.w/2),Math.max(1,m.h/2)),.55,.5,.2),n.postProcessingComposer().addPass(hT)}n.scene().fog=new $d(Sv,6e-4),W_(n.scene()),n.cameraPosition({x:260,y:190,z:520},{x:0,y:0,z:0},0),ma=new Ti(new Jn({map:Gm(),color:new ge(aA),transparent:!0,opacity:0,blending:nn,depthWrite:!1,depthTest:!1,fog:!1})),ma.visible=!1,ma.renderOrder=998,n.scene().add(ma);let l=sX();B.container.appendChild(l),B.cleanupFns.push(()=>l.remove());let c=m=>{let p=B.container.getBoundingClientRect();B.lastMouse={x:m.clientX-p.left,y:m.clientY-p.top}};B.container.addEventListener("mousemove",c),B.cleanupFns.push(()=>B.container?.removeEventListener("mousemove",c));let u=m=>{let p=m.target,g=p?.tagName;if(!(g==="INPUT"||g==="TEXTAREA"||g==="SELECT"||p?.isContentEditable)){if(m.key==="Escape"){if(!B.selectedNodeId&&!B.focusedProjectId)return;ns();return}if((m.key==="ArrowLeft"||m.key==="ArrowRight")&&!m.altKey&&!m.ctrlKey&&!m.metaKey){let x=m.key==="ArrowRight"?1:-1;if(B.selectedNodeId){let w=wm(B.selectedNodeId,x);w&&tr(w),m.preventDefault();return}G2(x),m.preventDefault()}}};document.addEventListener("keydown",u),B.cleanupFns.push(()=>document.removeEventListener("keydown",u));let h=()=>{let m=Ud();B.fg?.width(m.w).height(m.h),Ww?.setSize(m.w,m.h),k_(m.w,m.h),Nd()};typeof ResizeObserver=="function"?(B.resizeObserver=new ResizeObserver(h),B.resizeObserver.observe(B.container)):(window.addEventListener("resize",h),B.cleanupFns.push(()=>window.removeEventListener("resize",h))),h(),n.onEngineStop(()=>{B.firstSettle&&(B.firstSettle=!1,Kw())});let d=new MutationObserver(()=>{xm()!==B.theme&&(B.theme=xm())});d.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),B.themeObserver=d;let f=0,A=m=>{if(B.ambientRafId=requestAnimationFrame(A),document.hidden){f=m;return}let p=f>0?Math.min(.05,(m-f)/1e3):.016;f=m;let g=m*.001;Od&&(Od.rotation.y+=p*.008),q_(p,g),Qv(p),Z2(m),ma&&(ma.visible=!1),E2(p)};B.ambientRafId=requestAnimationFrame(A)}function hU(){J2(),Od&&(Od.geometry.dispose(),Od.material.dispose(),Od=null),lU?.children.forEach(n=>{n.material.dispose()}),lU=null,ma&&(ma.material.dispose(),ma=null),X_(),kp&&(Yv(kp),kp=null),hT=null,cU=null,Ww=null}function cX(n){if(B.container=document.getElementById("graph-canvas"),!B.container){console.error("[phrenGraph] #graph-canvas not found");return}B.payload=n||{},B.rawNodes=(n.nodes||[]).map(a_),B.rawLinks=(n.links||[]).slice(),B.topics=(n.topics&&n.topics.length?n.topics:Array.from(new Map(B.rawNodes.filter(t=>t.kind==="finding"&&t.topicSlug).map(t=>[t.topicSlug,{slug:t.topicSlug,label:t.topicLabel||t.topicSlug}])).values())).sort((t,i)=>t.label.localeCompare(i.label)),l_(),B.nodeById=new Map,B.rawNodes.forEach(t=>B.nodeById.set(t.id,t)),Ov(),B.fgNodeById.forEach(dT),B.fgNodeById.clear(),_v(),tU(),uU(),rU();let e=!!B.fg&&B.introPlayed;B.firstSettle=!e,is({resetCamera:!e,emitSelection:!!B.selectedNodeId}),y2(),e||setTimeout(()=>{B.firstSettle&&(B.firstSettle=!1,Kw())},2600)}function dT(n){n.__dot&&n.__dot.material.dispose(),n.__core&&n.__core.material.dispose(),n.__shell&&n.__shell.material.dispose(),n.__wire&&n.__wire.material.dispose(),n.__ring&&n.__ring.material.dispose(),n.__halo&&n.__halo.material.dispose(),n.__labelObj&&__(n.id),n.__labelObj?.removeFromParent(),n.__labelEl&&n.__labelEl.remove(),n.__group=void 0,n.__dot=void 0,n.__core=void 0,n.__shell=void 0,n.__wire=void 0,n.__ring=void 0,n.__halo=void 0,n.__labelObj=void 0,n.__labelEl=void 0}function uX(n,e){let t=B.nodeById.get(n);if(!t)return!1;typeof e.section=="string"&&(t.section=e.section),typeof e.priority=="string"&&(t.priority=e.priority),typeof e.topicSlug=="string"&&(t.topicSlug=e.topicSlug),typeof e.topicLabel=="string"&&(t.topicLabel=e.topicLabel),typeof e.text=="string"&&(t.fullLabel=e.text,e.label||(t.label=e.text.slice(0,40)+(e.text.length>40?"\u2026":""))),typeof e.fullLabel=="string"&&(t.fullLabel=e.fullLabel),typeof e.label=="string"&&(t.label=e.label),t.baseColor=e.color||o_(t),t.searchText=gm(t);let i=B.hostNodes.find(s=>s.id===n);i&&Object.assign(i,{section:t.section,priority:t.priority,topicSlug:t.topicSlug,topicLabel:t.topicLabel,label:t.label,fullLabel:t.fullLabel,baseColor:t.baseColor});let r=B.fgNodeById.get(n);return r&&(j_(r),Lv(r)),Mm(),Vi({data:!0}),!0}function hX(n,e){let t=B.fgNodeById.get(n);if(!B.nodeById.has(n)&&!t)return!1;let i=B.selectedNodeId===n,r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,s=e?.animate!==!1&&!r&&!!t?.__group,o=()=>{let x=B.nodeById.get(n);if(x&&(x.kind==="finding"||x.kind==="task")&&x.project){let w=B.rawNodes.find(C=>C.kind==="project"&&(C.project||C.id)===x.project);if(w){x.kind==="finding"&&typeof w.findingCount=="number"&&w.findingCount>0&&w.findingCount--,x.kind==="task"&&typeof w.taskCount=="number"&&w.taskCount>0&&w.taskCount--;let C=B.fgNodeById.get(w.id);C&&Lv(C)}}B.rawNodes=B.rawNodes.filter(w=>w.id!==n),B.rawLinks=B.rawLinks.filter(w=>w.source!==n&&w.target!==n),B.nodeById.delete(n),B.selectedNodeId===n&&(B.selectedNodeId=null),B.hoveredNodeId===n&&(B.hoveredNodeId=null),B.focusedProjectId===n&&(B.focusedProjectId=null),t&&(dT(t),B.fgNodeById.delete(n)),xe.currentNodeId===n&&(xe.currentNodeId=null),xe.targetNodeId===n&&(xe.targetNodeId=null),_v(),is({resetCamera:!1,emitSelection:!1}),i&&a()},a=()=>{B.selectionClearCallbacks.forEach(x=>x())};if(!s||!t?.__group||!B.fg?.scene)return o(),!0;let l=B.fg.scene(),c=new D(t.x||0,t.y||0,t.z||0),u=t.__dot?.material,h=u?.map??null,d=u?u.color.clone():new ge("#ffffff"),f=t.__dot?t.__dot.scale.x:3;o();let A=new Ti(new Jn({map:h,color:d,transparent:!0,opacity:1,depthWrite:!1,blending:nn,toneMapped:!1}));A.position.copy(c),A.scale.setScalar(f),l.add(A);let m=280,p=performance.now(),g=x=>{let w=Math.min(1,(x-p)/m),C=(1-w)*(1-w)*(1-w);A.scale.setScalar(Math.max(.01,f*C)),A.material.opacity=C,w<1?requestAnimationFrame(g):(l.remove(A),A.material.dispose())};return requestAnimationFrame(g),!0}function dX(){if(YS(),b2(),B.ambientRafId&&cancelAnimationFrame(B.ambientRafId),B.ambientRafId=0,B.themeObserver?.disconnect(),B.themeObserver=null,B.resizeObserver?.disconnect(),B.resizeObserver=null,B.cleanupFns.forEach(n=>n()),B.cleanupFns=[],Ov(),B.fgNodeById.forEach(dT),B.fgNodeById.clear(),hU(),B.fg)try{B.fg._destructor?.()}catch{}B.fg=null,B.container=null,B.introPlayed=!1}Sh.graphZoom=function(e){K2(e)};Sh.graphReset=function(){ns(),Wl(500)};Sh.graphResetLayout=function(){B.fg&&(B.fgNodeById.forEach(e=>{e.fx=void 0,e.fy=void 0,e.fz=void 0}),B.firstSettle=!0,B.fg.d3ReheatSimulation())};Sh.graphClearSelection=function(){ns()};Sh.phrenGraph={__renderer:"three",mount:cX,onNodeSelect(n){B.nodeSelectCallbacks.push(n)},onSelectionClear(n){B.selectionClearCallbacks.push(n)},onRightClick(n){B.rightClickCallbacks.push(n)},onItemAction(n){B.itemActionCallbacks.push(n)},clearSelection:ns,selectNode:tr,focusNode:tr,peekNode(n){B.fgNodeById.has(n)&&(B.firstSettle=!1,B.introPlayed=!0,Ow(n))},walkTo:B2,getNodeAt:oT,screenPosFor:Yw,setSelectionViewport:V2,getNodeDetail:vr,stepDossier:wm,dossierPosition:f_,getData(){return{nodes:B.hostNodes.slice(),links:B.visibleLinks.slice(),topics:B.topics.slice(),total:B.rawNodes.length}},removeNode:hX,updateNode:uX,destroy:dX,benchLabels:n=>P_(n)};})();
6331
+ </span>`).join(""),rs.querySelectorAll("[data-legend-kind]").forEach(e=>{e.addEventListener("click",()=>{let t=e.getAttribute("data-legend-kind");B.filterTypes[t]=!B.filterTypes[t],$2(),is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})}),rs.querySelectorAll("[data-legend-topic]").forEach(e=>{e.addEventListener("click",()=>{let t=e.getAttribute("data-legend-topic")||"";B.filterTopics[t]=B.filterTopics[t]===!1,$2(),is({resetCamera:!0,emitSelection:!!B.selectedNodeId}),Jw()})})}function $2(){let n=document.getElementById("graph-filter");n&&(n.querySelectorAll("[data-filter-type-check]").forEach(e=>{let t=e.getAttribute("data-filter-type-check");e.checked=B.filterTypes[t]}),n.querySelectorAll("[data-filter-topic-check]").forEach(e=>{let t=e.getAttribute("data-filter-topic-check")||"";e.checked=B.filterTopics[t]!==!1}))}function Jw(){rs&&(rs.querySelectorAll("[data-legend-kind]").forEach(n=>{let e=n.getAttribute("data-legend-kind");n.classList.toggle("off",!B.filterTypes[e])}),rs.querySelectorAll("[data-legend-topic]").forEach(n=>{let e=n.getAttribute("data-legend-topic")||"";n.classList.toggle("off",B.filterTopics[e]===!1)}))}function uT(){if(!Xl)return;let n=B.visibleNodes.reduce((e,t)=>e+(t.kind==="project"?1:0),0);Xl.textContent=`${B.visibleNodes.length} NODES \xB7 ${B.visibleLinks.length} LINKS \xB7 ${n} PROJECTS`}var rX={primary:"#6076a6"},sU=["#9a6bd0","#4d9a8f","#c98a4a","#5a8fd0","#cf6b9a"];function oU(n,e){return rX[n]||sU[e%sU.length]}function aU(n){if(n.length===0)return[];let e=new Map,t=new Map,i=d=>{if(d.raw.kind!=="entity")return{store:d.raw.store||"primary",project:d.raw.project||d.raw.id};let f=B.fullAdjacency.get(d.id);if(f){let A=null;for(let m of f){let p=B.nodeById.get(m);if(p?.kind!=="project")continue;let g={store:p.store||"primary",project:p.project||p.id};if(A||(A=g),B.visibleIds.has(m))return g}if(A)return A}return{store:"primary",project:d.raw.connectedProjects?.[0]||"shared"}};for(let d of n){let{store:f,project:A}=i(d);e.has(f)||e.set(f,new Map);let m=e.get(f);m.has(A)||m.set(A,[]),d.raw.kind==="project"?t.set(`${f} ${A}`,d):m.get(A).push(d)}let r=[],s=[...e.keys()].sort((d,f)=>d==="primary"?-1:f==="primary"?1:d.localeCompare(f)),o=d=>{let f=e.get(d).size;return f<=1?0:40+Math.sqrt(f)*24},a=84,l=new Map,c=o(s[0]);l.set(s[0],new D(0,0,0));let u=c,h=-c;s.slice(1).forEach((d,f)=>{let A=o(d),m=f%2===0,p=m?u+a+A:h-a-A;m?u=p+A:h=p-A,l.set(d,new D(p,(bn(d,"sy")-.5)*44,(bn(d,"sz")-.5)*70))}),s.forEach((d,f)=>{let A=e.get(d),m=l.get(d),p=[...A.keys()].sort(),g=p.length,x=o(d),w=new D(1/0,1/0,1/0),C=new D(-1/0,-1/0,-1/0),y=Math.PI*(3-Math.sqrt(5));p.forEach((b,E)=>{let v=A.get(b),S=g<=1?0:E/(g-1),_=g<=1?0:(S*2-1)*.85,P=Math.sqrt(Math.max(0,1-_*_)),N=E*y+bn(b,"pa")*.5,Q=x*(.55+bn(b,"pr")*.6),I=new D(m.x+Math.cos(N)*P*Q,m.y+_*Q*.9,m.z+Math.sin(N)*P*Q),R=Math.max(1,v.length),U=10+Math.sqrt(R)*3.2,G=new D(1/0,1/0,1/0),$=new D(-1/0,-1/0,-1/0),J=(ie,pe=1)=>{let ot=(bn(ie.id,"x")+bn(ie.id,"x2")+bn(ie.id,"x3")-1.5)/1.5,nt=(bn(ie.id,"y")+bn(ie.id,"y2")+bn(ie.id,"y3")-1.5)/1.5,$e=(bn(ie.id,"z")+bn(ie.id,"z2")+bn(ie.id,"z3")-1.5)/1.5,ee=I.x+ot*U*pe,ue=I.y+nt*U*.85*pe,Pe=I.z+$e*U*pe;ie.x=ie.fx=ee,ie.y=ie.fy=ue,ie.z=ie.fz=Pe,G.min(new D(ee,ue,Pe)),$.max(new D(ee,ue,Pe))};v.forEach(ie=>J(ie));let te=t.get(`${d} ${b}`);te&&(te.x=te.fx=I.x,te.y=te.fy=I.y,te.z=te.fz=I.z,G.min(I),$.max(I)),Number.isFinite(G.x)||(G.copy(I).subScalar(5),$.copy(I).addScalar(5)),G.subScalar(4),$.addScalar(4),w.min(G),C.max($);let V=te?.raw.baseColor||oU(d,f);r.push({id:`project:${d}:${b}`,kind:"project",min:G.clone(),max:$.clone(),color:V,label:b,count:v.length})}),Number.isFinite(w.x)&&(w.subScalar(12),C.addScalar(12),r.push({id:`store:${d}`,kind:"store",min:w.clone(),max:C.clone(),color:oU(d,f),label:d,count:[...A.values()].reduce((b,E)=>b+E.length,0)}))});for(let d of n)d.__group?.position.set(d.x??0,d.y??0,d.z??0);return r}var Od=null,lU=null,ma=null,hT=null,cU=null,Ww=null,kp=null;function sX(){let n=document.createElement("div");n.className="graph-cinematic",n.setAttribute("aria-hidden","true"),n.style.cssText="position:absolute;inset:0;pointer-events:none;z-index:4;overflow:hidden;";let e=document.createElement("div");return e.className="graph-vignette",e.style.cssText="position:absolute;inset:0;background:radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0,0,0,0.55) 100%);",n.appendChild(e),cU=n,n}function oX(n){try{let e=n.getContext(),t=e.getExtension("WEBGL_debug_renderer_info"),i=[t?e.getParameter(t.UNMASKED_RENDERER_WEBGL):"",e.getParameter(e.RENDERER),e.getParameter(e.VERSION)];return/swiftshader/i.test(i.join(" "))}catch{return!1}}function aX(n){let e=B.fgNodeById.get(n.id);if(e)e.raw=n;else{e={id:n.id,raw:n};let t=600;e.x=(bn(n.id,"x")-.5)*t,e.y=(bn(n.id,"y")-.5)*t,e.z=(bn(n.id,"z")-.5)*t,B.fgNodeById.set(n.id,e)}return e}function lX(){let n=B.visibleNodes.map(aX),e=new Set(n.map(r=>r.id)),t=B.visibleLinks.filter(r=>e.has(r.source)&&e.has(r.target)).map(r=>({source:r.source,target:r.target})),i=aU(n);B.fg.graphData({nodes:n,links:t}),X2(),B.fg.scene&&(kp=B.fg.scene(),O_(kp,i,Ud())),no()}function is(n={}){let e=c_();B.visibleNodes=e.nodes,B.visibleLinks=e.links,B.visibleIds=new Set(e.nodes.map(i=>i.id)),u_();let t=B.currentMatchIndex>=0?B.searchResults[B.currentMatchIndex]?.id??null:null;if(uA(),B.fg&&lX(),Qd(),iU(t),uT(),Gw(),Vi({data:!0}),B.selectedNodeId&&!B.visibleAdjacency.has(B.selectedNodeId)?(B.selectedNodeId=null,sT()):n.emitSelection&&B.selectedNodeId&&setTimeout(()=>Ld(B.selectedNodeId),0),n.resetCamera&&B.fg){let i=B.fg,r=B.lastInteractionAt;setTimeout(()=>{B.fg===i&&!B.selectedNodeId&&!B.focusedProjectId&&B.lastInteractionAt===r&&Wl(600)},180)}}function uU(){if(!B.container||B.fg)return;B.theme=xm(),B.container.style.position="relative",M_(),B.fxOff=B.container.getAttribute("data-fx")==="off",Ww=S_();let n=new p2(B.container,{controlType:"orbit",extraRenderers:[Ww]}).backgroundColor(Sv).showNavInfo(!1).nodeId("id").nodeThreeObject(m=>K_(m)).nodeThreeObjectExtend(!1).linkColor(m=>x2(m)).linkWidth(()=>w2()).linkCurvature(.2).linkOpacity(1).linkDirectionalParticles(m=>C2(m)).linkDirectionalParticleSpeed(.006).linkDirectionalParticleWidth(1.2).linkDirectionalParticleColor(()=>aA).enableNodeDrag(!1).warmupTicks(0).cooldownTicks(0).d3AlphaDecay(1).onNodeHover(m=>W2(m)).onNodeClick((m,p)=>jw(p,m)).onLinkClick((m,p)=>jw(p,null)).onNodeRightClick((m,p)=>q2(m,p)).onNodeDragEnd(m=>{m.fx=m.x,m.fy=m.y,m.fz=m.z}).onBackgroundClick(m=>jw(m,null));B.fg=n;let e=n.renderer();e.toneMapping=Mc,e.toneMappingExposure=1.05;let t=oX(e),i=t?.5:Math.min(window.devicePixelRatio||1,1.5);e.setPixelRatio(i),n.postProcessingComposer().setPixelRatio(i),n.controls().autoRotate=!1,n.controls().autoRotateSpeed=.22;let r=n.controls(),s=()=>{aT(),j2()};r.addEventListener("start",s),r.addEventListener("end",rT),B.cleanupFns.push(()=>{r.removeEventListener("start",s),r.removeEventListener("end",rT)});let o=()=>aT();B.container.addEventListener("pointerdown",o),B.container.addEventListener("wheel",o,{passive:!0}),B.cleanupFns.push(()=>{B.container?.removeEventListener("pointerdown",o),B.container?.removeEventListener("wheel",o)});let a=n.d3Force("charge");if(a&&a.strength(0),n.d3Force("link",null),n.d3Force("center",null),!B.fxOff&&!t){let m=Ud();hT=new Md(new se(Math.max(1,m.w/2),Math.max(1,m.h/2)),.55,.5,.2),n.postProcessingComposer().addPass(hT)}n.scene().fog=new $d(Sv,6e-4),W_(n.scene()),n.cameraPosition({x:260,y:190,z:520},{x:0,y:0,z:0},0),ma=new Ti(new Jn({map:Gm(),color:new ge(aA),transparent:!0,opacity:0,blending:nn,depthWrite:!1,depthTest:!1,fog:!1})),ma.visible=!1,ma.renderOrder=998,n.scene().add(ma);let l=sX();B.container.appendChild(l),B.cleanupFns.push(()=>l.remove());let c=m=>{let p=B.container.getBoundingClientRect();B.lastMouse={x:m.clientX-p.left,y:m.clientY-p.top}};B.container.addEventListener("mousemove",c),B.cleanupFns.push(()=>B.container?.removeEventListener("mousemove",c));let u=m=>{let p=m.target,g=p?.tagName;if(!(g==="INPUT"||g==="TEXTAREA"||g==="SELECT"||p?.isContentEditable)){if(m.key==="Escape"){if(!B.selectedNodeId&&!B.focusedProjectId)return;ns();return}if((m.key==="ArrowLeft"||m.key==="ArrowRight")&&!m.altKey&&!m.ctrlKey&&!m.metaKey){let x=m.key==="ArrowRight"?1:-1;if(B.selectedNodeId){let w=wm(B.selectedNodeId,x);w&&tr(w),m.preventDefault();return}G2(x),m.preventDefault()}}};document.addEventListener("keydown",u),B.cleanupFns.push(()=>document.removeEventListener("keydown",u));let h=()=>{let m=Ud();B.fg?.width(m.w).height(m.h),Ww?.setSize(m.w,m.h),k_(m.w,m.h),Nd()};typeof ResizeObserver=="function"?(B.resizeObserver=new ResizeObserver(h),B.resizeObserver.observe(B.container)):(window.addEventListener("resize",h),B.cleanupFns.push(()=>window.removeEventListener("resize",h))),h(),n.onEngineStop(()=>{B.firstSettle&&(B.firstSettle=!1,Kw())});let d=new MutationObserver(()=>{xm()!==B.theme&&(B.theme=xm())});d.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),B.themeObserver=d;let f=0,A=m=>{if(B.ambientRafId=requestAnimationFrame(A),document.hidden){f=m;return}let p=f>0?Math.min(.05,(m-f)/1e3):.016;f=m;let g=m*.001;Od&&(Od.rotation.y+=p*.008),q_(p,g),Qv(p),Z2(m),ma&&(ma.visible=!1),E2(p)};B.ambientRafId=requestAnimationFrame(A)}function hU(){J2(),Od&&(Od.geometry.dispose(),Od.material.dispose(),Od=null),lU?.children.forEach(n=>{n.material.dispose()}),lU=null,ma&&(ma.material.dispose(),ma=null),X_(),kp&&(Yv(kp),kp=null),hT=null,cU=null,Ww=null}function cX(n){if(B.container=document.getElementById("graph-canvas"),!B.container){console.error("[phrenGraph] #graph-canvas not found");return}B.payload=n||{},B.rawNodes=(n.nodes||[]).map(a_),B.rawLinks=(n.links||[]).slice(),B.topics=(n.topics&&n.topics.length?n.topics:Array.from(new Map(B.rawNodes.filter(t=>t.kind==="finding"&&t.topicSlug).map(t=>[t.topicSlug,{slug:t.topicSlug,label:t.topicLabel||t.topicSlug}])).values())).sort((t,i)=>t.label.localeCompare(i.label)),l_(),B.nodeById=new Map,B.rawNodes.forEach(t=>B.nodeById.set(t.id,t)),Ov(),B.fgNodeById.forEach(dT),B.fgNodeById.clear(),_v(),tU(),uU(),rU();let e=!!B.fg&&B.introPlayed;B.firstSettle=!e,is({resetCamera:!e,emitSelection:!!B.selectedNodeId}),y2(),e||setTimeout(()=>{B.firstSettle&&(B.firstSettle=!1,Kw())},2600)}function dT(n){n.__dot&&n.__dot.material.dispose(),n.__core&&n.__core.material.dispose(),n.__shell&&n.__shell.material.dispose(),n.__wire&&n.__wire.material.dispose(),n.__ring&&n.__ring.material.dispose(),n.__halo&&n.__halo.material.dispose(),n.__labelObj&&__(n.id),n.__labelObj?.removeFromParent(),n.__labelEl&&n.__labelEl.remove(),n.__group=void 0,n.__dot=void 0,n.__core=void 0,n.__shell=void 0,n.__wire=void 0,n.__ring=void 0,n.__halo=void 0,n.__labelObj=void 0,n.__labelEl=void 0}function uX(n,e){let t=B.nodeById.get(n);if(!t)return!1;typeof e.section=="string"&&(t.section=e.section),typeof e.priority=="string"&&(t.priority=e.priority),typeof e.topicSlug=="string"&&(t.topicSlug=e.topicSlug),typeof e.topicLabel=="string"&&(t.topicLabel=e.topicLabel),typeof e.text=="string"&&(t.fullLabel=e.text,e.label||(t.label=e.text.slice(0,40)+(e.text.length>40?"\u2026":""))),typeof e.fullLabel=="string"&&(t.fullLabel=e.fullLabel),typeof e.label=="string"&&(t.label=e.label),t.baseColor=e.color||o_(t),t.searchText=gm(t);let i=B.hostNodes.find(s=>s.id===n);i&&Object.assign(i,{section:t.section,priority:t.priority,topicSlug:t.topicSlug,topicLabel:t.topicLabel,label:t.label,fullLabel:t.fullLabel,baseColor:t.baseColor});let r=B.fgNodeById.get(n);return r&&(j_(r),Lv(r)),Mm(),Vi({data:!0}),!0}function hX(n,e){let t=B.fgNodeById.get(n);if(!B.nodeById.has(n)&&!t)return!1;let i=B.selectedNodeId===n,r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,s=e?.animate!==!1&&!r&&!!t?.__group,o=()=>{let x=B.nodeById.get(n);if(x&&(x.kind==="finding"||x.kind==="task")&&x.project){let w=B.rawNodes.find(C=>C.kind==="project"&&(C.project||C.id)===x.project);if(w){x.kind==="finding"&&typeof w.findingCount=="number"&&w.findingCount>0&&w.findingCount--,x.kind==="task"&&typeof w.taskCount=="number"&&w.taskCount>0&&w.taskCount--;let C=B.fgNodeById.get(w.id);C&&Lv(C)}}B.rawNodes=B.rawNodes.filter(w=>w.id!==n),B.rawLinks=B.rawLinks.filter(w=>w.source!==n&&w.target!==n),B.nodeById.delete(n),B.selectedNodeId===n&&(B.selectedNodeId=null),B.hoveredNodeId===n&&(B.hoveredNodeId=null),B.focusedProjectId===n&&(B.focusedProjectId=null),t&&(dT(t),B.fgNodeById.delete(n)),xe.currentNodeId===n&&(xe.currentNodeId=null),xe.targetNodeId===n&&(xe.targetNodeId=null),_v(),is({resetCamera:!1,emitSelection:!1}),i&&a()},a=()=>{B.selectionClearCallbacks.forEach(x=>x())};if(!s||!t?.__group||!B.fg?.scene)return o(),!0;let l=B.fg.scene(),c=new D(t.x||0,t.y||0,t.z||0),u=t.__dot?.material,h=u?.map??null,d=u?u.color.clone():new ge("#ffffff"),f=t.__dot?t.__dot.scale.x:3;o();let A=new Ti(new Jn({map:h,color:d,transparent:!0,opacity:1,depthWrite:!1,blending:nn,toneMapped:!1}));A.position.copy(c),A.scale.setScalar(f),l.add(A);let m=280,p=performance.now(),g=x=>{let w=Math.min(1,(x-p)/m),C=(1-w)*(1-w)*(1-w);A.scale.setScalar(Math.max(.01,f*C)),A.material.opacity=C,w<1?requestAnimationFrame(g):(l.remove(A),A.material.dispose())};return requestAnimationFrame(g),!0}function dX(){if(YS(),b2(),B.ambientRafId&&cancelAnimationFrame(B.ambientRafId),B.ambientRafId=0,B.themeObserver?.disconnect(),B.themeObserver=null,B.resizeObserver?.disconnect(),B.resizeObserver=null,B.cleanupFns.forEach(n=>n()),B.cleanupFns=[],Ov(),B.fgNodeById.forEach(dT),B.fgNodeById.clear(),hU(),B.fg)try{B.fg._destructor?.()}catch{}B.fg=null,B.container=null,B.introPlayed=!1}Sh.graphZoom=function(e){K2(e)};Sh.graphReset=function(){ns(),Wl(500)};Sh.graphResetLayout=function(){B.fg&&(B.fgNodeById.forEach(e=>{e.fx=void 0,e.fy=void 0,e.fz=void 0}),B.firstSettle=!0,B.fg.d3ReheatSimulation())};Sh.graphClearSelection=function(){ns()};Sh.phrenGraph={__renderer:"three",mount:cX,onNodeSelect(n){B.nodeSelectCallbacks.push(n)},onSelectionClear(n){B.selectionClearCallbacks.push(n)},onRightClick(n){B.rightClickCallbacks.push(n)},onItemAction(n){B.itemActionCallbacks.push(n)},clearSelection:ns,selectNode:tr,focusNode:tr,peekNode(n){B.fgNodeById.has(n)&&(B.firstSettle=!1,B.introPlayed=!0,Ow(n))},walkTo:B2,getNodeAt:oT,screenPosFor:Yw,setSelectionViewport:V2,getNodeDetail:vr,stepDossier:wm,dossierPosition:f_,getData(){return{nodes:B.hostNodes.slice(),links:B.visibleLinks.slice(),topics:B.topics.slice(),total:B.rawNodes.length}},removeNode:hX,updateNode:uX,destroy:dX,benchLabels:n=>P_(n)};})();
@@ -123,8 +123,8 @@ export const BUILTIN_MODULES = [
123
123
  {
124
124
  schemaVersion: 1, name: "schedules", version: VERSION, defaultEnabled: false, requires: ["memory"],
125
125
  tools: [], cliCommands: ["schedule"], agentHooks: [],
126
- hookRoutes: routes("POST", ["/v1/schedules", "/v1/schedules/run", "/v1/schedules/history"]),
127
- capabilities: ["schedules", "scheduleProjects"], storeFiles: ["<project>/schedules.yaml", ".runtime/agent-fanouts/<run-id>/**"],
126
+ hookRoutes: routes("POST", ["/v1/schedules", "/v1/schedules/run", "/v1/schedules/history", "/v1/schedules/update"]),
127
+ capabilities: ["schedules", "scheduleProjects", "scheduleUpdate"], storeFiles: ["<project>/schedules.yaml", ".runtime/agent-fanouts/<run-id>/**"],
128
128
  localFiles: ["<bridge>/schedule-runs.jsonl"],
129
129
  phoneScreens: [{ screen: "SchedulesView", capability: "schedules" }], skills: [],
130
130
  },
@@ -2,7 +2,7 @@ export interface ConflictResolution {
2
2
  resolved: string[];
3
3
  unresolved: string[];
4
4
  }
5
- type Strategy = "tasks" | "findings" | "archive" | "topic" | "summary" | "union" | "theirs" | null;
5
+ type Strategy = "tasks" | "findings" | "archive" | "topic" | "summary" | "notes" | "union" | "theirs" | null;
6
6
  export declare function conflictStrategy(relFile: string): Strategy;
7
7
  /** Resolves what it can in the store's in-progress merge and stages it. */
8
8
  export declare function resolveStoreConflicts(cwd: string): ConflictResolution;
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * Resolves the content conflicts a store merge can settle without a person:
3
- * tasks.md per task id against the merge base, generated summaries from the
4
- * incoming side, and the append-only record files (findings, notes, journal,
5
- * review queue, topic archives) as a union of both sides. Everything else
6
- * stays conflicted so the caller aborts and names it.
3
+ * tasks.md per task id against the merge base, daily notes per note id
4
+ * against the base, generated summaries from the incoming side, and the
5
+ * append-only record files (findings, journal, review queue, topic archives)
6
+ * as a union of both sides. Everything else stays conflicted so the caller
7
+ * aborts and names it.
7
8
  *
8
9
  * Any file left unresolved aborts the whole merge, and every later auto-save
9
10
  * then commits locally and fails to push, so a store drifts further from its
@@ -22,6 +23,7 @@ import { nonInteractiveGitEnv } from "../utils-helpers.js";
22
23
  import { mergeFindings, mergeTask } from "../content/validate.js";
23
24
  import { cleanBlock, KNOWS_END, KNOWS_START, NOW_END, NOW_START, upsertBlock } from "../content/summarize.js";
24
25
  import { dedupeTaskIds, mergeTasksByBid } from "./task-merge.js";
26
+ import { NOTE_HEADING_RE } from "../data/notes.js";
25
27
  export function conflictStrategy(relFile) {
26
28
  const file = relFile.replace(/\\/g, "/");
27
29
  const name = path.posix.basename(file).toLowerCase();
@@ -40,7 +42,9 @@ export function conflictStrategy(relFile) {
40
42
  // Coordination state Phren rewrites itself (maintenance-writer.ts): the remote's copy holds.
41
43
  if (file === ".config/maintenance-writer.json")
42
44
  return "theirs";
43
- if (/(^|\/)(notes|journal)\/[^/]+\.md$/i.test(file))
45
+ if (/(^|\/)notes\/[^/]+\.md$/i.test(file))
46
+ return "notes";
47
+ if (/(^|\/)journal\/[^/]+\.md$/i.test(file))
44
48
  return "union";
45
49
  return null;
46
50
  }
@@ -107,6 +111,73 @@ function unionText(base, ours, theirs) {
107
111
  fs.rmSync(dir, { recursive: true, force: true });
108
112
  }
109
113
  }
114
+ const DELETED_FILE = Symbol("deleted");
115
+ /** A daily notes file split into its header and one block per note id; null when an id repeats. */
116
+ function noteBlocks(content) {
117
+ // The notes writer's own heading grammar: a note body may contain other `## ... nid:` lines.
118
+ const lines = content.split("\n");
119
+ const first = lines.findIndex((line) => NOTE_HEADING_RE.test(line));
120
+ const notes = new Map();
121
+ if (first === -1)
122
+ return { header: content.trimEnd(), notes };
123
+ let id = "";
124
+ let body = [];
125
+ const flush = () => { if (id)
126
+ notes.set(id, body.join("\n").trimEnd()); };
127
+ for (const line of lines.slice(first)) {
128
+ const m = NOTE_HEADING_RE.exec(line);
129
+ if (!m) {
130
+ body.push(line);
131
+ continue;
132
+ }
133
+ flush();
134
+ if (notes.has(m[2]))
135
+ return null;
136
+ id = m[2];
137
+ body = [line];
138
+ }
139
+ flush();
140
+ return { header: lines.slice(0, first).join("\n").trimEnd(), notes };
141
+ }
142
+ /**
143
+ * Daily notes merged per note id against the base: a note one side edited or
144
+ * removed takes that side's change, notes either side added are kept. A line
145
+ * union could put an edited note's old body back under the same id. A note
146
+ * both sides edited differently falls back to the line union. A side that
147
+ * deleted the file counts as one with the base's header and no notes, and
148
+ * DELETED_FILE comes back when no note survives that deletion.
149
+ */
150
+ function mergeNotes(base, ours, theirs) {
151
+ const b = noteBlocks(base);
152
+ if (!b)
153
+ return null;
154
+ const deleted = { header: b.header, notes: new Map() };
155
+ const [o, t] = [ours === null ? deleted : noteBlocks(ours), theirs === null ? deleted : noteBlocks(theirs)];
156
+ if (!o || !t)
157
+ return null;
158
+ const header = mergeText(b.header, o.header, t.header);
159
+ if (header === null)
160
+ return null;
161
+ const out = [];
162
+ for (const id of new Set([...o.notes.keys(), ...t.notes.keys()])) {
163
+ const [was, mine, incoming] = [b.notes.get(id), o.notes.get(id), t.notes.get(id)];
164
+ let note;
165
+ if (mine === incoming || incoming === was)
166
+ note = mine;
167
+ else if (mine === was)
168
+ note = incoming;
169
+ // Removed on one side, edited on the other: the edit is kept.
170
+ else if (mine === undefined || incoming === undefined)
171
+ note = mine ?? incoming;
172
+ else
173
+ return null;
174
+ if (note !== undefined)
175
+ out.push(note);
176
+ }
177
+ if (!out.length && (ours === null || theirs === null))
178
+ return DELETED_FILE;
179
+ return [header, ...out].join("\n\n") + "\n";
180
+ }
110
181
  /**
111
182
  * Generated blocks regenerate, so the incoming block wins; the rest of the
112
183
  * file merges with `merge`: a union of both sides by default (a topic
@@ -141,7 +212,7 @@ function resolveContent(strategy, base, ours, theirs) {
141
212
  // When a smarter merge refuses, a line union still keeps every record of
142
213
  // both sides (repeated task ids collapsed): a knowledge file never blocks a sync.
143
214
  case "tasks": return orUnion(() => mergeTasksByBid(base, ours, theirs), base, ours, theirs, dedupe);
144
- case "findings": return orUnion(() => mergeFindings(ours, theirs), base, ours, theirs);
215
+ case "findings": return orUnion(() => mergeFindings(ours, theirs, base), base, ours, theirs);
145
216
  // Archived tasks only accumulate: keep both sides, the incoming version of any duplicate.
146
217
  case "archive": return dedupe(orUnion(() => mergeTask(theirs, ours), base, ours, theirs));
147
218
  case "topic": return mergeWithGeneratedBlock(base, ours, theirs, NOW_START, NOW_END, "top");
@@ -149,6 +220,11 @@ function resolveContent(strategy, base, ours, theirs) {
149
220
  // doesn't merge cleanly, take the incoming file whole and let the next
150
221
  // summarize pass fold in anything only this machine had.
151
222
  case "summary": return mergeWithGeneratedBlock(base, ours, theirs, KNOWS_START, KNOWS_END, "bottom", mergeText) ?? theirs;
223
+ case "notes": {
224
+ // Both sides have the file here, so it is never DELETED_FILE.
225
+ const merged = mergeNotes(base, ours, theirs);
226
+ return typeof merged === "string" ? merged : unionText(base, ours, theirs);
227
+ }
152
228
  case "union": return unionText(base, ours, theirs);
153
229
  case "theirs": return theirs;
154
230
  }
@@ -180,8 +256,15 @@ export function resolveStoreConflicts(cwd) {
180
256
  unresolved.push(relFile);
181
257
  continue;
182
258
  }
183
- // Removed on one side and edited on the other: keep the edited file.
184
- const merged = ours === null ? theirs : theirs === null ? ours : resolveContent(strategy, base, ours, theirs);
259
+ // Removed on one side and edited on the other: keep the edited file,
260
+ // except daily notes, whose deletion can mean their last note was removed.
261
+ const notesMerge = strategy === "notes" && (ours === null || theirs === null) ? mergeNotes(base, ours, theirs) : null;
262
+ if (notesMerge === DELETED_FILE) {
263
+ git(cwd, ["rm", "--quiet", "--force", "--ignore-unmatch", "--", relFile]);
264
+ resolved.push(relFile);
265
+ continue;
266
+ }
267
+ const merged = notesMerge ?? (ours === null ? theirs : theirs === null ? ours : resolveContent(strategy, base, ours, theirs));
185
268
  if (merged === null) {
186
269
  unresolved.push(relFile);
187
270
  continue;
@@ -49,8 +49,9 @@ const PASTED_CONTENT_WRAPPER_RE = /<pasted_content\b[^>]*>[\s\S]*?<\/pasted_cont
49
49
  // Relays may name one sender ("From tidy-phren:") or a computer and agent
50
50
  // ("From macbook android-codex:"). Keep "From now on" as a request.
51
51
  // A two-word sender needs the colon; longer names need a parenthesized handle.
52
- // "From the settings page, add …" stays a request.
53
- const RELAYED_MESSAGE_RE = /^\s*from\s+(?:the\s+)?(?!(?:now|here|there|then|scratch|today|tomorrow)\b)(?:[\w.-]+\s*[,:]|[\w.-]+\s+[\w.-]+\s*:|[\w.-]+(?:[ \t]+[\w.-]+)*[ \t]+\([\w.-]+\)[ \t]*:)/i;
52
+ // "From the settings page, add …" stays a request. A message the conductor
53
+ // sends opens with "Conductor:" or "Conductor,".
54
+ const RELAYED_MESSAGE_RE = /^\s*(?:conductor\s*[,:]|from\s+(?:the\s+)?(?!(?:now|here|there|then|scratch|today|tomorrow)\b)(?:[\w.-]+\s*[,:]|[\w.-]+\s+[\w.-]+\s*:|[\w.-]+(?:[ \t]+[\w.-]+)*[ \t]+\([\w.-]+\)[ \t]*:))/i;
54
55
  // Dispatch returns are typed into an idle agent as ordinary prompts.
55
56
  const DISPATCH_RETURN_NOTICE_RE = /^\s*returns?:\s+[^\n]+\bCall dispatch_returns\.\s*$/i;
56
57
  // A dispatched or scheduled worker's first prompt names its brief file
@@ -224,7 +225,8 @@ function normalizeTaskSummary(prompt) {
224
225
  const stripped = withoutGithub.replace(ACTION_PREFIX_RE, "").trim();
225
226
  const withoutTaskPrefix = stripped.replace(EXPLICIT_TASK_PREFIX_RE, "").trim();
226
227
  const taskSource = withoutTaskPrefix || stripped;
227
- const firstClause = taskSource.split(/[\n.!?]/)[0]?.trim() || taskSource;
228
+ // A sentence ends at ./!/? before whitespace or the end, not inside "0.3.44" or "task-lifecycle.ts".
229
+ const firstClause = taskSource.split(/\n|[.!?](?=\s|$)/)[0]?.trim() || taskSource;
228
230
  const cleaned = firstClause
229
231
  .replace(/^to\s+/i, "")
230
232
  .replace(/\s+/g, " ")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.3.45",
3
+ "version": "0.3.47",
4
4
  "description": "Knowledge layer for AI agents - CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {