@unson/brainbase-mcp 0.23.7 → 0.23.9

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.
@@ -60,6 +60,58 @@
60
60
  justify-self: start;
61
61
  }
62
62
 
63
+ /* Keep the host-level unavailable notice compact until its reason is requested. */
64
+ .bb-wm-unavailable-status {
65
+ color: var(--bb-color-muted);
66
+ font-size: 12px;
67
+ }
68
+
69
+ .bb-wm-unavailable-details {
70
+ min-width: 0;
71
+ }
72
+
73
+ .bb-wm-unavailable-summary {
74
+ width: fit-content;
75
+ max-width: 100%;
76
+ color: var(--bb-color-accent-strong);
77
+ cursor: pointer;
78
+ font-size: 12px;
79
+ font-weight: 680;
80
+ }
81
+
82
+ .bb-wm-unavailable-summary:focus-visible {
83
+ outline: 2px solid var(--bb-color-accent);
84
+ outline-offset: 2px;
85
+ }
86
+
87
+ .bb-wm-unavailable-reason-list {
88
+ display: grid;
89
+ gap: var(--bb-space-2);
90
+ margin: var(--bb-space-2) 0 0;
91
+ padding: var(--bb-space-2) 0 0;
92
+ border-top: 1px solid var(--bb-color-border);
93
+ list-style: none;
94
+ }
95
+
96
+ .bb-wm-unavailable-reason {
97
+ display: grid;
98
+ grid-template-columns: minmax(120px, .8fr) minmax(0, 2fr);
99
+ gap: var(--bb-space-2);
100
+ min-width: 0;
101
+ font-size: 12px;
102
+ }
103
+
104
+ .bb-wm-unavailable-reason-label {
105
+ color: var(--bb-color-ink);
106
+ font-weight: 680;
107
+ }
108
+
109
+ .bb-wm-unavailable-reason-copy {
110
+ min-width: 0;
111
+ color: var(--bb-color-muted);
112
+ overflow-wrap: anywhere;
113
+ }
114
+
63
115
  /* First-user registration stays in the empty-state notice, beside the fact it affects. */
64
116
  .bb-wm-registration-form {
65
117
  display: grid;
@@ -216,6 +268,11 @@
216
268
  grid-template-columns: minmax(0, 1fr);
217
269
  }
218
270
 
271
+ .bb-wm-unavailable-reason {
272
+ grid-template-columns: minmax(0, 1fr);
273
+ gap: 2px;
274
+ }
275
+
219
276
  .bb-wm-registration-status {
220
277
  grid-column: auto;
221
278
  }
@@ -44,6 +44,12 @@ const UNREADABLE_LABELS = Object.freeze({
44
44
  invalid_input: '変数の定義と合わない',
45
45
  not_found: '参照先が見つからない',
46
46
  });
47
+ const UNAVAILABLE_SECTION_LABELS = Object.freeze({
48
+ variables: '変数',
49
+ models: 'モデル',
50
+ observations: '観測',
51
+ adoptions: 'モデルの採用',
52
+ });
47
53
 
