@unson/brainbase-mcp 0.47.0 → 0.47.1

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/dist/server.js CHANGED
@@ -47,12 +47,12 @@ const personalKnowledgeEventSchema = z.object({
47
47
  source: z.unknown().optional(),
48
48
  source_pointer: z.unknown().optional(),
49
49
  parent_episode_id: z.string().min(1).nullable().optional(),
50
- permission_snapshot: z.record(z.unknown()).optional(),
50
+ permission_snapshot: z.record(z.string(), z.unknown()).optional(),
51
51
  sensitivity: z.string().min(1).optional(),
52
52
  kind: z.string().min(1).optional(),
53
53
  type: z.string().min(1).optional(),
54
54
  tags: z.array(z.string().min(1)).optional(),
55
- metadata: z.record(z.unknown()).optional()
55
+ metadata: z.record(z.string(), z.unknown()).optional()
56
56
  }).strict();
57
57
  const personalKnowledgeContextSchema = z.object({}).strict();
58
58
  const personalKnowledgeRegisterSchema = z.object({ event: personalKnowledgeEventSchema }).strict();
@@ -95,13 +95,13 @@ const sourceInventorySchema = z.object({
95
95
  }).strict();
96
96
  const candidateSchema = z.object({
97
97
  kind: z.string(),
98
- payload: z.record(z.unknown()),
98
+ payload: z.record(z.string(), z.unknown()),
99
99
  observationClass: z.enum(['observed', 'inferred']),
100
100
  evidenceId: z.string()
101
101
  }).strict();
102
102
  const reviewActionSchema = z.discriminatedUnion('decision', [
103
103
  z.object({ candidateId: z.string(), decision: z.literal('approve'), reason: z.string() }).strict(),
104
- z.object({ candidateId: z.string(), decision: z.literal('edit'), reason: z.string(), payload: z.record(z.unknown()) }).strict(),
104
+ z.object({ candidateId: z.string(), decision: z.literal('edit'), reason: z.string(), payload: z.record(z.string(), z.unknown()) }).strict(),
105
105
  z.object({ candidateId: z.string(), decision: z.literal('reject'), reason: z.string() }).strict(),
106
106
  z.object({ candidateId: z.string(), decision: z.literal('merge'), reason: z.string(), mergeIntoCandidateId: z.string() }).strict()
107
107
  ]);
@@ -119,7 +119,7 @@ const connectedSchemas = {
119
119
  sourceId: z.string(),
120
120
  evidencePointer: z.string(),
121
121
  contentHash: z.string(),
122
- permissionSnapshot: z.record(z.unknown()),
122
+ permissionSnapshot: z.record(z.string(), z.unknown()),
123
123
  collectionStatus: z.literal('collected')
124
124
  }).strict(),
125
125
  candidates: z.array(candidateSchema)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.47.0",
3
+ "version": "0.47.1",
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",
@@ -590,7 +590,7 @@
590
590
  "graphology": "0.26.0",
591
591
  "js-yaml": "^4.1.1",
592
592
  "sigma": "3.0.3",
593
- "zod": "^3.25.56"
593
+ "zod": "^4.6.7"
594
594
  },
595
595
  "overrides": {
596
596
  "ip-address": "^10.4.0"
@@ -620,5 +620,5 @@
620
620
  "url": "https://github.com/Unson-LLC/brainbase/issues"
621
621
  },
622
622
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
623
- "gitHead": "dc76f9e7cf2c782f31fb0564efde61e0aa33bca6"
623
+ "gitHead": "dbc299214b0326a8aec74a962a13232ee9072f44"
624
624
  }
@@ -820,3 +820,8 @@
820
820
  align-items: flex-end;
821
821
  gap: 6px 8px;
822
822
  }
