synabun 2.4.4 → 2.4.5

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 (59) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -1
  3. package/docs/browser-extension-bridge.md +5 -4
  4. package/docs/whatsapp.md +3 -3
  5. package/mcp-server/dist/services/neural-interface.d.ts +1 -0
  6. package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
  7. package/mcp-server/dist/services/neural-interface.js +1 -0
  8. package/mcp-server/dist/services/neural-interface.js.map +1 -1
  9. package/mcp-server/dist/tools/agents.d.ts +16 -3
  10. package/mcp-server/dist/tools/agents.d.ts.map +1 -1
  11. package/mcp-server/dist/tools/agents.js +74 -11
  12. package/mcp-server/dist/tools/agents.js.map +1 -1
  13. package/mcp-server/package-lock.json +2 -2
  14. package/mcp-server/package.json +1 -1
  15. package/mcp-server/src/services/neural-interface.ts +2 -1
  16. package/mcp-server/src/tools/agents.ts +67 -11
  17. package/neural-interface/i18n/en.json +349 -9
  18. package/neural-interface/i18n/pt-BR.json +349 -9
  19. package/neural-interface/lib/agents-studio-api.js +7 -2
  20. package/neural-interface/lib/antigravity/home.js +43 -8
  21. package/neural-interface/lib/antigravity/tool-call.js +14 -0
  22. package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
  23. package/neural-interface/lib/assistant-persona.js +8 -3
  24. package/neural-interface/lib/assistant-route-gate.js +11 -2
  25. package/neural-interface/lib/assistant-runtime.js +16 -5
  26. package/neural-interface/lib/assistant-spilled-output.js +53 -0
  27. package/neural-interface/lib/browser-default.js +22 -2
  28. package/neural-interface/lib/browser-extension-bridge.js +50 -3
  29. package/neural-interface/lib/browser-extension-pin.json +7 -7
  30. package/neural-interface/lib/browser-extension-protocol.js +30 -1
  31. package/neural-interface/lib/browser-extension-setup.js +204 -36
  32. package/neural-interface/lib/remote-policy.js +24 -7
  33. package/neural-interface/lib/teams/README.md +22 -1
  34. package/neural-interface/lib/teams/api.js +79 -6
  35. package/neural-interface/lib/teams/index.js +2 -0
  36. package/neural-interface/lib/teams/recovery.js +68 -0
  37. package/neural-interface/lib/teams/scheduler.js +349 -29
  38. package/neural-interface/lib/teams/worktrees.js +123 -30
  39. package/neural-interface/package-lock.json +2 -2
  40. package/neural-interface/package.json +1 -1
  41. package/neural-interface/public/extension-setup.html +6 -2
  42. package/neural-interface/public/shared/agents/studio/ax-api.js +16 -0
  43. package/neural-interface/public/shared/agents/studio/ax-teams-view.js +318 -13
  44. package/neural-interface/public/shared/agents/studio/ax-teams.js +141 -9
  45. package/neural-interface/public/shared/browser-extension-updates.js +3 -1
  46. package/neural-interface/public/shared/extension-setup/es-page.js +23 -4
  47. package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
  48. package/neural-interface/public/shared/extension-update-view.js +1 -1
  49. package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
  50. package/neural-interface/public/shared/settings/settings-browser-extension.js +575 -197
  51. package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
  52. package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
  53. package/neural-interface/public/shared/settings/settings-ia.js +2 -2
  54. package/neural-interface/public/shared/settings/settings-shell.js +5 -0
  55. package/neural-interface/public/shared/styles.css +196 -13
  56. package/neural-interface/public/shared/ui-settings.js +48 -11
  57. package/neural-interface/server.js +20 -1
  58. package/npm-shrinkwrap.json +2 -2
  59. package/package.json +1 -1
@@ -548,16 +548,111 @@ export function createTeamWorktrees({ state, git, locks, setup: defaultSetup = n
548
548
  });
549
549
  }
550
550
 