48
54
  function getDocument(explicit) {
49
55
  const value = explicit ?? (typeof document === 'undefined' ? null : document);
@@ -139,7 +145,7 @@ export function normalizeWorldModelSection(section, payload) {
139
145
 
140
146
  function unreadableMessage(unreadable) {
141
147
  const reasons = unreadable.codes.map((code) => UNREADABLE_LABELS[code] ?? code).join('、');
142
- return `読めない記録が${unreadable.count}件あります${reasons ? `(${reasons})` : ''}。読めた記録だけを表示しています。`;
148
+ return `記録件数は未確認です。0件とは確認できません。読めない記録が${unreadable.count}件あります${reasons ? `(${reasons})` : ''}。読めた記録だけを表示しています。`;
143
149
  }
144
150
 
145
151
  function refLabel(ref, names) {
@@ -185,20 +191,20 @@ function sectionStatus(doc, label, section, sectionState, callbacks, emptyText)
185
191
  if (state === 'error' || state === 'invalid') {
186
192
  const retry = workspaceButton(doc, { text: '再試行', variant: 'quiet', onClick: () => void callbacks.onRetry?.(section) });
187
193
  return {
188
- notice: workspaceNotice(doc, { label, tone: 'danger', text: noticeBody(doc, `読み取れませんでした(${sectionState.reason ?? '理由不明'})。0件ではありません。`, retry) }),
194
+ notice: workspaceNotice(doc, { label, tone: 'danger', text: noticeBody(doc, `読み取れませんでした(${sectionState.reason ?? '理由不明'})。0件とは確認できません。`, retry) }),
189
195
  rows: false,
190
196
  };
191
197
  }
192
198
  if (state === 'unavailable') {
193
199
  return {
194
- notice: workspaceNotice(doc, { label, tone: 'warning', text: `このホストでは読めません(${sectionState.reason ?? '理由不明'})。0件ではありません。` }),
200
+ notice: workspaceNotice(doc, { label, tone: 'warning', text: `このホストでは読めません(${sectionState.reason ?? '理由不明'})。0件とは確認できません。` }),
195
201
  rows: false,
196
202
  };
197
203
  }
198
204
  if (state === 'unknown') {
199
205
  const message = sectionState.unreadable?.count
200
206
  ? unreadableMessage(sectionState.unreadable)
201
- : '記録の有無を確かめられません。0件ではありません。';
207
+ : '記録の有無を確かめられません。0件とは確認できません。';
202
208
  return { notice: workspaceNotice(doc, { label, tone: 'warning', text: message }), rows: false };
203
209
  }
204
210
  if (state === 'empty') return { notice: workspaceNotice(doc, { label, text: emptyText }), rows: false };
@@ -326,11 +332,43 @@ function unavailableSummary(doc, state, unavailableNotice) {
326
332
  if (!isRecord(unavailableNotice) || !text(unavailableNotice.title)) return null;
327
333
  if (!WORLD_MODEL_SECTIONS.every((section) => state[section]?.state === 'unavailable')) return null;
328
334
  const labels = isRecord(unavailableNotice.reasonLabels) ? unavailableNotice.reasonLabels : {};
329
- const reasonText = (reason) => (Object.hasOwn(labels, reason) && text(labels[reason])) || reason;
330
- const reasons = [...new Set(WORLD_MODEL_SECTIONS.map((section) => state[section].reason).filter(Boolean).map(reasonText))];
335
+ const reasonText = (reason) => {
336
+ const value = text(reason);
337
+ return value && Object.hasOwn(labels, value) && text(labels[value]) ? text(labels[value]) : value ?? '理由不明';
338
+ };
339
+ const groupedReasons = [];
340
+ for (const section of WORLD_MODEL_SECTIONS) {
341
+ const reason = reasonText(state[section].reason);
342
+ const existing = groupedReasons.find((group) => group.reason === reason);
343
+ if (existing) existing.sections.push(UNAVAILABLE_SECTION_LABELS[section]);
344
+ else groupedReasons.push({ reason, sections: [UNAVAILABLE_SECTION_LABELS[section]] });
345
+ }
331
346
  const body = makeElement(doc, 'div', { className: 'bb-wm-notice-body' });
332
347
  if (text(unavailableNotice.guidance)) body.append(makeElement(doc, 'p', { text: text(unavailableNotice.guidance) }));
333
- body.append(makeElement(doc, 'p', { text: `理由: ${reasons.length > 0 ? reasons.join('、') : '理由不明'}。0件ではありません。` }));
348
+ body.append(makeElement(doc, 'p', {
349
+ className: 'bb-wm-unavailable-status',
350
+ text: '記録件数は未確認です。0件とは確認できません。',
351
+ }));
352
+
353
+ const details = makeElement(doc, 'details', { className: 'bb-wm-unavailable-details' });
354
+ details.append(makeElement(doc, 'summary', {
355
+ className: 'bb-wm-unavailable-summary',
356
+ text: `理由と対象欄を確認(${WORLD_MODEL_SECTIONS.length}欄)`,
357
+ }));
358
+ const reasonList = makeElement(doc, 'ul', {
359
+ className: 'bb-wm-unavailable-reason-list',
360
+ attrs: { 'aria-label': '未接続の理由' },
361
+ });
362
+ for (const group of groupedReasons) {
363
+ const item = makeElement(doc, 'li', { className: 'bb-wm-unavailable-reason' });
364
+ item.append(
365
+ makeElement(doc, 'strong', { className: 'bb-wm-unavailable-reason-label', text: group.sections.join('・') }),
366
+ makeElement(doc, 'span', { className: 'bb-wm-unavailable-reason-copy', text: `理由: ${group.reason}` }),
367
+ );
368
+ reasonList.append(item);
369
+ }
370
+ details.append(reasonList);
371
+ body.append(details);
334
372
  return workspaceNotice(doc, { label: text(unavailableNotice.title), text: body, tone: 'info' });
335
373
  }
336
374