@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.26",
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": "be6520308b1f4e17bdb4494a556532e89e231268"
672
+ "gitHead": "ca61b8110f03308e184c04ab06b6b839b828a0df"
673
673
  }
@@ -557,11 +557,11 @@ function objectiveActionElement(doc, record, recordContexts, callbacks, dialog)
557
557
  : null;
558
558
  if (action && typeof action.onSelect === 'function') {
559
559
  part.append(workspaceButton(doc, {
560
- text: `${action.label ?? '目的を直す・現状を記録する'} ›`,
560
+ text: `${action.label ?? '目的を編集・現状を記録する'} ›`,
561
561
  variant: 'primary',
562
562
  onClick: () => { dialog()?.close(); action.onSelect(); },
563
563
  }));
564
- part.append(makeElement(doc, 'p', { className: 'bb-fov-action-note', text: action.description ?? '目指す状態・評価基準・現状を直し、新しい版として保存します。保存すると、この一覧の「待っていること」が変わります。' }));
564
+ part.append(makeElement(doc, 'p', { className: 'bb-fov-action-note', text: action.description ?? '目指す状態・評価基準・現状を編集し、新しい版として保存します。保存すると、この一覧の「待っていること」が変わります。' }));
565
565
  } else {
566
566
  part.append(makeElement(doc, 'p', {
567
567
  className: 'bb-fov-action-note is-unavailable',
@@ -642,7 +642,7 @@ function renderObjectives(doc, catalog, viewState, callbacks, recordContexts) {
642
642
  });
643
643
  section.append(workspaceLedger(doc, { className: 'bb-fov-objective-ledger', ariaLabel: '登録された目的', columns: ['目的', '現状', '待っていること', '確認日'], rows }));
644
644
  section.append(makeElement(doc, 'p', { className: 'bb-fov-ledger-hint', text: typeof callbacks?.objectiveAction === 'function'
645
- ? '行を押すと、目的の詳細と、この目的でできること(直す・現状を記録する)が開きます。'
645
+ ? '行を押すと、目的の詳細と、この目的でできること(編集・現状を記録する)が開きます。'
646
646
  : '行を押すと、目的の詳細が開きます。この画面は読むだけです。' }));
647
647
  return section;
648
648
  }
@@ -89,3 +89,20 @@
89
89
  grid-column: 1 / -1;
90
90
  }
91
91
  }
92
+
93
+ /* Settings opt-in uses the canonical input frame, with one in-place editor. */
94
+ .bb-gp-settings { min-width:0; }
95
+ .bb-gp-settings .bb-graph-correction--inline { gap:0; margin:2px -12px 0; padding:2px 12px 12px; border:0; }
96
+ .bb-gp-settings .bb-graph-correction--inline textarea { height:72px; min-height:72px; }
97
+ .bb-gp-settings .bb-graph-correction--inline .bb-ws-form-row.is-top input[type="text"] { height:26px; }
98
+ .bb-graph-correction--inline .bb-graph-form,.bb-graph-correction--inline .bb-graph-fields { gap:0; }
99
+ .bb-graph-correction--inline .bb-graph-field-control { display:grid; min-width:0; gap:6px; }
100
+ .bb-graph-correction--inline .bb-graph-quiet-field { column-gap:0; }
101
+ .bb-graph-correction--inline .bb-graph-quiet-field .bb-graph-help { color:var(--bb-color-muted); font-size:11.5px; line-height:1.7; }
102
+ .bb-graph-correction--inline .bb-graph-actions { justify-content:flex-end; margin-top:14px; }
103
+ .bb-graph-correction--inline .bb-graph-actions .bb-ws-button { min-width:88px; height:36px; min-height:36px; padding:0 16px; border:0; border-radius:var(--bb-radius-sm); font-size:13px; font-weight:500; }
104
+ .bb-gp-settings .bb-graph-correction--inline .bb-project-icon { flex-basis:32px; width:32px; height:32px; margin-right:0; font-size:13px; }
105
+ .bb-gp-settings .bb-graph-correction--inline .bb-graph-icon-picker { margin-top:0; }
106
+ .bb-graph-correction--inline .bb-graph-actions .bb-ws-button:not(.is-primary) { background:var(--bb-color-paper); color:var(--bb-color-slate); }
107
+ .bb-gp-settings .bb-graph-history-list { display:grid; gap:10px; margin:0; padding:0; list-style:none; color:var(--bb-color-slate); font-size:12.5px; line-height:1.7; }
108
+ .bb-gp-settings .bb-graph-history-list li { margin:0; }
@@ -77,6 +77,8 @@ import {
77
77
  workspacePageHeader,
78
78
  workspaceRailBlock,
79
79
  workspaceRailHead,
80
+ workspaceInputFrame,
81
+ workspaceSettingsSection,
80
82
  } from './workspace-kit.js';
81
83
 
82
84
  export const GRAPH_PROJECTS_VIEW_CONTRACT_VERSION = 'brainbase.graph-projects-view.v2';
