@unson/brainbase-mcp 0.50.26 → 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.
@@ -20,7 +20,7 @@
20
20
  * `graph-view-shared.css` with the screen CSS.
21
21
  */
22
22
 
23
- import { workspaceButton, workspaceNotice } from './workspace-kit.js';
23
+ import { workspaceButton, workspaceNotice, workspaceFormRow } from './workspace-kit.js';
24
24
  import {
25
25
  PROJECT_ICON_MAX_BYTES,
26
26
  PROJECT_ICON_MIME_TYPES,
@@ -196,8 +196,8 @@ const FIELD_LABELS = Object.freeze({
196
196
  });
197
197
 
198
198
  const CORRECTION_KIND_LABELS = Object.freeze({
199
- update_entity: '記録を直した',
200
- update_edge: '関係を直した',
199
+ update_entity: '記録を変更',
200
+ update_edge: '関係を変更',
201
201
  create_edge: '関係を加えた',
202
202
  create_entity: '記録を加えた',
203
203
  });
@@ -219,8 +219,8 @@ export const GRAPH_CORRECTION_FIELDS = Object.freeze({
219
219
  export const GRAPH_CORRECTION_ERROR_MESSAGES = Object.freeze({
220
220
  correction_reason_required: '理由を1文で書いてください。',
221
221
  correction_reason_invalid: '理由は改行を含まない1文(500文字まで)にしてください。',
222
- correction_no_change: '変更がありません。直したい項目を書き換えてください。',
223
- correction_digest_required: '元にした記録を確かめられません。読み直してから、もう一度直してください。',
222
+ correction_no_change: '変更がありません。変更したい項目を書き換えてください。',
223
+ correction_digest_required: '元にした記録を確かめられません。読み直してから、もう一度編集してください。',
224
224
  correction_delete_not_allowed: '記録は削除できません。終わったものは終了日で表します。',
225
225
  correction_relation_not_allowed: 'この種類の関係は、ここでは加えられません。',
226
226
  correction_relation_change_not_allowed: '関係の種類は変えられません。今の関係を終えてから、新しい関係を加えてください。',
@@ -229,12 +229,12 @@ export const GRAPH_CORRECTION_ERROR_MESSAGES = Object.freeze({
229
229
  correction_entity_type_not_allowed: 'ここで作れるのは人と会社だけです。',
230
230
  correction_name_required: '名前を書いてください。',
231
231
  entity_already_exists: '同じ名前の記録がすでにあります。今の記録を開いて確かめてください。',
232
- correction_field_not_allowed: 'この項目は、ここでは直せません。',
233
- correction_changes_required: '変更がありません。直したい項目を書き換えてください。',
234
- correction_scope_not_allowed: 'この画面では、この記録や関係は直せません。',
232
+ correction_field_not_allowed: 'この項目は、ここでは編集できません。',
233
+ correction_changes_required: '変更がありません。変更したい項目を書き換えてください。',
234
+ correction_scope_not_allowed: 'この画面では、この記録や関係は編集できません。',
235
235
  entity_not_found: '対象の記録が見つかりません。読み直してください。',
236
236
  edge_not_found: '対象の関係が見つかりません。読み直してください。',
237
- entity_id_ambiguous: '同じIDの記録が複数あるため直せません。CLIで確かめてください。',
237
+ entity_id_ambiguous: '同じIDの記録が複数あるため編集できません。CLIで確かめてください。',
238
238
  graph_not_initialized: 'Brainbaseのデータがまだありません。',
239
239
  migration_required: 'Graphの移行が必要です。ホストは自動で移行しません。',
240
240
  readback_mismatch: '保存後に読み直した内容が一致しませんでした。読み直して確かめてください。',
@@ -737,7 +737,7 @@ export function renderGraphIssues(doc, issues) {
737
737
  return workspaceNotice(doc, {
738
738
  label: '一部読めません',
739
739
  tone: 'warning',
740
- text: noticeBody(doc, makeElement(doc, 'p', { text: `出典や訂正の履歴のうち、読めない記録が${issues.length}件あります。読めた記録だけを表示しています。` }), list),
740
+ text: noticeBody(doc, makeElement(doc, 'p', { text: `出典や変更履歴のうち、読めない記録が${issues.length}件あります。読めた記録だけを表示しています。` }), list),
741
741
  });
742
742
  }
743
743
 
@@ -775,7 +775,7 @@ export function renderEvidenceAndHistory(doc, { source = null, issues = [], hist
775
775
  }
776
776
  section(
777
777
  '読めない記録',
778
- makeElement(doc, 'p', { text: `この記録の出典や訂正の履歴のうち、壊れていて読めない記録が${unreadable.length}件あります。表示している内容は読めた記録だけから作っているため、最後の訂正や出典が抜けているかもしれません。` }),
778
+ makeElement(doc, 'p', { text: `この記録の出典や変更履歴のうち、壊れていて読めない記録が${unreadable.length}件あります。表示している内容は読めた記録だけから作っているため、最後の変更や出典が抜けているかもしれません。` }),
779
779
  list,
780
780
  );
781
781
  }
@@ -784,12 +784,12 @@ export function renderEvidenceAndHistory(doc, { source = null, issues = [], hist
784
784
  for (const record of corrections) {
785
785
  const fields = Array.isArray(record.changedFields) ? record.changedFields.map((field) => FIELD_LABELS[field] ?? field).join('・') : '';
786
786
  list.append(makeElement(doc, 'li', {
787
- text: `${formatDateTime(record.at)} ${CORRECTION_KIND_LABELS[record.kind] ?? '直した'}${fields ? `(${fields})` : ''}。理由: ${String(record.reason ?? '')}`,
787
+ text: `${formatDateTime(record.at)} ${record.kind === 'update_entity' && fields ? `${fields}を変更` : `${CORRECTION_KIND_LABELS[record.kind] ?? '変更'}${fields ? `(${fields})` : ''}`}。理由: ${String(record.reason ?? '')}`,
788
788
  }));
789
789
  }
790
- section(`訂正の履歴(${corrections.length}件)`, list);
790
+ section(`変更履歴(${corrections.length}件)`, list);
791
791
  } else if (Array.isArray(history)) {
792
- section('訂正の履歴', makeElement(doc, 'p', { className: 'bb-graph-empty', text: 'この記録は、まだ訂正されていません。' }));
792
+ section('変更履歴', makeElement(doc, 'p', { className: 'bb-graph-empty', text: 'この記録は、まだ変更されていません。' }));
793
793
  }
794
794
  return details;
795
795
  }
@@ -891,16 +891,16 @@ export function renderProvenance(doc, provenance) {
891
891
  return wrap;
892
892
  }
893
893
 
894
- export function renderCorrectionHistory(doc, history) {
894
+ export function renderCorrectionHistory(doc, history, { presentation } = {}) {
895
895
  if (!Array.isArray(history) || history.length === 0) return null;
896
- const details = makeElement(doc, 'details', { className: 'bb-graph-history' });
897
- details.append(makeElement(doc, 'summary', { text: `訂正の履歴(${history.length}件)` }));
896
+ const details = makeElement(doc, presentation === 'inline' ? 'div' : 'details', { className: 'bb-graph-history' });
897
+ if (presentation !== 'inline') details.append(makeElement(doc, 'summary', { text: `変更履歴(${history.length}件)` }));
898
898
  const list = makeElement(doc, 'ol', { className: 'bb-graph-history-list' });
899
899
  for (const record of history) {
900
900
  if (!isRecord(record)) continue;
901
901
  const fields = Array.isArray(record.changedFields) ? record.changedFields.map((field) => FIELD_LABELS[field] ?? field).join('・') : '';
902
902
  list.append(makeElement(doc, 'li', {
903
- text: `${formatDateTime(record.at)} ${CORRECTION_KIND_LABELS[record.kind] ?? '直した'}${fields ? `(${fields})` : ''}。理由: ${String(record.reason ?? '')}`,
903
+ text: `${formatDateTime(record.at)} ${record.kind === 'update_entity' && fields ? `${fields}を変更` : `${CORRECTION_KIND_LABELS[record.kind] ?? '変更'}${fields ? `(${fields})` : ''}`}。理由: ${String(record.reason ?? '')}`,
904
904
  }));
905
905
  }
906
906
  details.append(list);
@@ -1106,7 +1106,7 @@ function mcpNote(payload) {
1106
1106
  return `次にMCPの ${tools.join('・')} を使うときから、この内容が使われます。`;
1107
1107
  }
1108
1108
 
1109
- function fieldControl(doc, form, field, callbacks) {
1109
+ function fieldControl(doc, form, field, callbacks, { appearance } = {}) {
1110
1110
  const definition = GRAPH_CORRECTION_FIELDS[field];
1111
1111
  const id = `${form.formId}-${field}`;
1112
1112
  const wrap = makeElement(doc, 'div', { className: 'bb-graph-field' });
@@ -1129,10 +1129,14 @@ function fieldControl(doc, form, field, callbacks) {
1129
1129
  if (form.draft[field]) {
1130
1130
  preview.append(button(doc, 'アイコンを外す', () => callbacks.onInput(field, null), { className: 'bb-ws-button is-quiet' }));
1131
1131
  }
1132
+ if (appearance === 'quiet') {
1133
+ input.hidden = true;
1134
+ preview.append(workspaceButton(doc, { text: '画像を選ぶ', size: 'compact', onClick: () => input.click?.() }));
1135
+ }
1132
1136
  wrap.append(input, preview);
1133
1137
  if (form.fieldErrors?.[field]) wrap.append(makeElement(doc, 'small', { className: 'bb-graph-field-error', text: form.fieldErrors[field], attrs: { role: 'alert' } }));
1134
1138
  if (definition.help) wrap.append(makeElement(doc, 'small', { className: 'bb-graph-help', text: definition.help }));
1135
- return wrap;
1139
+ return appearance === 'quiet' ? quietCorrectionField(doc, wrap, { id, label: definition.label, top: true }) : wrap;
1136
1140
  }
1137
1141
  const control = definition.control === 'textarea'
1138
1142
  ? makeElement(doc, 'textarea', { attrs: { id, name: field, rows: 3, maxlength: definition.max } })
@@ -1143,22 +1147,29 @@ function fieldControl(doc, form, field, callbacks) {
1143
1147
  control.addEventListener('change', update);
1144
1148
  wrap.append(control);
1145
1149
  if (definition.help) wrap.append(makeElement(doc, 'small', { className: 'bb-graph-help', text: definition.help }));
1146
- return wrap;
1150
+ return appearance === 'quiet' ? quietCorrectionField(doc, wrap, { id, label: definition.label, top: definition.control === 'textarea' || Boolean(definition.help) }) : wrap;
1147
1151
  }
1148
1152
 
1149
- function reasonControl(doc, form, callbacks) {
1153
+ function quietCorrectionField(doc, wrap, { id, label, top = false, required = false }) {
1154
+ const slot = makeElement(doc, 'div', { className: 'bb-graph-field-control' });
1155
+ for (const child of Array.from(wrap.children).slice(1)) slot.append(child);
1156
+ const row = workspaceFormRow(doc, { label, labelFor: id, control: slot, appearance: 'quiet', top, required });
1157
+ row.className += ' bb-graph-quiet-field'; return row;
1158
+ }
1159
+
1160
+ function reasonControl(doc, form, callbacks, { appearance } = {}) {
1150
1161
  const id = `${form.formId}-reason`;
1151
1162
  const wrap = makeElement(doc, 'div', { className: 'bb-graph-field is-reason' });
1152
1163
  wrap.append(makeElement(doc, 'label', { text: '理由(1文、必須)', attrs: { for: id } }));
1153
1164
  const control = makeElement(doc, 'input', {
1154
- attrs: { id, name: 'reason', type: 'text', required: true, maxlength: 500, placeholder: '例: 役割が変わったため。', 'aria-required': 'true' },
1165
+ attrs: { id, name: 'reason', type: 'text', required: true, maxlength: 500, placeholder: appearance === 'quiet' ? '1文で書いてください' : '例: 役割が変わったため。', 'aria-required': 'true' },
1155
1166
  });
1156
1167
  control.value = String(form.reason ?? '');
1157
1168
  const update = (event) => callbacks.onReason(event?.target?.value ?? control.value);
1158
1169
  control.addEventListener('input', update);
1159
1170
  control.addEventListener('change', update);
1160
- wrap.append(control, makeElement(doc, 'small', { className: 'bb-graph-help', text: '直した理由は履歴に残り、後から「いつ何を直したか」をたどれます。' }));
1161
- return wrap;
1171
+ wrap.append(control, makeElement(doc, 'small', { className: 'bb-graph-help', text: '変更の理由は履歴に残り、あとから「いつ何を変えたか」をたどれます。' }));
1172
+ return appearance === 'quiet' ? quietCorrectionField(doc, wrap, { id, label: '理由', required: true, top: true }) : wrap;
1162
1173
  }
1163
1174
 
1164
1175
  function selectControl(doc, { id, name, label, options, value, onChange, disabled = false }) {
@@ -1286,12 +1297,12 @@ function creationProjects(projects) {
1286
1297
  * The correction panel. `form` is the state held by `createGraphCorrection`;
1287
1298
  * callbacks are the controller's handlers.
1288
1299
  */
1289
- export function renderCorrectionPanel(doc, form, callbacks) {
1290
- const panel = makeElement(doc, 'section', { className: `bb-graph-correction is-${form.phase}`, attrs: { 'aria-label': form.title, tabindex: '-1' } });
1300
+ export function renderCorrectionPanel(doc, form, callbacks, { appearance, showHeading = true } = {}) {
1301
+ const panel = makeElement(doc, 'section', { className: `bb-graph-correction is-${form.phase}${appearance === 'inline' ? ' bb-graph-correction--inline bb-ws-settings-inline' : ''}`, attrs: { 'aria-label': form.title, tabindex: '-1' } });
1291
1302
  const head = makeElement(doc, 'div', { className: 'bb-graph-correction-head' });
1292
1303
  head.append(makeElement(doc, 'h3', { text: form.title }));
1293
1304
  if (form.subject) head.append(makeElement(doc, 'p', { className: 'bb-graph-lead', text: form.subject }));
1294
- panel.append(head);
1305
+ if (showHeading) panel.append(head);
1295
1306
 
1296
1307
  if (form.phase === 'saved') {
1297
1308
  const payload = form.saved;
@@ -1343,10 +1354,10 @@ export function renderCorrectionPanel(doc, form, callbacks) {
1343
1354
  formElement.append(renderCreateEntityFields(doc, form, callbacks));
1344
1355
  } else {
1345
1356
  const group = makeElement(doc, 'div', { className: 'bb-graph-fields' });
1346
- for (const field of form.fields) group.append(fieldControl(doc, form, field, callbacks));
1357
+ for (const field of form.fields) group.append(fieldControl(doc, form, field, callbacks, { appearance: appearance === 'inline' ? 'quiet' : undefined }));
1347
1358
  formElement.append(group);
1348
1359
  }
1349
- formElement.append(reasonControl(doc, form, callbacks));
1360
+ formElement.append(reasonControl(doc, form, callbacks, { appearance: appearance === 'inline' ? 'quiet' : undefined }));
1350
1361
  const actions = makeElement(doc, 'div', { className: 'bb-graph-actions' });
1351
1362
  const saving = form.phase === 'saving';
1352
1363
  const iconReadPending = form.iconReadPending === true;
@@ -1364,8 +1375,9 @@ export function renderCorrectionPanel(doc, form, callbacks) {
1364
1375
  text: submitLabel,
1365
1376
  attrs: { type: 'submit', disabled: saving || iconReadPending || iconHasError },
1366
1377
  }),
1367
- button(doc, '取り消す', callbacks.onClose, { attrs: { disabled: saving } }),
1378
+ button(doc, 'キャンセル', callbacks.onClose, { attrs: { disabled: saving } }),
1368
1379
  );
1380
+ if (appearance === 'inline') { const buttons = Array.from(actions.children); actions.replaceChildren(...buttons.reverse()); }
1369
1381
  formElement.append(actions);
1370
1382
  panel.append(formElement);
1371
1383
  return panel;
@@ -1385,12 +1397,13 @@ export function createGraphCorrection({ client, rerender, onSaved, onConflict, n
1385
1397
  let form = null;
1386
1398
  let focusPending = false;
1387
1399
  let sequence = 0;
1400
+ let revision = 0;
1388
1401
  // A file read can finish after a newer selection, removal, cancellation or
1389
1402
  // form switch. Invalidate the older read before touching the draft.
1390
1403
  let iconReadGeneration = 0;
1391
1404
  // Label/input ids stay unique when two screens are on one page.
1392
1405
  const idPrefix = `bb-graph-form-${Math.random().toString(36).slice(2, 8)}`;
1393
- const redraw = () => rerender?.();
1406
+ const redraw = () => { revision += 1; rerender?.(); };
1394
1407
 
1395
1408
  function baseForm(kind, extra) {
1396
1409
  sequence += 1;
@@ -1514,9 +1527,10 @@ export function createGraphCorrection({ client, rerender, onSaved, onConflict, n
1514
1527
 
1515
1528
  const controller = {
1516
1529
  get form() { return form; },
1530
+ get revision() { return revision; },
1517
1531
  get callbacks() { return callbacks; },
1518
1532
  /** Correct an entity. `fields` limits what the form shows. Null when the scope allows no field of it. */
1519
- openEntity(record, { fields, title = '記録を直す', subject } = {}) {
1533
+ openEntity(record, { fields, title = '記録を編集', subject } = {}) {
1520
1534
  const shown = allowed.entity(record.type) ? allowed.fields(fields ?? graphEntityCorrectionFields(record.type)) : [];
1521
1535
  if (shown.length === 0) return null;
1522
1536
  const values = graphRecordValues(record);
@@ -1544,7 +1558,7 @@ export function createGraphCorrection({ client, rerender, onSaved, onConflict, n
1544
1558
  const draft = { ...original };
1545
1559
  if (mode === 'end' && !draft.validTo) draft.validTo = localDay(now());
1546
1560
  form = baseForm('update_edge', {
1547
- title: title ?? (mode === 'role' ? '役割を直す' : mode === 'end' ? '関わりを終える' : '関係を直す'),
1561
+ title: title ?? (mode === 'role' ? '役割を編集' : mode === 'end' ? '関わりを終える' : '関係を編集'),
1548
1562
  subject: subject ?? null,
1549
1563
  targetId: edge.id,
1550
1564
  expectedDigest: edge.digest,
@@ -1673,9 +1687,9 @@ export function createGraphCorrection({ client, rerender, onSaved, onConflict, n
1673
1687
  return target;
1674
1688
  },
1675
1689
  /** The open panel, or null. */
1676
- render(doc) {
1690
+ render(doc, options) {
1677
1691
  if (!form) return null;
1678
- const panel = renderCorrectionPanel(doc, form, callbacks);
1692
+ const panel = renderCorrectionPanel(doc, form, callbacks, options);
1679
1693
  if (focusPending) {
1680
1694
  focusPending = false;
1681
1695
  const focus = () => {
@@ -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) {
@@ -1055,7 +1055,7 @@ function workspaceStatusNotice(doc, value, { label, onRetry, retryLabel = '再
1055
1055
  const body = makeElement('div', { className: 'bb-objective-notice-body' });
1056
1056
  body.append(makeElement('p', { text: `${STATUS_LABELS[status] ?? STATUS_LABELS.unknown}:${normalized.message ?? STATUS_LABELS[status] ?? '状態を確認できません。'}` }));
1057
1057
  if (status === 'conflict' && normalized.currentRevision) {
1058
- body.append(makeElement('p', { text: `現在の版: ${normalized.currentRevision}。入力は残しています。現在の版を確かめてから直してください。` }));
1058
+ body.append(makeElement('p', { text: `現在の版: ${normalized.currentRevision}。入力は残しています。現在の版を確かめてから編集してください。` }));
1059
1059
  }
1060
1060
  if (normalized.checked_at) {
1061
1061
  body.append(
@@ -1157,7 +1157,7 @@ export function renderObjectiveWorkspace(root, rail, state, callbacks = {}, page
1157
1157
  wrapper.append(workspacePageHeader(doc, {
1158
1158
  crumbs: Array.isArray(page?.crumbs) ? page.crumbs : [],
1159
1159
  title: nonEmptyText(host?.title) ?? '目的と現状',
1160
- lead: nonEmptyText(host?.lead) ?? '目指す状態と評価基準を、版つきで確かめて直します。下の「現状と見通し」は、目的とは分けた、いまの理解(観測と仮説)です。',
1160
+ lead: nonEmptyText(host?.lead) ?? '目指す状態と評価基準を、版つきで確かめて編集します。下の「現状と見通し」は、目的とは分けた、いまの理解(観測と仮説)です。',
1161
1161
  source: nonEmptyText(page?.source),
1162
1162
  actions,
1163
1163
  }));
@@ -1217,7 +1217,7 @@ function constraintContent(doc, state, callbacks) {
1217
1217
  className: 'bb-objective-note',
1218
1218
  text: callbacks.constraintsEditable === false || !callbacks.canEdit
1219
1219
  ? '制約の参照はここでは表示だけです。'
1220
- : '参照の追加と外しは「目的を直す」から行えます。',
1220
+ : '参照の追加と外しは「目的を編集」から行えます。',
1221
1221
  }));
1222
1222
  return content;
1223
1223
  }
@@ -1274,8 +1274,8 @@ function renderObjectiveDetail(doc, state, callbacks) {
1274
1274
  parts.push(workspaceRailBlock(doc, { title: '制約の参照', className: 'bb-objective-constraints-block', content: constraintContent(doc, state, callbacks) }));
1275
1275
  parts.push(workspaceRailBlock(doc, { title: '判断に使えるか', className: 'bb-objective-readiness-block', content: readinessContent(doc, state.readiness, callbacks) }));
1276
1276
  if (callbacks.canEdit) {
1277
- parts.push(makeElement('p', { className: 'objective-editor-muted bb-objective-revision-note', text: '直して保存すると同じ目的の新しい版を作ります。保存結果を読み戻して確認し、確認できない場合はその状態を表示します。' }));
1278
- parts.push(workspaceActions(doc, [{ text: '目的を直す', variant: 'primary', onClick: callbacks.onEdit }]));
1277
+ parts.push(makeElement('p', { className: 'objective-editor-muted bb-objective-revision-note', text: '編集して保存すると同じ目的の新しい版を作ります。保存結果を読み戻して確認し、確認できない場合はその状態を表示します。' }));
1278
+ parts.push(workspaceActions(doc, [{ text: '目的を編集', variant: 'primary', onClick: callbacks.onEdit }]));
1279
1279
  }
1280
1280
  return parts;
1281
1281
  }
@@ -1285,7 +1285,7 @@ function renderObjectiveFormRail(doc, state, callbacks) {
1285
1285
  const draft = state.editor.draft;
1286
1286
  const parts = [workspaceRailHead(doc, {
1287
1287
  kicker: '目的',
1288
- title: creating ? '新しい目的' : '目的を直す',
1288
+ title: creating ? '新しい目的' : '目的を編集',
1289
1289
  sub: creating ? '保存すると版1になります。' : `${draft.id}@${state.editor.expectedRevision ?? draft.revision} を元に新しい版を作ります。`,
1290
1290
  })];
1291
1291
  if (state.save.state !== 'idle' && state.save.state !== 'saving') {