@unson/brainbase-mcp 0.50.27 → 0.50.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.27",
3
+ "version": "0.50.28",
4
4
  "description": "Local-first Brainbase judgment OS that lets supported AI agents reuse a user's approved goals, priorities, decisions, and judgment criteria.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -669,5 +669,5 @@
669
669
  "url": "https://github.com/Unson-LLC/brainbase/issues"
670
670
  },
671
671
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
672
- "gitHead": "207222270ff06f599f058734eb7ef2ee2f7d87c8"
672
+ "gitHead": "ca61b8110f03308e184c04ab06b6b839b828a0df"
673
673
  }
@@ -881,7 +881,7 @@ export function createMeetingMinutesUI({
881
881
  detailTools.replaceChildren(detailNotice);
882
882
  const native = selected && typeof selected.body === 'string' && !isRecord(selected.source_ref);
883
883
  const latest = documentRecord.current_version_id === selected?.version_id;
884
- if (!native || !latest || documentRecord.withdrawal || !canEdit()) return;
884
+ if (!native || !latest || documentRecord.withdrawal || !canEdit(detail, documentRecord)) return;
885
885
  const editing = state.editingMinutesId === documentRecord.minutes_id;
886
886
  const toggle = workspaceKit.workspaceButton(doc, {
887
887
  attrs: { 'aria-label': editing ? '編集をやめる' : '本文を編集する', title: editing ? '編集をやめる' : '本文を編集する' },
@@ -1082,15 +1082,23 @@ export function createMeetingMinutesUI({
1082
1082
  );
1083
1083
  }
1084
1084
 
1085
- function canEdit() {
1085
+ function editDecision(detail, documentRecord) {
1086
1086
  if (typeof canEditMinutes === 'function') {
1087
1087
  try {
1088
- return canEditMinutes() === true;
1088
+ const result = canEditMinutes({ meeting: detail?.meeting ?? null, document: documentRecord ?? null });
1089
+ if (isRecord(result)) {
1090
+ return { allowed: result.allowed === true, reason: result.reason };
1091
+ }
1092
+ return { allowed: result === true };
1089
1093
  } catch {
1090
- return false;
1094
+ return { allowed: false };
1091
1095
  }
1092
1096
  }
1093
- return canEditMinutes !== false;
1097
+ return { allowed: canEditMinutes !== false };
1098
+ }
1099
+
1100
+ function canEdit(detail, documentRecord) {
1101
+ return editDecision(detail, documentRecord).allowed;
1094
1102
  }
1095
1103
 
1096
1104
  function viewerId() {
@@ -1121,17 +1129,21 @@ export function createMeetingMinutesUI({
1121
1129
  line.append(node);
1122
1130
  }
1123
1131
 
1124
- // One gray notice per detail, only when something cannot be done here.
1125
- function appendReadOnlyNotice(parent, version) {
1132
+ // Keep source notices compact; each denied document still explains its own edit decision.
1133
+ function appendReadOnlyNotice(parent, version, detail, documentRecord) {
1126
1134
  const source = isRecord(version?.source_ref) ? version.source_ref : null;
1127
- const editable = canEdit();
1135
+ const decision = editDecision(detail, documentRecord);
1136
+ const editable = decision.allowed;
1137
+ const needsProject = decision.reason === 'project_selection_required';
1128
1138
  if (editable && !source) return false;
1129
1139
  const url = httpUrl(source?.locator);
1130
1140
  const provider = text(source?.provider, '元の記録');
1131
1141
  const notice = makeElement(doc, 'div', { className: 'bb-minutes-edit-guard is-info' });
1132
1142
  if (!editable) {
1133
1143
  notice.append(makeElement(doc, 'p', {
1134
- textContent: 'この画面では読むことだけができます。確認はプロジェクトの編集権限がある人が行います。',
1144
+ textContent: needsProject
1145
+ ? '確認・編集するには、プロジェクトを1つ選んでください。'
1146
+ : 'この画面では読むことだけができます。確認はプロジェクトの編集権限がある人が行います。',
1135
1147
  }));
1136
1148
  }
1137
1149
  if (url) {
@@ -1144,7 +1156,7 @@ export function createMeetingMinutesUI({
1144
1156
  notice.append(line);
1145
1157
  } else if (source) {
1146
1158
  notice.append(makeElement(doc, 'p', { textContent: '本文を直すときは、議事録を取り込んだ元で編集してください。' }));
1147
- } else {
1159
+ } else if (!needsProject) {
1148
1160
  notice.append(makeElement(doc, 'p', { textContent: '本文を直すのも、プロジェクトの編集権限がある人です。' }));
1149
1161
  }
1150
1162
  parent.append(notice);
@@ -1690,7 +1702,7 @@ export function createMeetingMinutesUI({
1690
1702
  const viewingOld = Boolean(selected && latest && selected.version_id !== latest.version_id);
1691
1703
  const withdrawal = isRecord(documentRecord.withdrawal) ? documentRecord.withdrawal : null;
1692
1704
  const native = isRecord(selected) && typeof selected.body === 'string' && !isRecord(selected.source_ref);
1693
- const editing = state.editingMinutesId === documentRecord.minutes_id && native && !viewingOld && !withdrawal && canEdit();
1705
+ const editing = state.editingMinutesId === documentRecord.minutes_id && native && !viewingOld && !withdrawal && canEdit(detail, documentRecord);
1694
1706
  const section = makeElement(doc, 'section', { className: tablePage ? 'mp-detail-section' : 'bb-minutes-document' });
1695
1707
  if (tablePage) decorateDetailTools(documentRecord, selected, versions, detail);
1696
1708
  if (withdrawal) {
@@ -1714,9 +1726,9 @@ export function createMeetingMinutesUI({
1714
1726
  const actions = makeElement(doc, 'div', { className: 'bb-minutes-version-actions' });
1715
1727
  actions.append(stateChip(selectedState, { detailed: true }));
1716
1728
  if (!withdrawal && !editing) {
1717
- if (selected && canEdit() && !isRecord(selected.confirmation) && selectedState.code !== 'unknown' && selectedState.code !== 'creating') {
1729
+ if (selected && canEdit(detail, documentRecord) && !isRecord(selected.confirmation) && selectedState.code !== 'unknown' && selectedState.code !== 'creating') {
1718
1730
  const confirm = button(doc, 'この版を確認済みにする', async () => {
1719
- if (!canEdit()) {
1731
+ if (!canEdit(detail, documentRecord)) {
1720
1732
  rerender(detail, documentRecord, selected);
1721
1733
  return;
1722
1734
  }
@@ -1737,14 +1749,14 @@ export function createMeetingMinutesUI({
1737
1749
  }, { className: 'bb-minutes-button is-primary' });
1738
1750
  actions.append(confirm);
1739
1751
  }
1740
- if (!tablePage && native && !viewingOld && canEdit()) {
1752
+ if (!tablePage && native && !viewingOld && canEdit(detail, documentRecord)) {
1741
1753
  actions.append(button(doc, '編集', () => {
1742
1754
  state.editingMinutesId = documentRecord.minutes_id;
1743
1755
  state.withdrawingMinutesId = null;
1744
1756
  rerender(detail, documentRecord, selected);
1745
1757
  }));
1746
1758
  }
1747
- if (canEdit() && mayWithdraw(documentRecord)) {
1759
+ if (canEdit(detail, documentRecord) && mayWithdraw(documentRecord)) {
1748
1760
  actions.append(button(doc, '取り下げる', () => {
1749
1761
  state.withdrawingMinutesId = documentRecord.minutes_id;
1750
1762
  state.editingMinutesId = null;
@@ -1754,13 +1766,13 @@ export function createMeetingMinutesUI({
1754
1766
  }
1755
1767
  if (tablePage) { detailDrawer.footer.replaceChildren(...actions.children); }
1756
1768
  else section.append(actions);
1757
- if (!withdrawal && canEdit() && !mayWithdraw(documentRecord)) {
1769
+ if (!withdrawal && canEdit(detail, documentRecord) && !mayWithdraw(documentRecord)) {
1758
1770
  section.append(makeElement(doc, 'p', { className: 'bb-minutes-withdraw-guard', textContent: '取り下げられるのは、この議事録を作った人だけです。' }));
1759
1771
  }
1760
- if (!withdrawal && state.withdrawingMinutesId === documentRecord.minutes_id && canEdit() && mayWithdraw(documentRecord)) {
1772
+ if (!withdrawal && state.withdrawingMinutesId === documentRecord.minutes_id && canEdit(detail, documentRecord) && mayWithdraw(documentRecord)) {
1761
1773
  section.append(renderWithdrawConfirm(detail, documentRecord, selected));
1762
1774
  }
1763
- if (!noticeState.placed && appendReadOnlyNotice(section, selected)) noticeState.placed = true;
1775
+ if ((!noticeState.placed || !canEdit(detail, documentRecord)) && appendReadOnlyNotice(section, selected, detail, documentRecord)) noticeState.placed = true;
1764
1776
  const content = makeElement(doc, 'div', { className: 'bb-minutes-version-content' });
1765
1777
  const bodyRoot = makeElement(doc, 'div', {
1766
1778
  className: 'bb-minutes-external-body-slot',
@@ -1876,7 +1888,7 @@ export function createMeetingMinutesUI({
1876
1888
  } else { row.append(save, cancel); form.append(row); }
1877
1889
  form.addEventListener('submit', async (event) => {
1878
1890
  event.preventDefault();
1879
- if (!canEdit()) {
1891
+ if (!canEdit(detail, documentRecord)) {
1880
1892
  state.editingMinutesId = null;
1881
1893
  rerender(detail, documentRecord, selected);
1882
1894
  return;
@@ -1922,7 +1934,7 @@ export function createMeetingMinutesUI({
1922
1934
  panel.append(facts);
1923
1935
  const row = makeElement(doc, 'div', { className: 'bb-minutes-actions' });
1924
1936
  const confirm = button(doc, '取り下げる', async () => {
1925
- if (!canEdit() || !mayWithdraw(documentRecord)) {
1937
+ if (!canEdit(detail, documentRecord) || !mayWithdraw(documentRecord)) {
1926
1938
  state.withdrawingMinutesId = null;
1927
1939
  rerender(detail, documentRecord, selected);
1928
1940
  return;
@@ -2035,7 +2047,7 @@ export function createMeetingMinutesUI({
2035
2047
  const noticeState = { placed: false };
2036
2048
  if (documents.length === 0) {
2037
2049
  detailPane.append(makeElement(doc, 'p', { className: 'bb-minutes-warning', textContent: '議事録文書を読み取れません。' }));
2038
- appendReadOnlyNotice(detailPane, null);
2050
+ appendReadOnlyNotice(detailPane, null, detail, null);
2039
2051
  noticeState.placed = true;
2040
2052
  }
2041
2053
  if (tablePage && documents.length > 1) {