@@ -277,12 +279,12 @@ function normalizeProjectSummary(value) {
277
279
  * @param {boolean} [options.autoLoad=true] Reads the list on mount.
278
280
  * @param {() => Date} [options.now] The owner's clock (end-date default).
279
281
  * @param {boolean} [options.canCorrect=true] When false, no correction control is drawn anywhere
280
- * (関係者を加える, 役割を直す, 関わりを終える / 終了日を直す, プロジェクトを直す, and the pointer to
282
+ * (関係者を加える, 役割を編集, 関わりを終える / 終了日を編集, プロジェクトを編集, and the pointer to
281
283
  * corrections under そのほかの関係), and the client refuses every correction before sending it.
282
284
  * @param {{ entityTypes?: string[], fields?: string[], edges?: boolean, createEdges?: boolean }} [options.correctionScope]
283
285
  * With corrections allowed, only these (see `graphCorrectionScope`): `entityTypes: ['project']` keeps
284
- * プロジェクトを直す, `fields` limits its form, `edges: false` withholds 役割を直す and 関わりを終える /
285
- * 終了日を直す, and `createEdges: false` withholds 関係者を加える. A withheld control is not drawn and the
286
+ * プロジェクトを編集, `fields` limits its form, `edges: false` withholds 役割を編集 and 関わりを終える /
287
+ * 終了日を編集, and `createEdges: false` withholds 関係者を加える. A withheld control is not drawn and the
286
288
  * client refuses such a correction before sending it. Without it every correction is allowed.
287
289
  * @param {string | ((record: { id: string, type: string | null, metadata: object } | null) => string | Element | null)} [options.readOnlyNote]
288
290
  * With `canCorrect: false`, or where `correctionScope` withholds a
@@ -326,6 +328,9 @@ function normalizeProjectSummary(value) {
326
328
  * Host-injected Sigma.js graph mount. When omitted, the shared browser
327
329
  * entry is used. The workspace keeps an accessible relation list when
328
330
  * mounting is unavailable or fails.
331
+ * @param {'tabs'} [options.detailPresentation] Opt-in compact detail; the host owns its title.
332
+ * @param {object} [options.projectWorkspace] Optional hostTabs, renderTabTools, overview slots,
333
+ * and onTabChange for the shared project workspace. Read/correction clients remain owned here.
329
334
  * @returns The controller: `state`, `correction`, `render()`, `load()`, `loadDetail(id)`,
330
335
  * `selectProject(id)`, `openProject(id)`, `select(id)` for the host's own navigation, and with
331
336
  * `ownShare` `loadOwn()` and `selectOwnProject(id)`.
@@ -356,6 +361,9 @@ export function createGraphProjectsView({
356
361
  loadProjectContext,
357
362
  projectSummaries,
358
363
  mountProjectGraph,
364
+ detailPresentation,
365
+ projectWorkspace = {},
366
+ settings,
359
367
  } = {}) {
360
368
  if (!root) throw new TypeError('root is required');
361
369
  const doc = getDocument(explicitDocument);
@@ -388,6 +396,17 @@ export function createGraphProjectsView({
388
396
  };
389
397
  let focusRow = null;
390
398
  let knowledgeWorkspace = null;
399
+ let knowledgeDetailPayload = null;
400
+ let retainedWorkspaceState = null;
401
+ let settingsFrame = null;
402
+ let settingsPreview = null;
403
+ let settingsOpen = false;
404
+ let settingsProjectId = null;
405
+ let settingsOpener = null;
406
+ let settingsRenderedPayload = null;
407
+ let settingsRenderedRevision = -1;
408
+ const settingsSlots = new Map();
409
+ let settingsSlotProjectId = null;
391
410
  let contextRequest = 0;
392
411
  let detailRequest = 0;
393
412
  let hostListRequest = 0;
@@ -396,6 +415,31 @@ export function createGraphProjectsView({
396
415
  let initialSelectionGate = null;
397
416
  let viewDestroyed = false;
398
417
 
418
+ // The retained tabbed workspace can still be detached by the outer layout.
419
+ // Preserve only its current focus; an intentionally focused host tool wins.
420
+ function workspaceFocusSnapshot() {
421
+ const element = doc.activeElement;
422
+ let ancestor = element;
423
+ while (ancestor && ancestor !== knowledgeWorkspace?.element) ancestor = ancestor.parentNode;
424
+ if (!ancestor) return null;
425
+ const scroll = [];
426
+ for (let node = element; node; node = node.parentNode) {
427
+ if (typeof node.scrollTop === 'number') scroll.push({ node, top: node.scrollTop, left: node.scrollLeft });
428
+ }
429
+ return { element, start: element.selectionStart, end: element.selectionEnd, direction: element.selectionDirection, scroll };
430
+ }
431
+
432
+ function restoreWorkspaceFocus(snapshot) {
433
+ if (!snapshot || snapshot.element.isConnected === false) return;
434
+ snapshot.element.focus?.({ preventScroll: true });
435
+ if (typeof snapshot.start === 'number') snapshot.element.setSelectionRange?.(snapshot.start, snapshot.end, snapshot.direction);
436
+ for (const { node, top, left } of snapshot.scroll) {
437
+ if (node.isConnected === false) continue;
438
+ node.scrollTop = top;
439
+ if (typeof left === 'number') node.scrollLeft = left;
440
+ }
441
+ }
442
+
399
443
  const correction = createGraphCorrection({
400
444
  client,
401
445
  now,
@@ -456,13 +500,13 @@ export function createGraphProjectsView({
456
500
  'data-project-id': target,
457
501
  },
458
502
  });
459
- loading.append(makeElement(doc, 'div', { className: 'bb-pkw-kicker', text: 'プロジェクトの記録' }));
503
+ if (detailPresentation !== 'tabs') loading.append(makeElement(doc, 'div', { className: 'bb-pkw-kicker', text: 'プロジェクトの記録' }));
460
504
  const header = makeElement(doc, 'header', { className: 'bb-pkw-header' });
461
505
  header.append(
462
506
  makeElement(doc, 'h2', { text: project.name }),
463
507
  makeElement(doc, 'p', { className: 'bb-pkw-lead', text: '目的・関係・判断の根拠を、実際に記録された情報からたどれます。' }),
464
508
  );
465
- loading.append(header);
509
+ if (detailPresentation !== 'tabs') loading.append(header);
466
510
  const notice = graphStateNotice(doc, readState, {
467
511
  onRetry,
468
512
  loadingText: 'プロジェクトの記録を読み込んでいます。',
@@ -616,7 +660,7 @@ export function createGraphProjectsView({
616
660
  const pageHeader = workspacePageHeader(doc, {
617
661
  crumbs: context.crumbs,
618
662
  title: 'プロジェクトと関係者',
619
- lead: writable ? '目的・関係者・判断・根拠を、記録からたどり、必要な記録を直します。' : '目的・関係者・判断・根拠を、記録からたどります。',
663
+ lead: writable ? '目的・関係者・判断・根拠を、記録からたどり、必要な記録を編集します。' : '目的・関係者・判断・根拠を、記録からたどります。',
620
664
  source: context.source,
621
665
  actions: workspaceHostActions(pageActions),
622
666
  });
@@ -624,16 +668,16 @@ export function createGraphProjectsView({
624
668
  // workspace owns the first viewport while its graph tab is active, so the
625
669
  // old framing must not keep pushing the graph below the fold.
626
670
  const legacyChrome = [pageHeader];
627
- const children = [pageHeader];
671
+ const children = detailPresentation === 'tabs' ? [] : [pageHeader];
628
672
  const dir = state.list.state === 'ok' ? textOrNull(state.list.payload.source?.dataDir) : null;
629
673
  // The record a host's 出典 notice may point at: the selected project once its detail is read.
630
674
  const sourceDetail = state.detail?.id === state.selectedId && state.detail.state === 'ok' ? state.detail.payload.project : null;
631
675
  const sourceSubject = sourceDetail ? { id: sourceDetail.id, type: 'project', metadata: sourceDetail.metadata ?? {} } : null;
632
676
  const sourceBlock = workspaceHostNotice(doc, hostSourceNotice(sourceNotice, sourceSubject)) ?? workspaceNotice(doc, {
633
677
  label: '出典',
634
- text: `このMacのGraph${dir ? `(${dir})` : ''}から読み、ここで直した内容もそこへ保存します。関係者は、プロジェクトに参加している人や責任を持つ人の記録で、ログインや共有の設定ではありません。`,
678
+ text: `このMacのGraph${dir ? `(${dir})` : ''}から読み、ここで変更した内容もそこへ保存します。関係者は、プロジェクトに参加している人や責任を持つ人の記録で、ログインや共有の設定ではありません。`,
635
679
  });
636
- children.push(sourceBlock);
680
+ if (detailPresentation !== 'tabs') children.push(sourceBlock);
637
681
  legacyChrome.push(sourceBlock);
638
682
  if (state.detail?.state === 'ok') {
639
683
  const issues = renderGraphIssues(doc, state.detail.payload.issues);
@@ -645,13 +689,16 @@ export function createGraphProjectsView({
645
689
 
646
690
  const setKnowledgeTabChrome = (tab) => {
647
691
  const graphActive = tab === 'graph';
692
+ if (graphActive && settingsOpen) controller.closeSettings({ restoreFocus: false, immediate: true });
648
693
  root.setAttribute('data-project-graph-active', String(graphActive));
694
+ if (typeof projectWorkspace.onTabChange === 'function') projectWorkspace.onTabChange(tab);
649
695
  for (const node of legacyChrome) {
650
- if (node) node.hidden = graphActive;
696
+ if (node) node.hidden = detailPresentation === 'tabs' ? node === pageHeader || node === sourceBlock || node === summaryBlock : graphActive;
651
697
  }
652
698
  if (!rail) return;
653
- rail.hidden = graphActive;
654
- if (graphActive) rail.setAttribute('aria-hidden', 'true');
699
+ const hideRail = graphActive || Boolean(settings);
700
+ rail.hidden = hideRail;
701
+ if (hideRail) rail.setAttribute('aria-hidden', 'true');
655
702
  else rail.removeAttribute('aria-hidden');
656
703
  // In the organization shell the slot's parent is the actual grid
657
704
  // column. Hide that column as well; hiding only the slot leaves the
@@ -659,7 +706,7 @@ export function createGraphProjectsView({
659
706
  const parent = rail.parentElement;
660
707
  const railColumn = rail.closest?.('.bb-shell-rail')
661
708
  ?? (typeof parent?.className === 'string' && parent.className.split(/\s+/u).includes('bb-shell-rail') ? parent : null);
662
- if (railColumn) railColumn.hidden = graphActive;
709
+ if (railColumn) railColumn.hidden = hideRail;
663
710
  };
664
711
 
665
712
  const stateNotice = graphStateNotice(doc, state.list, { onRetry: () => controller.load(), loadingText: 'プロジェクトを読み込んでいます。' });
@@ -679,7 +726,7 @@ export function createGraphProjectsView({
679
726
  { label: '関係者', value: summary.people, note: summary.people === null ? '人数を確かめられません' : '有効な関わりがある人(重複なし)' },
680
727
  ...extras.metrics,
681
728
  ], { ariaLabel: 'プロジェクトの集計' });
682
- children.push(summaryBlock);
729
+ if (detailPresentation !== 'tabs') children.push(summaryBlock);
683
730
  legacyChrome.push(summaryBlock);
684
731
  if (extras.failure) {
685
732
  children.push(extras.failure);
@@ -689,7 +736,12 @@ export function createGraphProjectsView({
689
736
  // The selected project is the primary reading surface. Keep the ledger
690
737
  // below it as a switcher so a large project list cannot bury its context.
691
738
  if (state.detail?.id === state.selectedId && state.detail.state === 'ok') {
692
- knowledgeWorkspace = createProjectKnowledgeWorkspace({
739
+ if (knowledgeWorkspace && knowledgeDetailPayload === state.detail.payload) {
740
+ knowledgeWorkspace.refreshHost({ context: state.context, onTabChange: setKnowledgeTabChrome });
741
+ } else knowledgeWorkspace = createProjectKnowledgeWorkspace({
742
+ ...projectWorkspace,
743
+ detailPresentation,
744
+ initialViewState: retainedWorkspaceState?.projectId === state.selectedId ? retainedWorkspaceState : undefined,
693
745
  document: doc,
694
746
  detail: state.detail.payload,
695
747
  context: state.context,
@@ -698,6 +750,7 @@ export function createGraphProjectsView({
698
750
  onTabChange: setKnowledgeTabChrome,
699
751
  onRetryProject: (projectId) => controller.loadDetail(projectId),
700
752
  });
753
+ knowledgeDetailPayload = state.detail.payload;
701
754
  children.push(knowledgeWorkspace.element);
702
755
  } else if (state.selectedId) {
703
756
  const projectId = state.selectedId;
@@ -724,7 +777,7 @@ export function createGraphProjectsView({
724
777
  return children;
725
778
  }
726
779
 
727
- if (showProjectLedger) children.push(workspaceLedger(doc, {
780
+ if (showProjectLedger && detailPresentation !== 'tabs') children.push(workspaceLedger(doc, {
728
781
  className: 'bb-graph-project-ledger',
729
782
  ariaLabel: 'プロジェクトの一覧',
730
783
  columns: GRAPH_PROJECT_LEDGER_COLUMNS,
@@ -775,10 +828,10 @@ export function createGraphProjectsView({
775
828
  const subject = `${edge.counterpart.name}(${how}、${project.name})`;
776
829
  if (edgesWritable) {
777
830
  item.append(workspaceActions(doc, [
778
- workspaceButton(doc, { text: '役割を直す', variant: 'quiet', onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'role', subject })) }),
831
+ workspaceButton(doc, { text: '役割を編集', variant: 'quiet', onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'role', subject })) }),
779
832
  edge.active
780
833
  ? workspaceButton(doc, { text: '関わりを終える', variant: 'quiet', onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'end', subject })) })
781
- : workspaceButton(doc, { text: '終了日を直す', variant: 'quiet', onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'end', title: '終了日を直す', subject })) }),
834
+ : workspaceButton(doc, { text: '終了日を編集', variant: 'quiet', onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'end', title: '終了日を編集', subject })) }),
782
835
  ]));
783
836
  }
784
837
  item.append(recordDetails(doc, [['関係ID', edge.id], ['人物ID', edge.counterpart.id], ['digest', edge.digest]]));
@@ -853,7 +906,7 @@ export function createGraphProjectsView({
853
906
  title: 'そのほかの関係',
854
907
  content: [makeElement(doc, 'p', {
855
908
  className: 'bb-graph-block-lead',
856
- text: edgesWritable ? '所有する組織や、進め方を決める判断などです。直すときは「情報と関係」を使います。' : '所有する組織や、進め方を決める判断などです。',
909
+ text: edgesWritable ? '所有する組織や、進め方を決める判断などです。編集するときは「情報と関係」を使います。' : '所有する組織や、進め方を決める判断などです。',
857
910
  }), list],
858
911
  });
859
912
  }
@@ -865,6 +918,7 @@ export function createGraphProjectsView({
865
918
  }
866
919
 
867
920
  function renderRail() {
921
+ if (settings) return [];
868
922
  // The first project is selected once the list is read; until then the rail stays empty
869
923
  // (a project the host asked for is shown only once its detail is being read).
870
924
  if (state.list.state === 'loading' && state.detail?.id !== state.selectedId) return [];
@@ -939,10 +993,10 @@ export function createGraphProjectsView({
939
993
  })),
940
994
  }) : null,
941
995
  projectFields.length > 0 ? workspaceButton(doc, {
942
- text: 'プロジェクトを直す',
996
+ text: 'プロジェクトを編集',
943
997
  onClick: () => openCorrection('project', () => correction.openEntity(project, {
944
998
  fields: projectFields,
945
- title: 'プロジェクトを直す',
999
+ title: 'プロジェクトを編集',
946
1000
  subject: projectCorrectionSubject(project.name, projectFields),
947
1001
  })),
948
1002
  }) : null,
@@ -959,9 +1013,112 @@ export function createGraphProjectsView({
959
1013
  children.push(...railExtensions(state.selectedId, loaded));
960
1014
  children.push(renderOtherRelations(loaded));
961
1015
  children.push(renderCorrectionHistory(doc, loaded.history));
1016
+ if (detailPresentation === 'tabs') children.push(workspaceHostNotice(doc, hostSourceNotice(sourceNotice, noteSubject)));
962
1017
  return children;
963
1018
  }
964
1019
 
1020
+ function releaseSettingsSlots() {
1021
+ for (const handle of settingsSlots.values()) handle.destroy?.();
1022
+ settingsSlots.clear();
1023
+ settingsSlotProjectId = null;
1024
+ }
1025
+
1026
+ function settingsSlot(name, context) {
1027
+ const renderSlot = settings?.[name];
1028
+ if (typeof renderSlot !== 'function') return null;
1029
+ try {
1030
+ let handle = settingsSlots.get(name);
1031
+ if (handle) handle.update?.(context);
1032
+ else {
1033
+ const result = renderSlot(context);
1034
+ handle = result?.root ? result : { root: result };
1035
+ if (!handle.root || !isNode(handle.root)) return null;
1036
+ settingsSlots.set(name, handle);
1037
+ }
1038
+ return handle.root;
1039
+ } catch (error) {
1040
+ return workspaceNotice(doc, { label: '表示できません', text: `設定の欄を表示できませんでした(${failureText(error)})。`, tone: 'danger' });
1041
+ }
1042
+ }
1043
+
1044
+ function renderSettings() {
1045
+ const root = makeElement(doc, 'div', { className: 'bb-gp-settings', attrs: { 'aria-label': 'プロジェクトの設定' } });
1046
+ const loaded = state.detail?.id === state.selectedId && state.detail.state === 'ok' ? state.detail.payload : null;
1047
+ if (!loaded) {
1048
+ const message = graphStateNotice(doc, state.detail ?? { state: 'loading' }, { onRetry: () => controller.loadDetail(state.selectedId), loadingText: 'プロジェクトを読み込んでいます。' });
1049
+ if (message) root.append(message);
1050
+ return root;
1051
+ }
1052
+ const project = loaded.project;
1053
+ if (settingsSlotProjectId !== project.id) { releaseSettingsSlots(); settingsSlotProjectId = project.id; }
1054
+ const projectFields = writable && scope.entity('project') ? scope.fields(['name', 'goal', 'status', 'icon']) : [];
1055
+ const editing = state.panelAt === 'project' && correction.form?.kind === 'update_entity';
1056
+ const edit = projectFields.length && !editing ? workspaceButton(doc, { text: '編集', size: 'compact', onClick: () => openCorrection('project', () => correction.openEntity(project, { fields: projectFields, title: '基本情報', subject: projectCorrectionSubject(project.name, projectFields) })) }) : null;
1057
+ const basic = [];
1058
+ if (editing) basic.push(correction.render(doc, { appearance: 'inline', showHeading: false }));
1059
+ else basic.push(workspaceDefinition(doc, [
1060
+ ['名前', project.name], ['目的', textOrNull(project.goal)], ['状態', textOrNull(project.status)],
1061
+ ['アイコン', renderProjectIcon(doc, project.icon, project.name)],
1062
+ ]));
1063
+ const noteSubject = { id: project.id, type: 'project', metadata: project.metadata ?? {} };
1064
+ if (!projectFields.length) basic.push(hostReadOnlyNote(doc, readOnlyNote, noteSubject));
1065
+ // The technical readback is retained until its evidence destination is moved.
1066
+ basic.push(recordDetails(doc, [['プロジェクトID', project.id], ['digest', project.digest], ['取得日時', loaded.asOf]]));
1067
+ root.append(workspaceSettingsSection(doc, { title: '基本情報', action: edit, content: basic }));
1068
+ // Personal hosts may still edit participation. Organization scopes that
1069
+ // withhold these operations never gain them through the new presentation.
1070
+ if (edgesWritable || writable && scope.createEdges) {
1071
+ root.append(renderParticipants(loaded, { onRetry: () => controller.loadDetail(project.id) }));
1072
+ if (writable && scope.createEdges) root.append(workspaceActions(doc, [workspaceButton(doc, { text: '関係者を加える', size: 'compact', onClick: () => openCorrection('participants', () => correction.openCreate(project, { relations: ['participates_in', 'accountable_for'], relationNames: PARTICIPATION_LABELS, relationLabel: '関わり方', title: '関係者を加える', subject: `プロジェクト「${project.name}」` })) })]));
1073
+ if (state.panelAt === 'participants') root.append(correction.render(doc));
1074
+ }
1075
+ const context = { document: doc, project, detail: loaded, projectId: project.id,
1076
+ actions: { refreshSettings: () => updateSettingsFrame(), closeSettings: options => controller.closeSettings(options) } };
1077
+ for (const name of ['renderConnections', 'renderOrganization']) { const slot = settingsSlot(name, context); if (slot) root.append(slot); }
1078
+ if (!settings?.renderConnections && !settings?.renderOrganization && !settings?.renderArchive) root.append(...railExtensions(project.id, loaded));
1079
+ const history = renderCorrectionHistory(doc, loaded.history, { presentation: 'inline' });
1080
+ if (history) root.append(workspaceSettingsSection(doc, { title: '変更履歴', count: loaded.history.length, content: history }));
1081
+ const archive = settingsSlot('renderArchive', context); if (archive) root.append(archive);
1082
+ const readOnly = hostReadOnlyNote(doc, readOnlyNote, noteSubject);
1083
+ if (projectFields.length && (!scope.edges || !scope.createEdges) && readOnly) root.append(readOnly);
1084
+ const source = workspaceHostNotice(doc, hostSourceNotice(sourceNotice, noteSubject)); if (source) root.append(source);
1085
+ if (detailPresentation !== 'tabs') { const others = renderOtherRelations(loaded); if (others) root.append(others); }
1086
+ return root;
1087
+ }
1088
+
1089
+ function updateSettingsFrame() {
1090
+ if (!settingsOpen || !settingsFrame) return;
1091
+ if (settingsProjectId !== state.selectedId) { controller.closeSettings({ restoreFocus: false, immediate: true }); return; }
1092
+ const loaded = state.detail?.state === 'ok' && state.detail.id === state.selectedId ? state.detail.payload : null;
1093
+ const project = loaded?.project ?? projectSummaryFor(state.selectedId);
1094
+ const detailKey = loaded ?? state.detail;
1095
+ const context = { document: doc, project, detail: loaded, projectId: project.id,
1096
+ actions: { refreshSettings: () => updateSettingsFrame(), closeSettings: options => controller.closeSettings(options) } };
1097
+ // Background task/favorite updates do not alter Graph detail or the form.
1098
+ // Retain that field subtree so the draft, caret and nested controls stay put.
1099
+ if (settingsRenderedPayload === detailKey && settingsRenderedRevision === correction.revision) {
1100
+ for (const handle of settingsSlots.values()) handle.update?.(context);
1101
+ return;
1102
+ }
1103
+ const focused = doc.activeElement;
1104
+ const focusId = settingsFrame.fields.contains?.(focused) ? focused?.id ?? focused?.getAttribute?.('id') : null;
1105
+ const start = Number.isInteger(focused?.selectionStart) ? focused.selectionStart : null;
1106
+ const end = Number.isInteger(focused?.selectionEnd) ? focused.selectionEnd : null;
1107
+ settingsPreview.replaceChildren(renderProjectIcon(doc, project.icon, project.name), makeElement(doc, 'span', { text: project.name }));
1108
+ settingsFrame.fields.replaceChildren(renderSettings());
1109
+ const identity = settingsSlot('renderIdentity', context);
1110
+ if (identity) settingsPreview.append(identity);
1111
+ settingsRenderedPayload = detailKey;
1112
+ settingsRenderedRevision = correction.revision;
1113
+ if (focusId) {
1114
+ const replacement = doc.getElementById?.(focusId);
1115
+ if (replacement && settingsFrame.fields.contains?.(replacement)) {
1116
+ replacement.focus?.({ preventScroll: true });
1117
+ if (start !== null && end !== null) replacement.setSelectionRange?.(start, end);
1118
+ }
1119
+ }
1120
+ }
1121
+
965
1122
  function cancelInitialSelectionGate(gate, { reset = true } = {}) {
966
1123
  if (!gate || gate.cancelled || gate.confirmed) return;
967
1124
  gate.cancelled = true;
@@ -1091,13 +1248,53 @@ export function createGraphProjectsView({
1091
1248
  const controller = {
1092
1249
  get state() { return state; },
1093
1250
  get correction() { return correction; },
1251
+ renderSettings,
1252
+ openSettings(opener) {
1253
+ if (!settings || viewDestroyed || !state.selectedId) return false;
1254
+ if (settingsProjectId !== state.selectedId) releaseSettingsSlots();
1255
+ settingsProjectId = state.selectedId;
1256
+ settingsOpener = typeof opener === 'function' ? opener : () => opener;
1257
+ settingsRenderedPayload = null;
1258
+ settingsRenderedRevision = -1;
1259
+ if (!settingsFrame) {
1260
+ settingsPreview = makeElement(doc, 'div', { className: 'bb-ws-settings-identity' });
1261
+ settingsFrame = workspaceInputFrame(doc, { title: 'プロジェクトの設定', preview: settingsPreview, showFooter: false, opener: () => settingsOpener?.(),
1262
+ beforeClose: () => correction.form?.phase !== 'saving' && [...settingsSlots.values()].every(handle => handle.beforeClose?.() !== false) && settings?.beforeClose?.() !== false,
1263
+ onClose: () => { settingsOpen = false; settingsRenderedPayload = null; settingsRenderedRevision = -1; releaseSettingsSlots(); settings?.onOpenChange?.(false); },
1264
+ });
1265
+ }
1266
+ settingsOpen = true;
1267
+ updateSettingsFrame();
1268
+ settingsFrame.open(typeof opener === 'function' ? opener() : opener);
1269
+ settings?.onOpenChange?.(true);
1270
+ return true;
1271
+ },
1272
+ closeSettings(options) {
1273
+ if (!settingsOpen) return;
1274
+ settingsFrame?.close(options);
1275
+ },
1094
1276
  render() {
1095
1277
  if (viewDestroyed) return controller;
1278
+ let retainedFocus = null;
1096
1279
  if (knowledgeWorkspace) {
1097
- knowledgeWorkspace.destroy();
1098
- knowledgeWorkspace = null;
1099
- }
1100
- layout.render(renderWorkspace(), renderRail());
1280
+ const preserve = detailPresentation === 'tabs' && knowledgeDetailPayload?.project?.id === state.selectedId;
1281
+ retainedWorkspaceState = preserve ? knowledgeWorkspace.getViewState() : null;
1282
+ const reuse = preserve && state.detail?.state === 'ok' && state.detail.payload === knowledgeDetailPayload;
1283
+ if (reuse) retainedFocus = workspaceFocusSnapshot();
1284
+ if (!reuse) {
1285
+ knowledgeWorkspace.destroy();
1286
+ knowledgeWorkspace = null;
1287
+ knowledgeDetailPayload = null;
1288
+ }
1289
+ } else if (retainedWorkspaceState?.projectId !== state.selectedId) retainedWorkspaceState = null;
1290
+ const workspaceChildren = renderWorkspace();
1291
+ const railChildren = renderRail();
1292
+ // An inner context refresh may have replaced the focused search control.
1293
+ const refreshedFocus = retainedFocus ? workspaceFocusSnapshot() : null;
1294
+ if (refreshedFocus) refreshedFocus.scroll = retainedFocus.scroll;
1295
+ layout.render(workspaceChildren, railChildren);
1296
+ restoreWorkspaceFocus(refreshedFocus);
1297
+ updateSettingsFrame();
1101
1298
  if (focusRow) {
1102
1299
  focusLedgerRow(root, focusRow);
1103
1300
  focusRow = null;
@@ -1111,6 +1308,8 @@ export function createGraphProjectsView({
1111
1308
  detailRequest += 1;
1112
1309
  contextRequest += 1;
1113
1310
  initialSelectionGate = null;
1311
+ settingsFrame?.dispose();
1312
+ releaseSettingsSlots();
1114
1313
  knowledgeWorkspace?.destroy();
1115
1314
  knowledgeWorkspace = null;
1116
1315
  correction.close();
@@ -9,7 +9,7 @@ import { workspaceTabStrip } from './workspace-kit.js';
9
9
  * Everything applies as it changes. A record opens as its own screen with an
10
10
  * address the host keeps (`onRouteChange`): what it is, its connections read
11
11
  * as sentences and grouped by the other record's kind, 根拠と履歴 (folded:
12
- * source, period, corrections, ids) and 直す, which first shows what a fix
12
+ * source, period, corrections, ids) and 編集, which first shows what a fix
13
13
  * reaches. The right rail stays empty.
14
14
  *
15
15
  * This screen answers what the Graph knows (ledger D14). The kinds of
@@ -271,16 +271,16 @@ function textCell(value, fallback) {
271
271
  * @param {string} [options.initialEntityId] Opens this exact entity after the initial Graph read.
272
272
  * @param {() => Date} [options.now] The owner's clock.
273
273
  * @param {boolean} [options.canCorrect=true] When false, no correction control is drawn anywhere
274
- * (この記録を直す, 関係を加える, この関係を直す, and この画面で直せること under the kinds of
274
+ * (この記録を編集, 関係を加える, この関係を編集, and この画面で編集できること under the kinds of
275
275
  * information), and the client refuses every correction before sending it.
276
276
  * @param {{ entityTypes?: string[], fields?: string[], edges?: boolean, createEdges?: boolean }} [options.correctionScope]
277
277
  * With corrections allowed, only these (see `graphCorrectionScope`): `entityTypes` lists the kinds that
278
- * offer この記録を直す, `fields` limits its form, `edges: false` withholds この関係を直す and
278
+ * offer この記録を編集, `fields` limits its form, `edges: false` withholds この関係を編集 and
279
279
  * `createEdges: false` withholds 関係を加える. A withheld control is not drawn and the client refuses
280
280
  * such a correction before sending it. Without it every correction is allowed.
281
281
  * @param {string | ((record: { id: string, type: string | null, metadata: object } | null) => string | Element | null)} [options.readOnlyNote]
282
282
  * With `canCorrect: false`, or where `correctionScope` withholds a
283
- * control of the open record, a note shown under 直す where the correction buttons would be.
283
+ * control of the open record, a note shown under 編集 where the correction buttons would be.
284
284
  * Without it nothing is said about corrections.
285
285
  * @param {{ label?: string, text: string | Element }} [options.emptyNotice] Replaces the 未登録 notice
286
286
  * and its `brainbase onboard:*` commands when the host's Graph has nothing registered.
@@ -582,7 +582,7 @@ export function createGraphRegistryView({
582
582
  const dir = state.search.state === 'ok' ? textOrNull(state.search.payload.source?.dataDir) : null;
583
583
  return workspaceHostNotice(doc, hostSourceNotice(sourceNotice, sourceSubject())) ?? workspaceNotice(doc, {
584
584
  label: '出典',
585
- text: `このMacのGraph${dir ? `(${dir})` : ''}だけを表示します。ここで直した内容は、同じGraphを読むMCPの search・get_context・resolve_entity で次から使われます。`,
585
+ text: `このMacのGraph${dir ? `(${dir})` : ''}だけを表示します。ここで編集した内容は、同じGraphを読むMCPの search・get_context・resolve_entity で次から使われます。`,
586
586
  });
587
587
  }
588
588
 
@@ -592,7 +592,7 @@ export function createGraphRegistryView({
592
592
  workspacePageHeader(doc, {
593
593
  crumbs: context.crumbs,
594
594
  title: '情報と関係',
595
- lead: writable ? 'Graphに何がどう登録されているかを確かめ、誤りを直します。' : 'Graphに何がどう登録されているかを確かめます。',
595
+ lead: writable ? 'Graphに何がどう登録されているかを確かめ、記録を編集します。' : 'Graphに何がどう登録されているかを確かめます。',
596
596
  source: context.source,
597
597
  }),
598
598
  renderSearchForm(),
@@ -714,14 +714,14 @@ export function createGraphRegistryView({
714
714
  return section;
715
715
  }
716
716
 
717
- /** 直す: first what a fix reaches, then the entries; a correction opens where it was asked for. */
717
+ /** 編集: first what a fix reaches, then the entries; a correction opens where it was asked for. */
718
718
  function renderFix(payload) {
719
719
  const { entity } = payload;
720
720
  const noteSubject = { id: entity.id, type: entity.type, metadata: payload.entity?.metadata ?? {} };
721
721
  const edges = [...payload.outgoing, ...payload.incoming];
722
722
  if (!writable) {
723
723
  const note = hostReadOnlyNote(doc, readOnlyNote, noteSubject);
724
- return note ? pageSection('直す', [note], 'bb-gr-fix') : null;
724
+ return note ? pageSection('編集', [note], 'bb-gr-fix') : null;
725
725
  }
726
726
  const canFix = scope.entity(entity.type) && scope.fields(graphEntityCorrectionFields(entity.type)).length > 0;
727
727
  const relatable = newRelationOptions(entity.type).length > 0 && scope.createEdges;
@@ -734,22 +734,22 @@ export function createGraphRegistryView({
734
734
  const shown = counterparts.slice(0, 5).join('、');
735
735
  reach.append(makeElement(doc, 'li', { text: `つながる${counterparts.length}件の記録(${shown}${counterparts.length > 5 ? ' ほか' : ''})の詳細に出る、この記録の名前とつながり` }));
736
736
  }
737
- children.push(makeElement(doc, 'p', { className: 'bb-graph-block-lead', text: '直す前に、影響する先を確かめてください。直した内容は次に効きます。' }), reach);
737
+ children.push(makeElement(doc, 'p', { className: 'bb-graph-block-lead', text: '編集する前に、影響する先を確かめてください。編集した内容は次に効きます。' }), reach);
738
738
  const entries = [
739
- canFix ? '「この記録を直す」' : null,
739
+ canFix ? '「この記録を編集」' : null,
740
740
  relatable ? '「関係を加える」' : null,
741
- edgesWritable && editableEdges.length > 0 ? '関係ごとの「この関係を直す」' : null,
741
+ edgesWritable && editableEdges.length > 0 ? '関係ごとの「この関係を編集」' : null,
742
742
  ].filter(Boolean);
743
743
  if (entries.length > 0) {
744
744
  const last = entries.at(-1);
745
745
  const list = entries.length === 1 ? last : `${entries.slice(0, -1).join('、')}、または${last}`;
746
746
  children.push(makeElement(doc, 'p', {
747
747
  className: 'bb-gr-fix-flow',
748
- text: `誤りを見つけたときの訂正入口です。${list}から変更案を入力します。承認待ちの提出ではなく、保存するとその場でGraphに反映され、理由と変更前後が履歴に残ります。保存後に読み直して一致を確かめ、確認できた内容は、次のMCPの search・get_context・resolve_entity で使われます。`,
748
+ text: `誤りを見つけたときの編集入口です。${list}から変更案を入力します。承認待ちの提出ではなく、保存するとその場でGraphに反映され、理由と変更前後が履歴に残ります。保存後に読み直して一致を確かめ、確認できた内容は、次のMCPの search・get_context・resolve_entity で使われます。`,
749
749
  }));
750
750
  }
751
751
  const actions = [
752
- canFix ? workspaceButton(doc, { text: 'この記録を直す', onClick: () => openCorrection('entity', () => correction.openEntity(entity, { title: 'この記録を直す' })) }) : null,
752
+ canFix ? workspaceButton(doc, { text: 'この記録を編集', onClick: () => openCorrection('entity', () => correction.openEntity(entity, { title: 'この記録を編集' })) }) : null,
753
753
  relatable ? workspaceButton(doc, { text: '関係を加える', onClick: () => openCorrection('entity', () => correction.openCreate(entity, { title: '関係を加える' })) }) : null,
754
754
  ].filter(Boolean);
755
755
  if (actions.length > 0) children.push(workspaceActions(doc, actions));
@@ -757,14 +757,14 @@ export function createGraphRegistryView({
757
757
  const inRelation = editableEdges.some((edge) => edge.id === state.panelAt);
758
758
  if (!inRelation) children.push(correction.render(doc));
759
759
  if (edgesWritable && editableEdges.length > 0) {
760
- const list = makeElement(doc, 'ul', { className: 'bb-gr-fix-relations', attrs: { 'aria-label': '関係を直す' } });
760
+ const list = makeElement(doc, 'ul', { className: 'bb-gr-fix-relations', attrs: { 'aria-label': '関係を編集' } });
761
761
  for (const edge of editableEdges) {
762
762
  const item = makeElement(doc, 'li', { className: 'bb-gr-fix-relation' });
763
763
  const subject = edge.direction === 'outgoing'
764
764
  ? `${entity.name} → ${relationLabel(edge.relation)} → ${edge.counterpart.name}`
765
765
  : `${edge.counterpart.name} → ${relationLabel(edge.relation)} → ${entity.name}`;
766
766
  item.append(relationSentence(edge, entity, { link: false }), workspaceButton(doc, {
767
- text: 'この関係を直す',
767
+ text: 'この関係を編集',
768
768
  variant: 'quiet',
769
769
  onClick: () => openCorrection(edge.id, () => correction.openEdge(edge, { mode: 'edit', subject })),
770
770
  }));
@@ -780,12 +780,12 @@ export function createGraphRegistryView({
780
780
  if (!canFix || (newRelationOptions(entity.type).length > 0 && !scope.createEdges) || (edges.length > 0 && !scope.edges)) {
781
781
  children.push(hostReadOnlyNote(doc, readOnlyNote, noteSubject));
782
782
  }
783
- return pageSection('直す', children, 'bb-gr-fix');
783
+ return pageSection('編集', children, 'bb-gr-fix');
784
784
  }
785
785
 
786
786
  /**
787
787
  * The open record as its own screen: back to the list, its name and kind, then
788
- * 何者か → つながり → 根拠と履歴 → 直す. 使われた場所 is not drawn: no read path
788
+ * 何者か → つながり → 根拠と履歴 → 編集. 使われた場所 is not drawn: no read path
789
789
  * reaches the work, judgments and minutes that mention a record yet.
790
790
  */
791
791
  function renderDetailPage() {