823
+
824
+ .bb-minutes-columns.bb-minutes-details-in-drawer { grid-template-columns: minmax(0, 1fr); }
825
+ .bb-minutes-drawer-content .bb-minutes-detail-pane { position: static; width: 100%; max-height: none; padding: 0; border: 0; border-radius: 0; overflow: visible; }
826
+
827
+ .bb-minutes-screen.bb-minutes-drawer-content { display: block; height: auto; overflow: visible; }
@@ -11,7 +11,7 @@
11
11
  * changes what it asks the server for (story-meeting-minutes-list-filters-v1).
12
12
  */
13
13
 
14
- import { workspaceCombobox } from './workspace-kit.js';
14
+ import { workspaceCombobox, workspaceDetailDrawer } from './workspace-kit.js';
15
15
 
16
16
  export const MEETING_MINUTES_UI_CONTRACT_VERSION = 'brainbase.meeting-minutes-ui.v1';
17
17
 
@@ -674,6 +674,7 @@ function appendVersionActionExtensions(doc, section, {
674
674
  export function createMeetingMinutesUI({
675
675
  root,
676
676
  rail = null,
677
+ detailPresentation = 'inline',
677
678
  page = null,
678
679
  document: explicitDocument,
679
680
  fetcher,
@@ -716,6 +717,7 @@ export function createMeetingMinutesUI({
716
717
  // { meetingId, value, openName } for the 参加者 row (story-meeting-participants-row-v1).
717
718
  participants: null,
718
719
  };
720
+ let disposed = false;
719
721
  let listRequestGeneration = 0;
720
722
  let detailRequestGeneration = 0;
721
723
  let createReasonSequence = 0;
@@ -742,7 +744,15 @@ export function createMeetingMinutesUI({
742
744
  attrs: { 'aria-label': '議事録', tabindex: '-1' },
743
745
  });
744
746
  const detailPane = makeElement(doc, 'section', { className: 'bb-minutes-detail-pane', attrs: { 'aria-label': '議事録詳細' } });
745
- columns.append(listPane, detailPane);
747
+ const detailDrawer = detailPresentation === 'drawer' ? workspaceDetailDrawer(doc, {
748
+ title: '議事録の詳細', opener: () => listPane.querySelector('.bb-minutes-meeting-item.is-selected') ?? listPane,
749
+ }) : null;
750
+ if (detailDrawer) {
751
+ columns.classList.add('bb-minutes-details-in-drawer');
752
+ columns.append(listPane);
753
+ const scope = makeElement(doc, 'div', { className: 'bb-minutes-screen bb-minutes-drawer-content' });
754
+ scope.append(detailPane); detailDrawer.setContent(scope);
755
+ } else columns.append(listPane, detailPane);
746
756
  screen.append(heading, status, toolbar, columns);
747
757
  root.replaceChildren(screen);
748
758
 
@@ -1827,6 +1837,7 @@ export function createMeetingMinutesUI({
1827
1837
  }
1828
1838
 
1829
1839
  function renderCreateForm() {
1840
+ detailDrawer?.open();
1830
1841
  clear(detailPane);
1831
1842
  if (!canCreate()) {
1832
1843
  renderCreateUnavailable();
@@ -1875,7 +1886,7 @@ export function createMeetingMinutesUI({
1875
1886
 
1876
1887
  async function loadMeetings({ restoreFocus = false } = {}) {
1877
1888
  const requestGeneration = ++listRequestGeneration;
1878
- const isCurrentRequest = () => requestGeneration === listRequestGeneration;
1889
+ const isCurrentRequest = () => !disposed && requestGeneration === listRequestGeneration;
1879
1890
  state.loading = true;
1880
1891
  setStatus('会議一覧を読み込んでいます。');
1881
1892
  try {
@@ -1928,8 +1939,10 @@ export function createMeetingMinutesUI({
1928
1939
  }
1929
1940
 
1930
1941
  async function loadDetail(meetingId) {
1942
+ if (disposed) return null;
1943
+ detailDrawer?.open();
1931
1944
  const requestGeneration = ++detailRequestGeneration;
1932
- const isCurrentRequest = () => requestGeneration === detailRequestGeneration
1945
+ const isCurrentRequest = () => !disposed && requestGeneration === detailRequestGeneration
1933
1946
  && state.meetingId === meetingId;
1934
1947
  state.meetingId = meetingId;
1935
1948
  state.minutesId = null;
@@ -1938,6 +1951,7 @@ export function createMeetingMinutesUI({
1938
1951
  state.withdrawingMinutesId = null;
1939
1952
  renderList();
1940
1953
  setStatus('会議詳細を読み込んでいます。');
1954
+ if (detailDrawer) detailPane.replaceChildren(makeElement(doc, 'p', { attrs: { role: 'status' }, textContent: '会議詳細を読み込んでいます。' }));
1941
1955
  try {
1942
1956
  const detail = await call(`/${encodeURIComponent(meetingId)}`);
1943
1957
  if (!isCurrentRequest()) return state.detail;
@@ -1970,6 +1984,12 @@ export function createMeetingMinutesUI({
1970
1984
  contractVersion: MEETING_MINUTES_UI_CONTRACT_VERSION,
1971
1985
  refresh: loadMeetings,
1972
1986
  openMeeting: loadDetail,
1987
+ destroy() {
1988
+ disposed = true; listRequestGeneration += 1; detailRequestGeneration += 1;
1989
+ detailDrawer?.dispose();
1990
+ participantBox.destroy(); statusBox.destroy(); sortBox.destroy();
1991
+ for (const entry of hostBoxes.values()) entry.box.destroy();
1992
+ },
1973
1993
  state,
1974
1994
  };
1975
1995
  }
@@ -469,3 +469,6 @@
469
469
  padding-top: .75rem;
470
470
  }
471
471
  .knowledge-outcome .knowledge-overview-project { color: var(--knowledge-muted); font-size: .78rem; }
472
+
473
+ .knowledge-outcome-body.knowledge-details-in-drawer { grid-template-columns: minmax(0, 1fr); }
474
+ .knowledge-inspector-drawer .knowledge-inspector { position: static; width: 100%; max-width: none; max-height: none; padding: 0; border: 0; border-radius: 0; overflow: visible; }
@@ -1,3 +1,5 @@
1
+ import { workspaceDetailDrawer } from './workspace-kit.js';
2
+
1
3
  /*
2
4
  * Brainbase knowledge outcome surface.
3
5
  *
@@ -889,7 +891,7 @@ export function renderKnowledgeList(root, model = {}, callbacks = {}) {
889
891
  text: '選択した知識の詳細へ',
890
892
  attrs: { href: '#knowledge-selected-detail', 'aria-controls': 'knowledge-selected-detail' },
891
893
  });
892
- jump.addEventListener('click', () => focusKnowledgeDetail());
894
+ jump.addEventListener('click', event => { event.preventDefault(); if (callbacks.onOpenDetail) callbacks.onOpenDetail(item); else focusKnowledgeDetail(); });
893
895
  rows.append(jump);
894
896
  }
895
897
  }
@@ -1479,6 +1481,29 @@ export function renderKnowledgeProjectFilter(root, model = {}, callbacks = {}) {
1479
1481
  * @param {Array|Function} [options.projects] Projects offered in the filter.
1480
1482
  * @param {(code: string|null, context?: object) => void} [options.onSelectProject]
1481
1483
  */
1484
+ function knowledgeInspector(root, options) {
1485
+ let drawer;
1486
+ let opened = false;
1487
+ return {
1488
+ request() { opened = true; },
1489
+ close() { opened = false; drawer?.close({ restoreFocus: false, immediate: true }); },
1490
+ render(pane, body) {
1491
+ if (options.detailPresentation !== 'drawer') { body.append(pane); return; }
1492
+ body.classList.add('knowledge-details-in-drawer');
1493
+ drawer ??= workspaceDetailDrawer(root.ownerDocument, {
1494
+ title: '知識の詳細',
1495
+ opener: () => root.querySelector('.knowledge-list-row[aria-pressed="true"]') ?? root.querySelector('[data-knowledge-save-result]'),
1496
+ onClose: () => { opened = false; },
1497
+ });
1498
+ const scope = root.ownerDocument.createElement('div');
1499
+ scope.className = 'knowledge-outcome knowledge-inspector-drawer';
1500
+ scope.append(pane); drawer.setContent(scope);
1501
+ if (opened) drawer.open();
1502
+ },
1503
+ destroy() { opened = false; drawer?.dispose(); },
1504
+ };
1505
+ }
1506
+
1482
1507
  export function createKnowledgeOverviewController(options = {}) {
1483
1508
  const { root, api, onSelectProject } = options;
1484
1509
  if (!root || typeof root.replaceChildren !== 'function') throw new Error('knowledge_root_unavailable');
@@ -1492,6 +1517,9 @@ export function createKnowledgeOverviewController(options = {}) {
1492
1517
  detail: { state: 'idle' },
1493
1518
  };
1494
1519
  let selectionGeneration = 0;
1520
+ let destroyed = false;
1521
+ const inspector = knowledgeInspector(root, options);
1522
+ const destroy = () => { destroyed = true; selectionGeneration += 1; inspector.destroy(); };
1495
1523
  const projectName = (code) => projectOptions(options.projects).find((option) => option.code === code)?.name ?? null;
1496
1524
 
1497
1525
  function itemsPath() {
@@ -1523,6 +1551,7 @@ export function createKnowledgeOverviewController(options = {}) {
1523
1551
  }
1524
1552
 
1525
1553
  function render() {
1554
+ if (destroyed) return null;
1526
1555
  clear(root);
1527
1556
  const shell = makeElement('div', { className: 'knowledge-outcome knowledge-overview' });
1528
1557
  const header = makeElement('header', { className: 'knowledge-outcome-head' });
@@ -1558,6 +1587,7 @@ export function createKnowledgeOverviewController(options = {}) {
1558
1587
  emptyText: emptyText(),
1559
1588
  selectedId: state.selected?.id,
1560
1589
  onSelect: (item) => { void selectItem(item); },
1590
+ onOpenDetail: options.detailPresentation === 'drawer' ? (item) => { void selectItem(item); } : null,
1561
1591
  onRetry: () => loadItems(),
1562
1592
  });
1563
1593
  discovery.append(list);
@@ -1588,12 +1618,13 @@ export function createKnowledgeOverviewController(options = {}) {
1588
1618
  }
1589
1619
  detail.append(owner);
1590
1620
  }
1591
- body.append(detail); shell.append(body); root.append(shell);
1621
+ inspector.render(detail, body); shell.append(body); root.append(shell);
1592
1622
  options.onStateChange?.(state);
1593
1623
  return shell;
1594
1624
  }
1595
1625
 
1596
1626
  async function loadItems() {
1627
+ inspector.close();
1597
1628
  selectionGeneration += 1;
1598
1629
  state.selected = null;
1599
1630
  state.detail = { state: 'idle' };
@@ -1604,6 +1635,8 @@ export function createKnowledgeOverviewController(options = {}) {
1604
1635
  }
1605
1636
 
1606
1637
  async function selectItem(item) {
1638
+ if (destroyed) return null;
1639
+ inspector.request();
1607
1640
  const requestGeneration = ++selectionGeneration;
1608
1641
  state.selected = item ?? null;
1609
1642
  const code = optionalText(item?.project_code).trim();
@@ -1630,7 +1663,7 @@ export function createKnowledgeOverviewController(options = {}) {
1630
1663
  }
1631
1664
  }
1632
1665
 
1633
- const controller = { state, render, loadItems, selectItem, paths: { items: itemsPath } };
1666
+ const controller = { state, render, destroy, loadItems, selectItem, paths: { items: itemsPath } };
1634
1667
  render();
1635
1668
  if (options.autoLoad !== false) void loadItems();
1636
1669
  return controller;
@@ -1680,6 +1713,9 @@ export function createKnowledgeOutcomeController(options = {}) {
1680
1713
  destination: { state: 'unknown', registration: null, draft: {}, message: '保存先APIの契約を確認できていません。' },
1681
1714
  };
1682
1715
  let selectionGeneration = 0;
1716
+ let destroyed = false;
1717
+ const inspector = knowledgeInspector(root, options);
1718
+ const destroy = () => { destroyed = true; selectionGeneration += 1; inspector.destroy(); };
1683
1719
 
1684
1720
  function resumeUrl(draftId) {
1685
1721
  const location = options.location ?? globalThis.location;
@@ -1695,6 +1731,7 @@ export function createKnowledgeOutcomeController(options = {}) {
1695
1731
  }
1696
1732
 
1697
1733
  function render() {
1734
+ if (destroyed) return null;
1698
1735
  clear(root);
1699
1736
  const shell = makeElement('div', { className: 'knowledge-outcome' });
1700
1737
  const header = makeElement('header', { className: 'knowledge-outcome-head' });
@@ -1737,7 +1774,7 @@ export function createKnowledgeOutcomeController(options = {}) {
1737
1774
  renderDiscoveryFilters(filters, state.filters, { onChange: (next) => { state.filters = next; void loadItems(); }, });
1738
1775
  discovery.append(filters);
1739
1776
  const list = makeElement('div', { className: 'knowledge-discovery-list' });
1740
- renderKnowledgeList(list, state.list, { labels, selectedId: state.selected?.id, onSelect: (item) => { void selectItem(item); }, onRetry: () => loadItems() });
1777
+ renderKnowledgeList(list, state.list, { labels, selectedId: state.selected?.id, onSelect: (item) => { void selectItem(item); }, onOpenDetail: options.detailPresentation === 'drawer' ? (item) => { void selectItem(item); } : null, onRetry: () => loadItems() });
1741
1778
  discovery.append(list);
1742
1779
  primary.append(discovery);
1743
1780
  const captureWorkspace = makeElement('section', { className: 'knowledge-focused-view knowledge-capture-view', hidden: state.view !== 'capture', attrs: { 'aria-labelledby': 'knowledge-capture-workspace-title' } });
@@ -1807,6 +1844,11 @@ export function createKnowledgeOutcomeController(options = {}) {
1807
1844
  });
1808
1845
  destination.append(destinationContent);
1809
1846
  primary.append(destination);
1847
+ if (options.detailPresentation === 'drawer' && state.commit.state !== 'idle') {
1848
+ const result = makeElement('button', { className: 'knowledge-button secondary', text: '保存結果を開く', attrs: { type: 'button', 'data-knowledge-save-result': 'true' } });
1849
+ result.addEventListener('click', () => { inspector.request(); render(); });
1850
+ primary.append(result);
1851
+ }
1810
1852
  body.append(primary);
1811
1853
  const detail = makeElement('aside', {
1812
1854
  className: 'knowledge-outcome-detail knowledge-inspector',
@@ -1826,7 +1868,7 @@ export function createKnowledgeOutcomeController(options = {}) {
1826
1868
  detailState: state.detail,
1827
1869
  showSelectionGuide: Boolean(state.selected) || hasSelectableKnowledge,
1828
1870
  onRetry: state.selected ? () => void selectItem(state.selected.id) : null,
1829
- onPreview: (item) => { state.preview = { state: 'idle', question: '', context: '', item_id: item.id, candidate_version: item.version, item_version: item.version }; state.view = 'preview'; render(); },
1871
+ onPreview: (item) => { inspector.close(); state.preview = { state: 'idle', question: '', context: '', item_id: item.id, candidate_version: item.version, item_version: item.version }; state.view = 'preview'; render(); },
1830
1872
  });
1831
1873
  detail.append(detailContent);
1832
1874
  const lifecycle = makeElement('div', { className: 'knowledge-inspector-lifecycle' });
@@ -1847,11 +1889,12 @@ export function createKnowledgeOutcomeController(options = {}) {
1847
1889
  renderCommitState(commit, state.commit, { onReadback, onReapply });
1848
1890
  detail.append(commit);
1849
1891
  }
1850
- body.append(detail); shell.append(body); root.append(shell); notify();
1892
+ inspector.render(detail, body); shell.append(body); root.append(shell); notify();
1851
1893
  return shell;
1852
1894
  }
1853
1895
 
1854
1896
  async function loadItems() {
1897
+ inspector.close();
1855
1898
  selectionGeneration += 1;
1856
1899
  state.selected = null;
1857
1900
  state.detail = { state: 'idle' };
@@ -1917,6 +1960,8 @@ export function createKnowledgeOutcomeController(options = {}) {
1917
1960
  }
1918
1961
 
1919
1962
  async function selectItem(itemOrId) {
1963
+ if (destroyed) return null;
1964
+ inspector.request();
1920
1965
  const requestGeneration = ++selectionGeneration;
1921
1966
  const id = typeof itemOrId === 'object' ? itemOrId?.id : itemOrId;
1922
1967
  const listItem = typeof itemOrId === 'object' ? itemOrId : state.list.records?.find((item) => item.id === id);
@@ -2132,6 +2177,7 @@ export function createKnowledgeOutcomeController(options = {}) {
2132
2177
  }
2133
2178
 
2134
2179
  async function commitCandidate(values) {
2180
+ inspector.request();
2135
2181
  if (state.commit.state === 'saving' || state.commit.pending_save || ['verified', 'saved_unverified'].includes(state.commit.state)) return state.commit;
2136
2182
  if (state.candidate.state === 'saving' || state.candidate.candidate_readback_pending === true) return state.commit;
2137
2183
  const previousDraftConflict = state.commit.pending_draft_update;
@@ -2279,6 +2325,7 @@ export function createKnowledgeOutcomeController(options = {}) {
2279
2325
  }
2280
2326
 
2281
2327
  async function reapplyPendingDraftUpdate() {
2328
+ inspector.request();
2282
2329
  const pending = state.commit.pending_draft_update;
2283
2330
  if (!pendingDraftUpdateReadyForReapply(pending)) return state.commit;
2284
2331
  // commitCandidate marks the commit as saving before its first await. This
@@ -2295,6 +2342,7 @@ export function createKnowledgeOutcomeController(options = {}) {
2295
2342
  }
2296
2343
 
2297
2344
  async function retryPendingSave() {
2345
+ inspector.request();
2298
2346
  const pendingDraftUpdate = state.commit.pending_draft_update;
2299
2347
  if (pendingDraftUpdate) {
2300
2348
  if (pendingDraftUpdate.latest_revision === undefined || pendingDraftUpdate.latest_revision === null) return retryDraftConflictReadback();
@@ -2347,6 +2395,7 @@ export function createKnowledgeOutcomeController(options = {}) {
2347
2395
  }
2348
2396
 
2349
2397
  async function readbackCommit() {
2398
+ inspector.request();
2350
2399
  if (!state.commit.item_id) { state.commit = { ...state.commit, state: 'unknown', message: 'readback対象IDを確認できません。' }; render(); return null; }
2351
2400
  try { const payload = await callKnowledgeApi(api, knowledgePath(code, `${KNOWLEDGE_ROUTES.items}/${encodeURIComponent(state.commit.item_id)}`)); const item = normalizeKnowledgeItem(payload?.item ?? payload?.record ?? payload?.data ?? payload); const actualHash = payload?.canonical_content_hash ?? payload?.readback?.content_hash ?? payload?.content_hash ?? item?.raw?.canonical_content_hash ?? item?.raw?.content_hash ?? null; const relationsMatch = expectedRelationsMatch(item?.relations, state.commit.expected_relations); const matches = state.commit.receipt_verified === true && item?.id === state.commit.item_id && state.commit.expected_version !== null && item?.version === state.commit.expected_version && state.commit.expected_hash !== null && actualHash === state.commit.expected_hash && item?.source?.state === 'fetched' && relationsMatch; state.commit = { ...state.commit, state: matches ? 'verified' : 'saved_unverified', relations_match: relationsMatch, item, version: item?.version ?? state.commit.version }; if (item) state.selected = item; }
2352
2401
  catch (error) { state.commit = { ...state.commit, state: 'saved_unverified', message: apiErrorText(error) }; }
@@ -2470,7 +2519,7 @@ export function createKnowledgeOutcomeController(options = {}) {
2470
2519
  render(); return state.preview;
2471
2520
  }
2472
2521
 
2473
- const controller = { state, render, loadItems, loadAuthorityDomains, loadDestination, saveDestination, selectItem, createDraft, resumeDraft, discardDraft, applyProposal, saveCandidate, commitCandidate, retryPendingSave, reapplyPendingDraftUpdate, readbackCommit, reviseItem, supersedeItem, retireItem, runPreview, paths: { items: () => buildKnowledgeItemsPath(code, state.filters), drafts: () => knowledgePath(code, KNOWLEDGE_ROUTES.drafts), destination: destinationPath } };
2522
+ const controller = { state, render, destroy, loadItems, loadAuthorityDomains, loadDestination, saveDestination, selectItem, createDraft, resumeDraft, discardDraft, applyProposal, saveCandidate, commitCandidate, retryPendingSave, reapplyPendingDraftUpdate, readbackCommit, reviseItem, supersedeItem, retireItem, runPreview, paths: { items: () => buildKnowledgeItemsPath(code, state.filters), drafts: () => knowledgePath(code, KNOWLEDGE_ROUTES.drafts), destination: destinationPath } };
2474
2523
  render();
2475
2524
  const initialLocation = options.location ?? globalThis.location;
2476
2525
  if (initialLocation?.href) {
@@ -240,6 +240,7 @@ export function createPeopleAndCompaniesView({
240
240
  tokenHeader,
241
241
  autoLoad = true,
242
242
  initialEntityId,
243
+ onDetailOpen,
243
244
  now = () => new Date(),
244
245
  canCorrect = false,
245
246
  correctionScope,
@@ -871,6 +872,7 @@ export function createPeopleAndCompaniesView({
871
872
  if (state.detail?.id !== id) pendingScroll = { head: true };
872
873
  state.detail = { id, state: 'loading' };
873
874
  controller.render();
875
+ onDetailOpen?.({ id });
874
876
  const result = await client.read(`/entities/${encodeURIComponent(id)}`);
875
877
  if (state.detail?.id !== id) return;
876
878
  state.detail = { id, ...normalizeEntityDetail(result) };
@@ -647,3 +647,19 @@
647
647
  .bb-ws-combobox-option-hint { color: var(--bb-color-muted); font-size: 12px; white-space: nowrap; }
648
648
  .bb-ws-combobox-status { margin: 0; padding: 2px 4px 0; color: var(--bb-color-muted); font-size: 12px; }
649
649
  @media (prefers-reduced-motion:reduce) { .bb-ws-combobox-popup { animation: none; } }
650
+
651
+ /* Shared page chrome and on-demand inspectors. Page actions remain in the body. */
652
+ .bb-ws-topbar { position: sticky; top: 0; z-index: 18; display: flex; align-items: center; height: 44px; min-height: 44px; flex: 0 0 44px; box-sizing: border-box; padding: 0 16px; background: var(--bb-color-panel); border-bottom: 1px solid var(--bb-color-border); }
653
+ .bb-ws-topbar[hidden] { display: none; }
654
+ .bb-ws-topbar h1 { margin: 0; font: 500 14px/20px var(--bb-font-sans); color: var(--bb-color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
655
+ .bb-ws-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
656
+ .bb-ws-detail-drawer { padding: 0; }
657
+ .bb-ws-detail-drawer:not([open]) { display: none; }
658
+ .bb-ws-detail-closebar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; min-height: 44px; padding: 4px 16px; box-sizing: border-box; background: var(--bb-color-panel); border-bottom: 1px solid var(--bb-color-border); }
659
+ .bb-ws-detail-content { padding: 20px 24px 32px; }
660
+ .bb-ws-has-topbar .bb-ws-page-head h1,
661
+ .bb-ws-has-topbar .knowledge-outcome-head h2,
662
+ .bb-ws-has-topbar .bb-minutes-heading h1 { display: none; }
663
+ @media (max-width: 760px) { .bb-ws-detail-content { padding: 16px 16px 32px; } }
664
+
665
+ .bb-ws-detail-closebar .bb-ws-button { min-height: 32px; padding: 4px 10px; }
@@ -66,6 +66,61 @@ export function workspacePageHeader(doc, { crumbs = [], title, lead, source, act
66
66
  return wrap;
67
67
  }
68
68
 
69
+ /** A shared, title-only top bar. The host owns scrolling and immersive-page visibility. */
70
+ export function workspaceTopbar(doc, { title = '' } = {}) {
71
+ const header = el(doc, 'header', { className: 'bb-ws-topbar' });
72
+ header.append(el(doc, 'h1', { text: title }));
73
+ return header;
74
+ }
75
+
76
+ /** A reusable right inspector whose content can refresh without replacing the modal. */
77
+ export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose } = {}) {
78
+ const dialog = workspaceApplyDrawer(el(doc, 'dialog', { className: 'bb-ws-dialog bb-ws-detail-drawer' }));
79
+ const titleId = `bb-ws-inspector-${++workspaceSequence}`;
80
+ dialog.setAttribute('aria-labelledby', titleId);
81
+ const head = el(doc, 'header', { className: 'bb-ws-detail-closebar' });
82
+ const label = el(doc, 'h2', { className: 'bb-ws-visually-hidden', text: title, attrs: { id: titleId } });
83
+ const body = el(doc, 'div', { className: 'bb-ws-detail-content' });
84
+ let disposed = false;
85
+ let cancelClosing;
86
+ let fallbackOpener;
87
+ const finish = (restoreFocus) => {
88
+ cancelClosing?.(); cancelClosing = null;
89
+ if (dialog.open) dialog.close();
90
+ const target = (typeof opener === 'function' ? opener() : opener) ?? fallbackOpener;
91
+ if (restoreFocus && target?.isConnected) target.focus({ preventScroll: true });
92
+ };
93
+ const close = ({ restoreFocus = true, immediate = false } = {}) => {
94
+ if (!dialog.open) return;
95
+ // Clear the caller's open state before an asynchronous content update arrives.
96
+ if (cancelClosing && !immediate) return;
97
+ if (!cancelClosing) onClose?.();
98
+ if (immediate) finish(restoreFocus);
99
+ else cancelClosing = workspaceCloseDrawer(dialog, () => finish(restoreFocus));
100
+ };
101
+ const button = workspaceButton(doc, { text: '閉じる', onClick: () => close() });
102
+ head.append(label, button); dialog.append(head, body); doc.body.append(dialog);
103
+ dialog.addEventListener('cancel', event => { event.preventDefault(); close(); });
104
+ dialog.addEventListener('click', event => {
105
+ if (event.target !== dialog) return;
106
+ const rect = dialog.getBoundingClientRect();
107
+ if (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom) close();
108
+ });
109
+ return {
110
+ dialog,
111
+ setContent(...content) { if (!disposed) body.replaceChildren(...content); },
112
+ open(target) {
113
+ if (disposed) return;
114
+ cancelClosing?.(); cancelClosing = null;
115
+ if (dialog.open) return;
116
+ fallbackOpener = target ?? doc.activeElement;
117
+ dialog.showModal(); button.focus();
118
+ },
119
+ close,
120
+ dispose() { if (disposed) return; close({ restoreFocus: false, immediate: true }); disposed = true; dialog.remove(); },
121
+ };
122
+ }
123
+
69
124
  /** A notice with a short label, like 接続範囲 on the organization screens. */
70
125
  export function workspaceNotice(doc, { label, text, tone = 'info', role } = {}) {
71
126
  const notice = el(doc, 'div', { className: `bb-ws-notice is-${tone}`, attrs: { role: role ?? (tone === 'info' ? undefined : 'alert') } });