@unson/brainbase-mcp 0.50.1 → 0.50.3

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.
@@ -180,7 +180,8 @@ export interface MeetingMinutesListOptions {
180
180
  readonly cursor?: string;
181
181
  }
182
182
  /**
183
- * One listing page. `meetings` carries meeting and minutes-document summaries
183
+ * One listing page, ordered by scheduled_at descending, then undated imports
184
+ * by created_at descending (meeting_id breaks ties). `meetings` carries meeting and minutes-document summaries
184
185
  * only — never a minutes version body. The body is read through get_meeting /
185
186
  * the detail endpoint. `next_cursor` is present only while more readable
186
187
  * meetings follow the page.
@@ -764,10 +764,15 @@ export function createMeetingMinutesStore(options) {
764
764
  async function listMeetingsPage(context, options) {
765
765
  const { limit, startAfter } = normalizeListOptions(options);
766
766
  const snapshot = await readSnapshot();
767
- const meetings = snapshot.meetings;
768
- // Meetings are only ever appended, so their stored order is stable and a
769
- // cursor can resume after a known meeting_id. An unknown cursor cannot be
770
- // resumed safely, so it is rejected rather than silently restarted.
767
+ // Page the newest meeting dates first; undated imports follow by creation
768
+ // time. The ID tie-breaker keeps equal timestamps deterministic. Resume by
769
+ // ID so newly inserted meetings before the cursor cannot shift later pages.
770
+ const meetings = [...snapshot.meetings].sort((left, right) => {
771
+ if (Boolean(left.scheduled_at) !== Boolean(right.scheduled_at))
772
+ return left.scheduled_at ? -1 : 1;
773
+ const byDate = Date.parse(right.scheduled_at ?? right.created_at) - Date.parse(left.scheduled_at ?? left.created_at);
774
+ return byDate || right.meeting_id.localeCompare(left.meeting_id);
775
+ });
771
776
  let index = 0;
772
777
  if (startAfter !== undefined) {
773
778
  const found = meetings.findIndex((meeting) => meeting.meeting_id === startAfter);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.1",
3
+ "version": "0.50.3",
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",
@@ -644,5 +644,5 @@
644
644
  "url": "https://github.com/Unson-LLC/brainbase/issues"
645
645
  },
646
646
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
647
- "gitHead": "75bd4a34f5092032688284d857badc7d8984cd73"
647
+ "gitHead": "824896b5d5764f28f8dba870a683de9b2f78938a"
648
648
  }
@@ -133,7 +133,13 @@
133
133
  --bb-search-band-chevron-width: 10px;
134
134
  --bb-search-band-chevron-height: 6px;
135
135
  --bb-search-band-chevron-stroke: 1.2;
136
- --bb-search-band-header-height: 44px;
136
+ --bb-page-title-font-size: 20px;
137
+ --bb-page-title-line-height: 28px;
138
+ --bb-page-title-font-weight: 600;
139
+ --bb-page-header-padding-top: var(--bb-space-3);
140
+ --bb-page-header-padding-bottom: var(--bb-space-4);
141
+ --bb-page-header-height: calc(var(--bb-page-title-line-height) + var(--bb-page-header-padding-top) + var(--bb-page-header-padding-bottom));
142
+ --bb-search-band-header-height: var(--bb-page-header-height);
137
143
  --bb-search-band-scope-padding: 13px;
138
144
  --bb-search-band-scope-viewport-reserve: 192px;
139
145
  --bb-search-band-scope-popup-width: 260px;
package/ui/inbox.css CHANGED
@@ -273,3 +273,52 @@ a.bb-inbox-title:focus-visible {
273
273
  }
274
274
 
275
275
  .bb-inbox-tabs { margin: 0 0 var(--bb-space-4); }
276
+
277
+ /* Opt-in compact cards. Business state and actions still belong to the host port. */
278
+ .bb-inbox.is-cards { min-width: 0; }
279
+ .bb-inbox.is-cards .bb-inbox-card-toolbar { position: sticky; top: var(--bb-page-header-height); z-index: 17; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--bb-space-2) var(--bb-space-4); margin-bottom: var(--bb-space-5); background: var(--bb-color-canvas); border-bottom: 1px solid var(--bb-color-border); }
280
+ .bb-inbox.is-cards .bb-inbox-tabs { min-width: 0; margin: 0; flex-shrink: 0; }
281
+ .bb-inbox-card-filters { display: flex; flex-wrap: wrap; gap: var(--bb-space-1); padding-bottom: var(--bb-space-1); }
282
+ .bb-inbox-card-filters .bb-ws-button { min-height: var(--bb-control-small-height); padding: var(--bb-space-1) var(--bb-space-2); border: 1px solid var(--bb-color-border); border-radius: var(--bb-radius-pill); background: var(--bb-color-panel); font-size: 12px; }
283
+ .bb-inbox-card-filters .bb-ws-button[aria-pressed="true"] { background: var(--bb-color-accent); color: var(--bb-color-action-text); border-color: var(--bb-color-accent); }
284
+ .bb-inbox-card-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--bb-space-3); }
285
+ .bb-inbox.is-cards .bb-inbox-group-title { margin: 0; font-size: 15px; color: var(--bb-color-ink); }
286
+ .bb-inbox-group-count { font-size: 12px; color: var(--bb-color-muted); }
287
+ .bb-inbox.is-cards .bb-inbox-list { display: grid; gap: var(--bb-space-3); }
288
+ .bb-inbox-card { min-width: 0; padding: var(--bb-space-4); background: var(--bb-color-panel); border: 1px solid var(--bb-color-border); border-radius: var(--bb-radius-md); }
289
+ .bb-inbox-card-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--bb-space-4); }
290
+ .bb-inbox-card .bb-inbox-row-main { flex: 1; min-width: 0; }
291
+ .bb-inbox-card-heading { margin: 0 0 var(--bb-space-2); font-size: 15px; }
292
+ .bb-inbox-card-title { margin: 0; padding: 0; border: 0; background: transparent; color: var(--bb-color-ink); font: inherit; font-weight: var(--bb-font-weight-medium); text-align: left; cursor: pointer; overflow-wrap: anywhere; }
293
+ .bb-inbox-card :is(.bb-inbox-facts, .bb-inbox-meta) { margin-top: var(--bb-space-2); }
294
+ .bb-inbox-card .bb-inbox-row-actions { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; gap: var(--bb-space-2); }
295
+ .bb-inbox-card .bb-ws-button { min-height: var(--bb-control-compact-height); font-size: 12px; white-space: nowrap; }
296
+ .bb-inbox-card .bb-inbox-card-detail { margin-top: var(--bb-space-4); padding-top: var(--bb-space-4); border-top: 1px solid var(--bb-color-border); }
297
+ .bb-inbox-card-detail[hidden] { display: none; }
298
+ .bb-inbox-card-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--bb-space-3); margin-bottom: var(--bb-space-3); }
299
+ .bb-inbox-card-detail-head h4 { margin: 0; font-size: 13px; font-weight: var(--bb-font-weight-medium); }
300
+ .bb-inbox-card-detail p { font-size: 13px; overflow-wrap: anywhere; }
301
+ .bb-inbox-card-detail-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--bb-space-3); margin-top: var(--bb-space-4); }
302
+ .bb-inbox-source-link { color: var(--bb-color-action); font-size: 12px; text-underline-offset: 3px; margin-right: auto; }
303
+ .bb-inbox-card :is(.bb-inbox-fact dd, .bb-inbox-meta) { overflow-wrap: anywhere; }
304
+ .bb-inbox-card .bb-inbox-confirm { margin: 0; flex: 1; min-width: 0; }
305
+ .bb-inbox-card .bb-inbox-later-menu { display: flex; flex-wrap: wrap; gap: var(--bb-space-2); margin-top: var(--bb-space-3); }
306
+ .bb-inbox.is-cards .bb-inbox-group { scroll-margin-top: calc(var(--bb-page-header-height) + var(--bb-tab-height)); }
307
+ .bb-inbox-card :is(button, a):focus-visible { outline: 2px solid var(--bb-color-focus); outline-offset: 3px; }
308
+ @media (max-width: 760px) {
309
+ .bb-inbox.is-cards .bb-inbox-card-toolbar { gap: var(--bb-space-2); }
310
+ .bb-inbox.is-cards .bb-inbox-tabs { flex-shrink: 1; width: 100%; }
311
+ .bb-inbox-card-summary { flex-direction: column; align-items: stretch; }
312
+ .bb-inbox-card .bb-inbox-row-actions { justify-content: flex-start; }
313
+ .bb-inbox-card-detail-footer .bb-inbox-row-actions { justify-content: flex-end; margin-left: auto; }
314
+ }
315
+ @media (prefers-reduced-motion: reduce) {
316
+ .bb-inbox.is-cards *, .bb-inbox.is-cards *::after { transition: none; animation: none; }
317
+ }
318
+ .bb-inbox.is-cards .bb-inbox-list { border: 0; border-radius: 0; overflow: visible; background: transparent; }
319
+ .bb-inbox-card .bb-inbox-facts { display: flex; flex-wrap: wrap; gap: var(--bb-space-2) var(--bb-space-4); }
320
+ .bb-inbox-card .bb-inbox-fact { display: flex; align-items: baseline; gap: var(--bb-space-2); }
321
+ .bb-inbox-card .bb-inbox-fact :is(dt, dd) { margin: 0; font-size: 12px; }
322
+ .bb-inbox-card .bb-inbox-meta { display: flex; flex-wrap: wrap; gap: var(--bb-space-3); }
323
+ .bb-inbox-card-detail-footer > .bb-inbox-row-actions { width: auto; flex: 0 1 auto; }
324
+ .bb-inbox.is-cards :is(.bb-inbox-card, button, a, [tabindex]) { scroll-margin-top: calc(var(--bb-page-header-height) + var(--bb-inbox-toolbar-height, var(--bb-tab-height)) + var(--bb-space-2)); }
package/ui/inbox.js CHANGED
@@ -34,6 +34,7 @@ export const INBOX_GROUP_LABELS = Object.freeze({
34
34
  const GROUPS = Object.keys(INBOX_GROUP_LABELS);
35
35
  const TABS = ['waiting', 'notices'];
36
36
  const VIEWS = ['waiting', 'later', 'cleared'];
37
+ let inboxInstance = 0;
37
38
 
38
39
  /** The three sections of the 今日決めること layout, in order. */
39
40
  export const INBOX_TODAY_SECTIONS = Object.freeze([
@@ -309,7 +310,9 @@ export function createInboxUI({
309
310
  if (!doc || typeof doc.createElement !== 'function') throw new Error('document_unavailable');
310
311
  const crumbs = Array.isArray(page?.crumbs) ? page.crumbs : ['受信箱'];
311
312
  const readNow = () => (typeof now === 'function' ? now() : now);
312
- const layout = layoutOption === 'today' ? 'today' : 'tabs';
313
+ const layout = ['today', 'cards'].includes(layoutOption) ? layoutOption : 'tabs';
314
+ const cards = layout === 'cards';
315
+ const instanceId = `bb-inbox-${++inboxInstance}`;
313
316
  const undoWindowMs = Number.isFinite(undoWindowMsOption) && undoWindowMsOption > 0 ? undoWindowMsOption : 0;
314
317
  const doneShownMs = Number.isFinite(doneShownMsOption) && doneShownMsOption >= 0 ? doneShownMsOption : 1100;
315
318
  const timers = {
@@ -329,6 +332,9 @@ export function createInboxUI({
329
332
  reason: null,
330
333
  dispositions: new Map(),
331
334
  laterOpen: null,
335
+ expanded: null,
336
+ filter: 'all',
337
+ detailOpener: 'opener',
332
338
  notice: null,
333
339
  noticeOwner: null,
334
340
  notices: null,
@@ -350,6 +356,7 @@ export function createInboxUI({
350
356
  const doneTimers = new Set();
351
357
  // The element to focus once the next render is in place (the confirm band's buttons).
352
358
  let focusTarget = null;
359
+ let toolbarObserver = null;
353
360
  // One live region kept across renders, so a changed count or a result is read out once.
354
361
  const announcer = el(doc, 'p', { className: 'bb-inbox-announcer bb-ws-visually-hidden', attrs: { role: 'status', 'aria-live': 'polite' } });
355
362
  let lastAnnouncedCount = null;
@@ -384,10 +391,11 @@ export function createInboxUI({
384
391
  if (!state.result) return { count: null, unreadable: [] };
385
392
  const current = readNow();
386
393
  const base = countInboxWaiting({ ...state.result, dispositions: [...state.dispositions.values()] }, current);
394
+ if (cards && base.count !== null) base.count = cardItems().filter(item => !activeDisposition(item, state.dispositions, current)).reduce((sum, item) => sum + unitsOf(item), 0);
387
395
  // Rows waiting to be sent, sent, or showing their result are not waiting any more.
388
396
  const gone = new Set([...state.pending.keys(), ...state.sent, ...state.done.keys()]);
389
397
  if (gone.size === 0 || base.count === null) return base;
390
- const rows = new Map(readableItems(state.result).map((item) => [item.id, item]));
398
+ const rows = new Map((cards ? cardItems() : readableItems(state.result)).map((item) => [item.id, item]));
391
399
  let count = base.count;
392
400
  for (const id of gone) {
393
401
  const row = rows.get(id);
@@ -606,7 +614,7 @@ export function createInboxUI({
606
614
  band.append(el(doc, 'p', { className: 'bb-inbox-confirm-text', text: textOf(action.confirm) }));
607
615
  const buttons = el(doc, 'div', { className: 'bb-inbox-row-actions' });
608
616
  const send = workspaceButton(doc, {
609
- text: action.label,
617
+ text: cards ? cardActionLabel(item, action) : action.label,
610
618
  variant: action.tone === 'danger' ? 'danger' : 'primary',
611
619
  onClick: () => {
612
620
  state.confirming = null;
@@ -645,6 +653,201 @@ export function createInboxUI({
645
653
  }
646
654
  }
647
655
 
656
+ function cardActionLabel(item, action) {
657
+ if (action.id === 'deny') return '却下';
658
+ if (action.id === 'publish-suggested') return '公開';
659
+ if (action.id === 'open') return item.group === 'approve' ? '申請へ' : item.kind === 'meeting_triage' ? '振り分けへ' : '本体へ';
660
+ return action.label;
661
+ }
662
+
663
+ function cardItems() {
664
+ const readable = new Set((state.result?.sources ?? []).filter(source => source.status === 'ok').map(source => source.kind));
665
+ return (state.result?.items ?? []).filter(item => readable.has(item.kind));
666
+ }
667
+
668
+ function cardSourceProblem(source) {
669
+ return !['ok', 'not_collected'].includes(source.status);
670
+ }
671
+
672
+ function cardActions(item) {
673
+ return typeof port.runAction === 'function'
674
+ ? (Array.isArray(item.actions) ? item.actions : []).filter(action => textOf(action?.id) && textOf(action?.label))
675
+ : [];
676
+ }
677
+
678
+ function selectCard(item, action = null, opener = 'opener') {
679
+ if (state.running.has(item.id)) return;
680
+ state.expanded = state.expanded === item.id && !action ? null : item.id;
681
+ state.detailOpener = opener;
682
+ state.confirming = action && textOf(action.confirm)
683
+ ? { itemId: item.id, actionId: action.id, revision: item.revision ?? null }
684
+ : null;
685
+ state.focus = { itemId: item.id, target: !state.expanded ? opener : action && textOf(action.confirm) ? 'confirm' : 'detail' };
686
+ render();
687
+ }
688
+
689
+ function renderCardTabs(shown) {
690
+ const bar = el(doc, 'div', { className: 'bb-inbox-card-toolbar' });
691
+ const tablist = el(doc, 'div', { className: 'bb-inbox-tabs', attrs: { role: 'tablist', 'aria-label': '受信箱' } });
692
+ workspaceTabStrip(tablist, { memoryKey: `${instanceId}-tabs` });
693
+ const definitions = [
694
+ ['waiting', '対応待ち', { tab: 'waiting', view: 'waiting' }],
695
+ ['notices', 'お知らせ', { tab: 'notices', view: 'waiting' }],
696
+ ['later', '保留', { tab: 'waiting', view: 'later' }],
697
+ ['cleared', '対応済', { tab: 'waiting', view: 'cleared' }],
698
+ ];
699
+ const selectedId = state.route.tab === 'notices' ? 'notices' : state.route.view;
700
+ for (const [id, label, route] of definitions) {
701
+ const tab = el(doc, 'button', { className: `bb-inbox-tab${id === selectedId ? ' is-selected' : ''}`, text: label,
702
+ attrs: { id: `${instanceId}-tab-${id}`, type: 'button', role: 'tab', 'aria-selected': String(id === selectedId), 'aria-controls': `${instanceId}-panel` } });
703
+ const unreadable = state.result?.sources?.some(cardSourceProblem);
704
+ const count = id === 'notices' ? state.notices?.phase === 'ok' ? state.notices.items.length : null
705
+ : shown ? shown[id].filter(item => !state.done.has(item.id)).reduce((sum, item) => sum + unitsOf(item), 0) : null;
706
+ if (count !== null) tab.append(el(doc, 'span', { className: 'bb-inbox-count bb-ws-tab-count', text: `${count}${id !== 'notices' && unreadable ? '+' : ''}` }));
707
+ tab.addEventListener('click', () => { state.filter = 'all'; state.expanded = null; state.focus = { target: 'tab', id }; go(route); });
708
+ if (state.focus?.target === 'tab' && state.focus.id === id) focusTarget = tab;
709
+ tablist.append(tab);
710
+ }
711
+ bar.append(tablist);
712
+ if (state.route.tab !== 'notices') {
713
+ const filters = el(doc, 'div', { className: 'bb-inbox-card-filters', attrs: { role: 'group', 'aria-label': '種類で絞り込む' } });
714
+ for (const [id, label] of [['all', 'すべて'], ['approve', '承認'], ['answer', '会議振り分け'], ['triage', '記憶・取り込み'], ['task', 'タスク']]) {
715
+ const button = workspaceButton(doc, { text: label, variant: 'quiet', attrs: { 'aria-pressed': String(state.filter === id) },
716
+ onClick: () => { state.filter = id; state.expanded = null; state.focus = { target: 'filter', filter: id }; render(); } });
717
+ if (state.focus?.target === 'filter' && state.focus.filter === id) focusTarget = button;
718
+ filters.append(button);
719
+ }
720
+ bar.append(filters);
721
+ }
722
+ return bar;
723
+ }
724
+
725
+ function renderCard(item, view) {
726
+ const running = state.running.has(item.id);
727
+ const done = state.done.get(item.id);
728
+ const expanded = state.expanded === item.id;
729
+ const actions = cardActions(item);
730
+ const card = el(doc, 'article', { className: `bb-inbox-card${expanded ? ' is-expanded' : ''}`, attrs: { role: 'listitem', 'data-inbox-item': item.id, 'aria-busy': String(running) } });
731
+ const summary = el(doc, 'div', { className: 'bb-inbox-card-summary' });
732
+ const main = el(doc, 'div', { className: 'bb-inbox-row-main' });
733
+ if (item.blocking) main.append(el(doc, 'span', { className: 'bb-inbox-blocking', text: '対応が必要' }));
734
+ const opener = workspaceButton(doc, { text: item.title, variant: 'quiet', attrs: { class: 'bb-inbox-card-title', 'aria-expanded': String(expanded), 'aria-controls': `${instanceId}-detail-${item.id}` }, onClick: () => selectCard(item) });
735
+ if (state.focus?.itemId === item.id && state.focus.target === 'opener') focusTarget = opener;
736
+ const cardHeading = el(doc, 'h3', { className: 'bb-inbox-card-heading' });
737
+ cardHeading.append(opener); main.append(cardHeading);
738
+ const facts = factsOf(item);
739
+ if (facts.length) main.append(renderFacts(facts));
740
+ const meta = el(doc, 'div', { className: 'bb-inbox-meta' });
741
+ const due = inboxDueLabel(item.dueAt, readNow());
742
+ if (due) meta.append(el(doc, 'span', { className: `bb-inbox-due${due.state === 'later' ? '' : ` is-${due.state}`}`, text: due.text }));
743
+ const received = relativeTime(item.receivedAt, readNow());
744
+ if (received) meta.append(el(doc, 'span', { text: received }));
745
+ const disposition = state.dispositions.get(item.id);
746
+ if (view === 'later' && disposition?.until) meta.append(el(doc, 'span', { text: `${formatShort(disposition.until)}まで保留` }));
747
+ if (meta.children.length) main.append(meta);
748
+ summary.append(main);
749
+ const controls = el(doc, 'div', { className: 'bb-inbox-row-actions' });
750
+ if (done) controls.append(el(doc, 'span', { className: 'bb-inbox-done', text: done }));
751
+ else {
752
+ const primaryButton = workspaceButton(doc, { text: '確認', variant: 'primary', disabled: running,
753
+ attrs: { 'aria-expanded': String(expanded), 'aria-controls': `${instanceId}-detail-${item.id}` }, onClick: () => selectCard(item, null, 'row-primary') });
754
+ if (state.focus?.itemId === item.id && state.focus.target === 'row-primary') focusTarget = primaryButton;
755
+ controls.append(primaryButton);
756
+ if (view === 'waiting') {
757
+ const deny = actions.find(action => action.id === 'deny');
758
+ if (deny) {
759
+ const denyButton = workspaceButton(doc, { text: '却下', variant: 'danger', disabled: running, onClick: () => selectCard(item, deny, 'row-deny') });
760
+ if (state.focus?.itemId === item.id && state.focus.target === 'row-deny') focusTarget = denyButton;
761
+ controls.append(denyButton);
762
+ }
763
+ const laterButton = workspaceButton(doc, { text: '保留', variant: 'quiet', disabled: running, attrs: { 'aria-expanded': String(state.laterOpen === item.id) }, onClick: () => { state.laterOpen = state.laterOpen === item.id ? null : item.id; state.focus = { itemId: item.id, target: 'row-later' }; render(); } });
764
+ if (state.focus?.itemId === item.id && state.focus.target === 'row-later') focusTarget = laterButton;
765
+ controls.append(laterButton,
766
+ workspaceButton(doc, { text: '対応済', variant: 'quiet', disabled: running, onClick: () => void dispose(item, { state: 'cleared', revision: item.revision ?? null }, '対応済にできませんでした') }));
767
+ } else controls.append(workspaceButton(doc, { text: '再開', variant: 'quiet', onClick: () => void dispose(item, { state: 'open' }, '対応待ちに戻せませんでした') }));
768
+ }
769
+ summary.append(controls); card.append(summary);
770
+ if (state.laterOpen === item.id && !running) card.append(renderLaterMenu(item));
771
+ const detail = el(doc, 'section', { className: 'bb-inbox-card-detail', attrs: { id: `${instanceId}-detail-${item.id}`, 'aria-label': '内容の確認', hidden: !expanded } });
772
+ if (expanded) {
773
+ const closeDetail = () => { state.expanded = null; state.confirming = null; state.focus = { itemId: item.id, target: state.detailOpener }; render(); };
774
+ detail.addEventListener('keydown', event => { if (event.key === 'Escape') { event.preventDefault(); closeDetail(); } });
775
+ const head = el(doc, 'div', { className: 'bb-inbox-card-detail-head' });
776
+ const heading = el(doc, 'h4', { text: '内容の確認', attrs: { tabindex: '-1' } });
777
+ if (state.focus?.itemId === item.id && state.focus.target === 'detail') focusTarget = heading;
778
+ head.append(heading, workspaceButton(doc, { text: '閉じる', variant: 'quiet', onClick: closeDetail })); detail.append(head);
779
+ if (textOf(item.detail)) detail.append(el(doc, 'p', { text: item.detail }));
780
+ if (facts.length) detail.append(renderFacts(facts));
781
+ const footer = el(doc, 'div', { className: 'bb-inbox-card-detail-footer' });
782
+ const href = textOf(item.href);
783
+ if (href) {
784
+ const source = el(doc, 'a', { className: 'bb-inbox-source-link', text: '本体を開く', attrs: { href } });
785
+ source.addEventListener('click', event => openItem(item, event)); footer.append(source);
786
+ }
787
+ const confirming = confirmingAction(item, actions);
788
+ if (confirming) footer.append(renderConfirm(item, confirming));
789
+ else if (view === 'waiting' && !done) {
790
+ const buttons = el(doc, 'div', { className: 'bb-inbox-row-actions' });
791
+ for (const action of actions) {
792
+ const button = workspaceButton(doc, { text: cardActionLabel(item, action), disabled: running, variant: action.tone === 'danger' ? 'danger' : 'primary', onClick: () => pressFromRow(item, action) });
793
+ if (state.focus?.itemId === item.id && state.focus.target === 'action' && state.focus.actionId === action.id) focusTarget = button;
794
+ buttons.append(button);
795
+ }
796
+ footer.append(buttons);
797
+ }
798
+ detail.append(footer);
799
+ }
800
+ card.append(detail);
801
+ return card;
802
+ }
803
+
804
+ function matchesCardFilter(item) {
805
+ if (state.filter === 'all') return true;
806
+ if (state.filter === 'approve') return item.group === 'approve';
807
+ if (state.filter === 'answer') return item.kind === 'meeting_triage';
808
+ if (state.filter === 'triage') return item.kind === 'memory_candidates';
809
+ return ['assigned_task', 'waiting_task'].includes(item.kind);
810
+ }
811
+
812
+ function renderCards(shown) {
813
+ const panel = el(doc, 'div', { className: 'bb-inbox-card-panel', attrs: { id: `${instanceId}-panel`, role: 'tabpanel', 'aria-labelledby': `${instanceId}-tab-${state.route.tab === 'notices' ? 'notices' : state.route.view}` } });
814
+ if (state.route.tab === 'notices') { panel.append(renderNotices()); return panel; }
815
+ const which = state.route.view;
816
+ let any = false;
817
+ const groups = ['approve', ...GROUPS.filter(group => group !== 'approve')];
818
+ for (const group of groups) {
819
+ const rows = sortInboxItems(shown[which].filter(item => item.group === group && matchesCardFilter(item)));
820
+ const problems = (state.result.sources ?? []).filter(source => source.group === group && matchesCardFilter(source) && cardSourceProblem(source));
821
+ if (!rows.length && !problems.length) continue;
822
+ any = true;
823
+ const section = el(doc, 'section', { className: 'bb-inbox-group', attrs: { 'aria-label': INBOX_GROUP_LABELS[group] } });
824
+ const heading = el(doc, 'div', { className: 'bb-inbox-card-group-head' });
825
+ heading.append(el(doc, 'h2', { className: 'bb-inbox-group-title', text: INBOX_GROUP_LABELS[group] }), el(doc, 'span', { className: 'bb-inbox-group-count', text: `${rows.length}件` }));
826
+ section.append(heading);
827
+ const list = el(doc, 'div', { className: 'bb-inbox-list', attrs: { role: 'list' } });
828
+ rows.forEach(item => list.append(renderCard(item, which))); section.append(list);
829
+ problems.forEach(source => section.append(sourceLine(source))); panel.append(section);
830
+ }
831
+ if (state.filter === 'all') {
832
+ const unknown = shown[which].filter(item => !GROUPS.includes(item.group));
833
+ const problems = (state.result.sources ?? []).filter(source => !GROUPS.includes(source.group) && cardSourceProblem(source));
834
+ if (unknown.length || problems.length) {
835
+ any = true;
836
+ const section = el(doc, 'section', { className: 'bb-inbox-group', attrs: { 'aria-label': 'その他' } });
837
+ section.append(el(doc, 'h2', { className: 'bb-inbox-group-title', text: 'その他' }));
838
+ const list = el(doc, 'div', { className: 'bb-inbox-list', attrs: { role: 'list' } });
839
+ unknown.forEach(item => list.append(renderCard(item, which))); section.append(list);
840
+ problems.forEach(source => section.append(sourceLine(source))); panel.append(section);
841
+ }
842
+ }
843
+ if (!any) panel.append(el(doc, 'p', { className: 'bb-inbox-empty', text: state.filter !== 'all' ? '該当する項目はありません。' : which === 'later' ? '保留した項目はありません。' : which === 'cleared' ? '対応済の項目はありません。' : '待っているものはありません。' }));
844
+ if (which === 'waiting') {
845
+ const uncollected = (state.result.uncollected ?? []).filter(textOf);
846
+ if (uncollected.length) panel.append(el(doc, 'p', { className: 'bb-inbox-uncollected', text: `まだ集めていない種類があります(${uncollected.join('・')})。件数には入っていません。` }));
847
+ }
848
+ return panel;
849
+ }
850
+
648
851
  function renderTabs(waitingCount) {
649
852
  const bar = el(doc, 'div', { className: 'bb-inbox-tabs', attrs: { role: 'tablist', 'aria-label': '受信箱' } });
650
853
  workspaceTabStrip(bar, { memoryKey: 'inbox-tabs' });
@@ -788,7 +991,7 @@ export function createInboxUI({
788
991
 
789
992
  function partition(now) {
790
993
  const shown = { waiting: [], later: [], cleared: [] };
791
- for (const item of readableItems(state.result)) {
994
+ for (const item of cards ? cardItems() : readableItems(state.result)) {
792
995
  if (state.pending.has(item.id) || state.sent.has(item.id)) continue;
793
996
  const disposition = activeDisposition(item, state.dispositions, now);
794
997
  shown[disposition ? disposition.state : 'waiting'].push(item);
@@ -915,11 +1118,12 @@ export function createInboxUI({
915
1118
  const waitingCount = shown ? shown.waiting.filter(stillWaiting).reduce((sum, item) => sum + unitsOf(item), 0) : null;
916
1119
  const isToday = layout === 'today';
917
1120
  const view = el(doc, 'div', {
918
- className: `bb-inbox${isToday ? ' is-today' : ''}`,
1121
+ className: `bb-inbox${isToday ? ' is-today' : ''}${cards ? ' is-cards' : ''}`,
919
1122
  attrs: { 'data-contract-version': INBOX_UI_CONTRACT_VERSION },
920
1123
  });
921
- view.append(workspacePageHeader(doc, { crumbs, title: '受信箱', source: page?.source ?? undefined }));
922
- if (!isToday) view.append(renderTabs(waitingCount));
1124
+ if (!cards) view.append(workspacePageHeader(doc, { crumbs, title: '受信箱', source: page?.source ?? undefined }));
1125
+ if (cards) view.append(renderCardTabs(shown));
1126
+ else if (!isToday) view.append(renderTabs(waitingCount));
923
1127
  if (isToday && shown) {
924
1128
  const decideGroups = INBOX_TODAY_SECTIONS[0].groups;
925
1129
  const decideCount = shown.waiting
@@ -944,7 +1148,9 @@ export function createInboxUI({
944
1148
  const undoBand = renderUndoBand();
945
1149
  if (undoBand) view.append(undoBand);
946
1150
  if (state.notice) view.append(workspaceNotice(doc, { label: 'できませんでした', text: state.notice, tone: 'warning', role: 'alert' }));
947
- if (!isToday && state.route.tab === 'notices') {
1151
+ if (cards && shown) {
1152
+ view.append(renderCards(shown));
1153
+ } else if (!isToday && state.route.tab === 'notices') {
948
1154
  view.append(renderNotices());
949
1155
  } else if (state.phase === 'error' && !shown) {
950
1156
  view.append(workspaceErrorCard(doc, { title: '受信箱を読めませんでした', message: `理由: ${reasonText(state.reason)}。0件ではありません。`, onRetry: () => void load(), open: true }));
@@ -952,9 +1158,19 @@ export function createInboxUI({
952
1158
  if (isToday) view.append(state.route.view === 'waiting' ? renderTodayWaiting(shown) : renderSet(shown, state.route.view));
953
1159
  else view.append(state.route.view === 'waiting' ? renderWaiting(shown) : renderSet(shown, state.route.view));
954
1160
  }
1161
+ toolbarObserver?.disconnect();
955
1162
  root.replaceChildren(view, announcer);
1163
+ if (cards) {
1164
+ const toolbar = view.querySelector?.('.bb-inbox-card-toolbar');
1165
+ const measure = () => {
1166
+ if (toolbar && root.style) root.style.setProperty('--bb-inbox-toolbar-height', `${toolbar.getBoundingClientRect().height}px`);
1167
+ };
1168
+ measure();
1169
+ if (toolbar && typeof globalThis.ResizeObserver === 'function') { toolbarObserver = new globalThis.ResizeObserver(measure); toolbarObserver.observe(toolbar); }
1170
+ }
956
1171
  if (state.focus) {
957
1172
  focusTarget?.focus?.({ preventScroll: true });
1173
+ if (cards) focusTarget?.scrollIntoView?.({ block: 'nearest' });
958
1174
  state.focus = null;
959
1175
  }
960
1176
  }
@@ -967,6 +1183,7 @@ export function createInboxUI({
967
1183
  },
968
1184
  destroy() {
969
1185
  state.destroyed = true;
1186
+ toolbarObserver?.disconnect();
970
1187
  generation += 1;
971
1188
  for (const timerId of doneTimers) timers.clear(timerId);
972
1189
  doneTimers.clear();
@@ -20,6 +20,8 @@ export const MEETING_MINUTES_UI_CONTRACT_VERSION = 'brainbase.meeting-minutes-ui
20
20
 
21
21
  const WEEKDAYS = ['日', '月', '火', '水', '木', '金', '土'];
22
22
  const TOKYO = 'Asia/Tokyo';
23
+ // The screen chooses 50; the core's independent default remains 100.
24
+ const LIST_PAGE_SIZE = 50;
23
25
  const SORTS = Object.freeze([
24
26
  { value: 'scheduled-desc', label: '会議の日時が新しい順' },
25
27
  { value: 'scheduled-asc', label: '会議の日時が古い順' },
@@ -713,6 +715,8 @@ export function createMeetingMinutesUI({
713
715
  minutesId: null,
714
716
  versionId: null,
715
717
  loading: false,
718
+ nextCursor: null,
719
+ moreError: null,
716
720
  listError: null,
717
721
  detailError: null,
718
722
  filters: { ...EMPTY_FILTERS },
@@ -727,6 +731,7 @@ export function createMeetingMinutesUI({
727
731
  };
728
732
  let disposed = false;
729
733
  let listRequestGeneration = 0;
734
+ let seenListCursors = new Set();
730
735
  let detailRequestGeneration = 0;
731
736
  let createReasonSequence = 0;
732
737
  let connectionsSlot = null;
@@ -1450,6 +1455,19 @@ export function createMeetingMinutesUI({
1450
1455
  return item;
1451
1456
  }
1452
1457
 
1458
+ function appendMore(parent) {
1459
+ if (!state.nextCursor) return;
1460
+ if (state.moreError) {
1461
+ parent.append(makeElement(doc, 'p', {
1462
+ className: 'bb-minutes-error', textContent: state.moreError, attrs: { role: 'alert' },
1463
+ }));
1464
+ parent.append(button(doc, '一覧を再読み込み', () => loadMeetings({ restoreFocus: true })));
1465
+ }
1466
+ parent.append(button(doc, state.loading ? '読み込んでいます。' : 'もっと見る', () => loadMeetings({ append: true }), {
1467
+ disabled: state.loading,
1468
+ }));
1469
+ }
1470
+
1453
1471
  function renderList() {
1454
1472
  clear(listPane);
1455
1473
  const head = makeElement(doc, 'div', { className: 'bb-minutes-pane-head' });
@@ -1464,7 +1482,7 @@ export function createMeetingMinutesUI({
1464
1482
  const narrowed = clientFiltersActive();
1465
1483
  head.append(makeElement(doc, 'p', {
1466
1484
  className: 'bb-minutes-sort-note',
1467
- textContent: narrowed ? `${meetings.length}件中${visible.length}件` : `${meetings.length}件`,
1485
+ textContent: `${narrowed ? `${meetings.length}件中${visible.length}件` : `${meetings.length}件`}${state.nextCursor ? '(続きあり・絞り込みは読込済みの会議が対象)' : ''}`,
1468
1486
  }));
1469
1487
  if (compactToolbar) {
1470
1488
  const create = head.querySelector('button');
@@ -1489,17 +1507,20 @@ export function createMeetingMinutesUI({
1489
1507
  : 'まだ議事録はありません。会議を取り込むと、ここに新しい順で並びます。',
1490
1508
  }));
1491
1509
  if (filtersActive() && !compact) listPane.append(button(doc, '条件を外す', () => clearFilters()));
1510
+ appendMore(listPane);
1492
1511
  return;
1493
1512
  }
1494
1513
  if (visible.length === 0) {
1495
- listPane.append(makeElement(doc, 'p', { className: 'bb-minutes-empty', textContent: '条件に合う会議はありません。' }));
1514
+ listPane.append(makeElement(doc, 'p', { className: 'bb-minutes-empty', textContent: state.nextCursor ? '読み込んだ会議に条件に合うものはありません。' : '条件に合う会議はありません。' }));
1496
1515
  if (!compact) listPane.append(button(doc, '条件を外す', () => clearFilters()));
1516
+ appendMore(listPane);
1497
1517
  return;
1498
1518
  }
1499
1519
  const list = makeElement(doc, 'div', { className: 'bb-minutes-meeting-list' });
1500
1520
  if (state.sort === 'updated-desc' && !compact) {
1501
1521
  for (const entry of visible) list.append(renderMeetingRow(entry, { flat: true }));
1502
1522
  listPane.append(list);
1523
+ appendMore(listPane);
1503
1524
  return;
1504
1525
  }
1505
1526
  const updatedOrder = compact && state.sort === 'updated-desc';
@@ -1528,6 +1549,7 @@ export function createMeetingMinutesUI({
1528
1549
  for (const entry of unregistered) list.append(renderMeetingRow(entry));
1529
1550
  }
1530
1551
  listPane.append(list);
1552
+ appendMore(listPane);
1531
1553
  }
1532
1554
 
1533
1555
  function renderRail(version, documentRecord, meeting) {
@@ -1950,33 +1972,33 @@ export function createMeetingMinutesUI({
1950
1972
  detailPane.append(form);
1951
1973
  }
1952
1974
 
1953
- async function loadMeetings({ restoreFocus = false, quiet = false } = {}) {
1975
+ async function loadMeetings({ restoreFocus = false, quiet = false, append = false } = {}) {
1976
+ if (append && (state.loading || !state.nextCursor)) return state.meetings;
1954
1977
  const requestGeneration = ++listRequestGeneration;
1955
1978
  const isCurrentRequest = () => !disposed && requestGeneration === listRequestGeneration;
1956
1979
  state.loading = true;
1980
+ state.moreError = null;
1981
+ if (append) renderList();
1957
1982
  if (!quiet) setStatus('会議一覧を読み込んでいます。');
1958
1983
  try {
1959
- // The list carries no version body and the host caps each page, so even a long
1960
- // history reads as a run of small responses instead of one large one. The cursor
1961
- // walks the append-only meetings to the end and every page is gathered, so the
1962
- // screen still shows every meeting (UNS-264). The first page keeps the bare path
1963
- // so a host without paging keeps answering the single request it always has.
1964
- const collected = [];
1965
- let cursor = null;
1966
- for (let page = 0; ; page += 1) {
1967
- const payload = await call(cursor === null ? '' : `?cursor=${encodeURIComponent(cursor)}`);
1968
- if (!isCurrentRequest()) return state.meetings;
1969
- if (!isRecord(payload) || !Array.isArray(payload.meetings) || payload.absence_confirmed !== true) throw new Error('会議一覧の形式を確認できません。');
1970
- for (const entry of payload.meetings) collected.push(entry);
1971
- const next = typeof payload.next_cursor === 'string' ? payload.next_cursor.trim() : '';
1972
- if (!next || next === cursor || page >= 10000) break;
1973
- cursor = next;
1974
- }
1975
- state.meetings = sortMeetings(collected);
1984
+ const cursor = append ? state.nextCursor : null;
1985
+ const payload = await call(`?limit=${LIST_PAGE_SIZE}${cursor ? `&cursor=${encodeURIComponent(cursor)}` : ''}`);
1986
+ if (!isCurrentRequest()) return state.meetings;
1987
+ if (!isRecord(payload) || !Array.isArray(payload.meetings) || payload.absence_confirmed !== true) throw new Error('会議一覧の形式を確認できません。');
1988
+ if (payload.meetings.some(entry => !isRecord(entry?.meeting) || typeof entry.meeting.meeting_id !== 'string' || !entry.meeting.meeting_id.trim())) throw new Error('会議一覧の形式を確認できません。');
1989
+ if (payload.next_cursor != null && (typeof payload.next_cursor !== 'string' || !payload.next_cursor.trim())) throw new Error('会議一覧の続きの形式を確認できません。');
1990
+ const next = payload.next_cursor ?? null;
1991
+ if (next && (next === cursor || (append && seenListCursors.has(next)))) throw new Error('会議一覧の続きが進みません。再読み込みしてください。');
1992
+ const entries = append ? [...state.meetings, ...payload.meetings] : payload.meetings;
1993
+ const unique = new Map(entries.map(entry => [entry?.meeting?.meeting_id, entry]));
1994
+ state.meetings = sortMeetings([...unique.values()]);
1995
+ state.nextCursor = next;
1996
+ if (!append) seenListCursors = new Set();
1997
+ if (next) seenListCursors.add(next);
1976
1998
  state.listError = null;
1977
1999
  const selectedMeetingStillListed = state.meetingId !== null
1978
2000
  && state.meetings.some((entry) => entry?.meeting?.meeting_id === state.meetingId);
1979
- if (state.meetingId !== null && !selectedMeetingStillListed) {
2001
+ if (state.meetingId !== null && !selectedMeetingStillListed && !append) {
1980
2002
  detailRequestGeneration += 1;
1981
2003
  state.detail = null;
1982
2004
  state.meetingId = null;
@@ -1995,10 +2017,17 @@ export function createMeetingMinutesUI({
1995
2017
  } catch (error) {
1996
2018
  if (!isCurrentRequest()) return state.meetings;
1997
2019
  state.listError = loadErrorMessage(error, '会議一覧を読み込めませんでした。');
2020
+ if (append && !isAccessDenied(error)) {
2021
+ state.moreError = loadErrorMessage(error, '続きの会議を読み込めませんでした。');
2022
+ state.listError = null;
2023
+ setStatus(state.moreError, 'error');
2024
+ return state.meetings;
2025
+ }
1998
2026
  const preserve = preserveLoadedStateOnFailure(error);
1999
2027
  const hadDetail = Boolean(state.detail) || state.meetingId !== null;
2000
2028
  if (!preserve) {
2001
2029
  state.meetings = [];
2030
+ state.nextCursor = null;
2002
2031
  if (hadDetail) {
2003
2032
  detailRequestGeneration += 1;
2004
2033
  state.detail = null;
@@ -2012,7 +2041,7 @@ export function createMeetingMinutesUI({
2012
2041
  if (!preserve && hadDetail) renderDetail(null);
2013
2042
  setStatus(state.listError, 'error');
2014
2043
  } finally {
2015
- if (isCurrentRequest()) state.loading = false;
2044
+ if (isCurrentRequest()) { state.loading = false; renderList(); }
2016
2045
  }
2017
2046
  return state.meetings;
2018
2047
  }
@@ -674,9 +674,9 @@
674
674
  @media (prefers-reduced-motion:reduce) { .bb-ws-combobox-popup { animation: none; } }
675
675
 
676
676
  /* Shared page chrome and on-demand inspectors. Page actions remain in the body. */
677
- .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); }
677
+ .bb-ws-topbar { position: sticky; top: 0; z-index: 18; display: flex; align-items: center; min-height: var(--bb-page-header-height); flex: 0 0 auto; box-sizing: border-box; padding: var(--bb-page-header-padding-top) var(--bb-space-6) var(--bb-page-header-padding-bottom); background: var(--bb-color-canvas); border: 0; }
678
678
  .bb-ws-topbar[hidden] { display: none; }
679
- .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; }
679
+ .bb-ws-topbar h1 { margin: 0; font: var(--bb-page-title-font-weight) var(--bb-page-title-font-size)/var(--bb-page-title-line-height) var(--bb-font-sans); color: var(--bb-color-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
680
680
  .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; }
681
681
  .bb-ws-detail-drawer { padding: 0; }
682
682
  .bb-ws-detail-drawer:not([open]) { display: none; }