551
+ /**
552
+ * The checks of a guarded removal, read only: every worktree is a linked worktree of its own on its branch, clean
553
+ * (nothing uncommitted, untracked files included), and every branch is merged into `target` (mergedInto), with
554
+ * `git branch -d`'s own criterion met for the ancestors it deletes. The same checks answer "could this go now"
555
+ * for a list (`onTarget`) and run again, under the repository's lock, right before anything is removed.
556
+ * → { items: [{ sliceId, path, branch, head, via }], checks: [{ name: 'clean'|'merged', ok, detail, sliceId, … }] }
557
+ */
558
+ async function guardedChecks(record, target) {
559
+ const teamId = record.teamId;
560
+ const checks = [];
561
+ const items = piecesOf(record.plan).map(sliceId => ({ sliceId, path: worktreePath(record.projectPath, teamId, sliceId), branch: sliceId === INTEGRATION_SLICE_ID ? integrationBranchName(teamId) : branchName(teamId, sliceId) }));
562
+ const registered = await listWorktrees(git, record.projectPath);
563
+ for (const item of items) {
564
+ let linked = false;
565
+ try { linked = lstatSync(join(item.path, '.git')).isFile() && !lstatSync(item.path).isSymbolicLink(); } catch {}
566
+ const valid = linked && await branchAt(git, item.path) === item.branch && registered.some(w => realOf(w.path) === realOf(item.path) && w.branch === item.branch && !w.locked) && registered.every(w => w.branch !== item.branch || realOf(w.path) === realOf(item.path));
567
+ checks.push({ name: 'clean', ok: !!valid, detail: `${item.path}: ${valid ? 'linked worktree verified' : 'not an unlocked linked worktree on its expected branch'}`, sliceId: item.sliceId, path: item.path, kind: 'worktree' });
568
+ if (valid) {
569
+ const changes = await changesOf(git, item.path);
570
+ checks.push({ name: 'clean', ok: changes !== null && changes.length === 0, detail: `${item.path}: ${changes === null ? 'status unavailable' : changes.map(c => c.path).join(', ') || 'clean'}`, sliceId: item.sliceId, path: item.path, kind: 'changes', files: (changes || []).map(c => c.path).slice(0, 50) });
571
+ }
572
+ // Merged: an ancestor of the target, or every commit beyond the base patch-equivalent to one in it
573
+ // (mergedInto). The head it checked is the one the deletion compares against.
574
+ const merged = await mergedInto(git, record.projectPath, item.branch, target, record.baseCommit);
575
+ item.head = merged.head;
576
+ item.via = merged.via;
577
+ checks.push({ name: 'merged', ok: merged.ok, detail: merged.detail, branch: item.branch, head: merged.head, via: merged.via, commits: merged.commits, sliceId: item.sliceId });
578
+ }
579
+ // branch -d checks the configured upstream, or HEAD when none exists.
580
+ // Verify that criterion too for the ancestors it deletes, so a different target checkout cannot cause
581
+ // partial removal. A patch-equivalent branch is deleted by compare-and-swap, which asks neither.
582
+ for (const item of items.filter((each) => each.via === 'ancestor')) {
583
+ const upstream = line(await git(['rev-parse', '--abbrev-ref', `${item.branch}@{upstream}`], { cwd: record.projectPath })) || 'HEAD';
584
+ const safe = (await git(['merge-base', '--is-ancestor', item.head, upstream], { cwd: record.projectPath })).ok;
585
+ checks.push({ name: 'merged', ok: safe, detail: `${item.branch}: safe branch -d against ${upstream}`, branch: item.branch, sliceId: item.sliceId });
586
+ }
587
+ return { items, checks };
588
+ }
589
+
590
+ /**
591
+ * Is everything a `ready` team joined on its base branch already: the commit SynaBun recorded as the integration
592
+ * head, and the integration branch as it is now (when somebody moved it)? Asked of git, never of the records.
593
+ * → { ok, detail, target, targetHead, head, live }
594
+ */
595
+ async function onTargetCheck(record) {
596
+ const cwd = record.projectPath;
597
+ const target = record.baseBranch;
598
+ const branch = integrationBranchName(record.teamId);
599
+ const no = (detail, extra = {}) => ({ ok: false, detail, target: target || null, ...extra });
600
+ if (!target) return no('The project was on no branch when the team was created, so there is no base branch to compare with.');
601
+ const targetHead = await commitOf(git, cwd, `refs/heads/${target}`);
602
+ if (!targetHead) return no(`The base branch ${target} is not there.`);
603
+ const head = record.integration?.head || null;
604
+ const live = await commitOf(git, cwd, `refs/heads/${branch}`);
605
+ if (!head) return no('No integration head is recorded for this team.', { targetHead });
606
+ if (!live) return no(`${branch} is not there.`, { targetHead, head });
607
+ const on = async (commit) => commit === targetHead || (await git(['merge-base', '--is-ancestor', commit, targetHead], { cwd })).ok;
608
+ if (!(await on(head))) return no(`${target} does not have the team's integration head ${head.slice(0, 12)}: it has not landed.`, { targetHead, head, live });
609
+ if (live !== head && !(await on(live))) return no(`${branch} moved to ${live.slice(0, 12)}, which ${target} does not have.`, { targetHead, head, live });
610
+ return { ok: true, detail: `${target} has ${branch} (${head.slice(0, 12)}).`, target, targetHead, head, live };
611
+ }
612
+
613
+ /**
614
+ * A `ready` code team whose joined work is on its base branch already (merged outside `land`, its worktrees and
615
+ * branches still there): where, and whether its worktrees and branches could go now with nothing lost (`clean`:
616
+ * every guarded check passes). Read only and without a lock: a list asks it. Null for any other team, and when git
617
+ * does not show the work on the base branch. Never removes anything: `remove(teamId, { guarded: true,
618
+ * mergedOutside: true })` asks it all again, under the lock, before it does.
619
+ *
620
+ * @returns {Promise<null | { branch: string, head: string, targetHead: string, live: string, moved: boolean,
621
+ * clean: boolean, dirty: { sliceId: string, path: string, files: string[] }[],
622
+ * unmerged: { sliceId: string, branch: string, commits: string[] }[], other: string[] }>}
623
+ */
624
+ async function onTarget(teamId) {
625
+ const record = await get(teamId);
626
+ if (!record || record.plan.readOnly || record.removed || record.state !== 'ready' || !isDirectory(record.projectPath)) return null;
627
+ const on = await onTargetCheck(record);
628
+ if (!on.ok) return null;
629
+ const { checks } = await guardedChecks(record, on.target);
630
+ const failed = checks.filter((check) => !check.ok);
631
+ // Uncommitted files git listed; commits the base branch lacks; anything else (a status git could not read, a
632
+ // worktree that is not where SynaBun left it, a branch that is gone) as git's own words.
633
+ const isDirty = (check) => check.kind === 'changes' && Array.isArray(check.files) && check.files.length > 0;
634
+ const isUnmerged = (check) => check.name === 'merged' && Array.isArray(check.commits) && check.commits.length > 0;
635
+ const dirty = failed.filter(isDirty).map((check) => ({ sliceId: check.sliceId, path: check.path, files: check.files }));
636
+ const unmerged = failed.filter(isUnmerged).map((check) => ({ sliceId: check.sliceId, branch: check.branch, commits: check.commits.slice(0, 20) }));
637
+ const other = failed.filter((check) => !isDirty(check) && !isUnmerged(check)).map((check) => check.detail).slice(0, 10);
638
+ return { branch: on.target, head: on.head, targetHead: on.targetHead, live: on.live, moved: on.live !== on.head, clean: failed.length === 0, dirty, unmerged, other };
639
+ }
640
+
551
641
  /**
552
642
  * Remove a team's worktrees and branches. Only after a landing, or with `discard: true`. A worktree with
553
643
  * uncommitted changes and a branch whose commits are nowhere else are kept and reported, unless `force: true`.
644
+ * `guarded: true` removes all or nothing, after every check passed (guardedChecks); with `mergedOutside: true` it
645
+ * takes a `ready` team whose work is on its base branch already, records that landing (`landed.external`) and
646
+ * removes its worktrees and branches the same way.
554
647
  *
555
648
  * @returns {Promise<{ ok: true, complete: boolean, removed: object[], kept: object[] } | { ok: false, code: string }>}
556
649
  */
557
- async function remove(teamId, { discard = false, force = false, guarded = false, checkOnly = false } = {}) {
650
+ async function remove(teamId, { discard = false, force = false, guarded = false, checkOnly = false, mergedOutside = false } = {}) {
558
651
  const record = await get(teamId);
559
652
  if (!record) return refuse('TEAM_NOT_FOUND', `No team named "${teamId}" is recorded.`);
560
653
  if (guarded && record.plan.readOnly) return refuse('TEAM_NOT_LANDED', 'Read-only teams cannot land.', { checks: [{ name: 'landed', ok: false, detail: 'Read-only team' }] });
654
+ if (mergedOutside && !guarded) return refuse('INVALID_OPTIONS', 'mergedOutside is a guarded removal.');
655
+ if (mergedOutside && (record.state !== 'ready' || record.removed)) return refuse('TEAM_NOT_READY', `Team "${teamId}" is ${record.removed ? 'removed' : record.state}: only a ready team whose work is on its base branch already is cleaned up this way.`, { state: record.state, checks: [{ name: 'on-target', ok: false, detail: `Team state: ${record.state}` }] });
561
656
  if (record.plan.readOnly) {
562
657
  const removed = [], kept = [];
563
658
  for (const slice of record.plan.slices) {
@@ -570,42 +665,40 @@ export function createTeamWorktrees({ state, git, locks, setup: defaultSetup = n
570
665
  }
571
666
  if (record.state === 'integrating' || record.state === 'landing' || record.state === 'creating') return refuse('TEAM_NEEDS_RECOVERY', `Team "${teamId}" is recorded as ${record.state}: run recover() before removing it.`, { state: record.state });
572
667
  const landed = record.state === 'merged';
573
- if (!landed && !discard && !record.plan.readOnly && !checkOnly) return refuse('TEAM_NOT_LANDED', `Team "${teamId}" has not landed: its result is on ${integrationBranchName(teamId)}. Land it first, or pass discard: true to give its work up.`, { state: record.state });
668
+ if (!landed && !discard && !record.plan.readOnly && !checkOnly && !mergedOutside) return refuse('TEAM_NOT_LANDED', `Team "${teamId}" has not landed: its result is on ${integrationBranchName(teamId)}. Land it first, or pass discard: true to give its work up.`, { state: record.state });
574
669
  if (!isDirectory(record.projectPath)) return refuse('PROJECT_NOT_FOUND', `${record.projectPath} is not a folder.`);
575
670
 
576
671
  return locks.run(repoKey(record.projectPath), async () => {
577
672
  if (guarded) {
673
+ // Merged outside `land`: what the integration branch has must be on the base branch already (asked again
674
+ // here, under the lock), and the base branch is the target every other check measures against.
675
+ // The record as it is now, under the lock: what is checked and what is recorded are the same team.
676
+ const subject = mergedOutside ? await get(teamId) : record;
677
+ if (mergedOutside && (subject?.state !== 'ready' || subject.removed)) return refuse('TEAM_NOT_READY', `Team "${teamId}" is ${subject?.removed ? 'removed' : subject?.state || 'gone'} now: nothing was removed.`, { state: subject?.state || null, checks: [{ name: 'on-target', ok: false, detail: `Team state: ${subject?.state || 'gone'}` }] });
678
+ const target = mergedOutside ? subject.baseBranch : record.landed?.targetBranch;
578
679
  const checks = [];
579
- const items = piecesOf(record.plan).map(sliceId => ({ sliceId, path: worktreePath(record.projectPath, teamId, sliceId), branch: sliceId === INTEGRATION_SLICE_ID ? integrationBranchName(teamId) : branchName(teamId, sliceId) }));
580
- const registered = await listWorktrees(git, record.projectPath);
581
- const target = record.landed?.targetBranch;
582
- for (const item of items) {
583
- let linked = false;
584
- try { linked = lstatSync(join(item.path, '.git')).isFile() && !lstatSync(item.path).isSymbolicLink(); } catch {}
585
- const valid = linked && await branchAt(git, item.path) === item.branch && registered.some(w => realOf(w.path) === realOf(item.path) && w.branch === item.branch && !w.locked) && registered.every(w => w.branch !== item.branch || realOf(w.path) === realOf(item.path));
586
- checks.push({ name: 'clean', ok: !!valid, detail: `${item.path}: ${valid ? 'linked worktree verified' : 'not an unlocked linked worktree on its expected branch'}` });
587
- if (valid) {
588
- const changes = await changesOf(git, item.path);
589
- checks.push({ name: 'clean', ok: changes !== null && changes.length === 0, detail: `${item.path}: ${changes === null ? 'status unavailable' : changes.map(c => c.path).join(', ') || 'clean'}` });
590
- }
591
- // Merged: an ancestor of the target, or every commit beyond the base patch-equivalent to one in it
592
- // (mergedInto). The head it checked is the one the deletion compares against.
593
- const merged = await mergedInto(git, record.projectPath, item.branch, target, record.baseCommit);
594
- item.head = merged.head;
595
- item.via = merged.via;
596
- checks.push({ name: 'merged', ok: merged.ok, detail: merged.detail, branch: item.branch, head: merged.head, via: merged.via, commits: merged.commits });
597
- }
598
- // branch -d checks the configured upstream, or HEAD when none exists.
599
- // Verify that criterion too for the ancestors it deletes, so a different target checkout cannot cause
600
- // partial removal. A patch-equivalent branch is deleted by compare-and-swap, which asks neither.
601
- for (const item of items.filter((each) => each.via === 'ancestor')) {
602
- const upstream = line(await git(['rev-parse', '--abbrev-ref', `${item.branch}@{upstream}`], { cwd: record.projectPath })) || 'HEAD';
603
- const safe = (await git(['merge-base', '--is-ancestor', item.head, upstream], { cwd: record.projectPath })).ok;
604
- checks.push({ name: 'merged', ok: safe, detail: `${item.branch}: safe branch -d against ${upstream}` });
680
+ if (mergedOutside) {
681
+ const on = await onTargetCheck(subject);
682
+ checks.push({ name: 'on-target', ok: on.ok, detail: on.detail });
683
+ if (!on.ok) return refuse('NOT_ON_TARGET', on.detail, { checks });
605
684
  }
685
+ const { items, checks: guardedList } = await guardedChecks(subject, target);
686
+ checks.push(...guardedList);
606
687
  const failed = checks.find(c => !c.ok);
607
688
  if (failed) return refuse(failed.name === 'merged' ? 'BRANCH_NOT_MERGED' : 'WORKTREE_DIRTY', failed.detail, { checks });
608
689
  if (checkOnly) return { ok: true, checks };
690
+ // The team's work is on its base branch: that is a landing, made by somebody else. It is written before
691
+ // anything is removed, so a stop half-way leaves a team that says where its work is.
692
+ let landedOutside = null;
693
+ if (mergedOutside) {
694
+ const tests = subject.integration.tests;
695
+ const head = subject.integration.head;
696
+ landedOutside = {
697
+ targetBranch: target, mode: null, from: null, to: head, integrationHead: head, mergeCommit: null, checkout: null,
698
+ files: null, at: now(), partial: false, tested: !!tests && tests.ok === true && tests.commit === head, external: true,
699
+ };
700
+ await state.writeTeam(teamId, 'merged', { landing: null, landed: landedOutside });
701
+ }
609
702
  // All checks precede all mutations. The branches are settled first, in one atomic ref transaction: every
610
703
  // ancestor is verified at the head that was checked, and every patch-equivalent branch is deleted only if it
611
704
  // is still at that head (`git branch -d` refuses those, and `-D` is never used). Such a branch is checked
@@ -660,7 +753,7 @@ export function createTeamWorktrees({ state, git, locks, setup: defaultSetup = n
660
753
  if (!pruned.ok) throw new Error(`Cleanup prune failed: ${gitSaid(pruned)}`);
661
754
  try { rmdirSync(join(worktreesRoot(record.projectPath), teamId)); } catch (error) { if (error.code !== 'ENOENT' && error.code !== 'ENOTEMPTY') throw error; }
662
755
  await state.writeTeam(teamId, 'merged', { removed: true, removal: { at: now(), force: false, removed, kept: [] } });
663
- return { ok: true, complete: true, removed, checks };
756
+ return { ok: true, complete: true, removed, checks, ...(landedOutside ? { landed: landedOutside } : {}) };
664
757
  }
665
758
  const registered = await listWorktrees(git, record.projectPath);
666
759
  const integration = record.plan.readOnly ? {} : await pieceInfo(record, INTEGRATION_SLICE_ID, registered);
@@ -745,7 +838,7 @@ export function createTeamWorktrees({ state, git, locks, setup: defaultSetup = n
745
838
  });
746
839
  }
747
840
 
748
- return { create, get, list, inspect, startSlice, finishReadOnlySlice, remove, prune, materialize, unmake, pieceInfo, placeOf, collisions };
841
+ return { create, get, list, inspect, onTarget, startSlice, finishReadOnlySlice, remove, prune, materialize, unmake, pieceInfo, placeOf, collisions };
749
842
  }
750
843
 
751
844
  /** A test command as it is stored: text, a list of arguments, or null. `false` for anything else. */
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "neural-memory-interface",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "neural-memory-interface",
9
- "version": "2.4.4",
9
+ "version": "2.4.5",
10
10
  "hasInstallScript": true,
11
11
  "license": "Apache-2.0",
12
12
  "dependencies": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neural-memory-interface",
3
- "version": "2.4.4",
3
+ "version": "2.4.5",
4
4
  "private": true,
5
5
  "description": "Private local SynaBun interface for memory visualization and multi-agent workflows",
6
6
  "license": "Apache-2.0",
@@ -16,8 +16,12 @@
16
16
  #es-steps > li[data-step][data-done], #es-extensions-url + #es-copy-url, #es-folder + #es-copy-folder + #es-reveal,
17
17
  #es-alternatives, #es-reload, #es-restart, #es-copied, #es-progress (the bytes of the extension's download, while
18
18
  the state is "downloading"). The ticket element is the only thing the extension's content script reads; it is
19
- filled only while the extension is on this page and the server waits for it. -->
20
- <main id="es-setup" class="es-setup" data-state="idle" data-layout="result" aria-busy="true">
19
+ filled only while the extension is on this page and the server waits for it.
20
+ Beside the Settings guide (a setup started from Settings → Browser, status `guided`) the page is its companion:
21
+ data-companion="true", one card with the live status and no steps, folder or other browsers; the steps are in
22
+ Settings, and this tab stays open only to pair the extension by itself. Opened on its own (the extension's popup,
23
+ an older flow) it is the four-step page as before. -->
24
+ <main id="es-setup" class="es-setup" data-state="idle" data-layout="result" data-companion="false" aria-busy="true">
21
25
  <div class="es-top">
22
26
  <p class="es-brand"><img src="/icon-192.png" alt="" width="32" height="32"><span>SynaBun</span></p>
23
27
  <p id="es-browser" class="es-browser" hidden><span id="es-browser-label"></span> <strong id="es-browser-name"></strong></p>
@@ -193,6 +193,22 @@ export function createAgentsApi({ fetch: fetchFn = (...args) => globalThis.fetch
193
193
  }
194
194
  },
195
195
  landTeam: async (teamId, body = {}) => send('POST', teamUrl(teamId, '/land'), { body }),
196
+ /**
197
+ * `{ force: true }` also deletes what a discard kept (the owner's word, behind its own question). `{ remove: true }`
198
+ * (capability `teams-quick-discard`): the team's record goes too, in the same step, once the discard left nothing
199
+ * → `teamRemoved`, and `removal` (why it stays) when it does not.
200
+ */
196
201
  discardTeam: async (teamId, body = {}) => send('POST', teamUrl(teamId, '/discard'), { body }),
202
+ /**
203
+ * A ready team whose work is on its base branch already: its worktrees, branches and record, once the server asked
204
+ * git again (capability `teams-on-target`) → { teamRemoved, branch, removed }. The owner's question was answered.
205
+ */
206
+ cleanupMergedTeam: async (teamId) => send('POST', teamUrl(teamId, '/cleanup-merged'), { body: { userConfirmed: true } }),
207
+ /** A landed team's worktrees and branches (capability `teams-cleanup`). The owner's question was answered: `userConfirmed`. */
208
+ cleanupTeam: async (teamId) => send('POST', teamUrl(teamId, '/cleanup'), { body: { userConfirmed: true } }),
209
+ /** A closed team's record, once nothing of it is left (capability `teams-remove`). */
210
+ removeTeam: async (teamId) => send('DELETE', teamUrl(teamId), { body: {} }),
211
+ /** Every closed team that can go → { removed: [ids], skipped: [{ teamId, code, next, … }] } (capability `teams-remove`). */
212
+ clearFinishedTeams: async () => send('POST', `${base}/teams/clear-finished`, { body: {} }),
197
213
  };
198
214
  }