@unson/brainbase-mcp 0.47.4 → 0.47.6

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.
@@ -193,6 +193,13 @@ async function requestEmbeddings(config, texts, deadline) {
193
193
  throw new EmbeddingProviderError('embedding_request_failed', 'embedding service request failed');
194
194
  }
195
195
  if (!Number.isInteger(response.status) || response.status < 200 || response.status >= 300) {
196
+ // Surface an exhausted embedding balance distinctly so Graph search can tell
197
+ // the owner that semantic retrieval is temporarily down for a billing reason,
198
+ // not a malformed request. The quota signal is either HTTP 402 or an explicit
199
+ // `embedding_provider_quota_exhausted` body code. Never echo the body itself.
200
+ if (response.status === 402 || await errorBodyCode(response, deadline) === 'embedding_provider_quota_exhausted') {
201
+ throw new EmbeddingProviderError('embedding_provider_quota_exhausted', 'the embedding provider prepaid balance is exhausted; semantic Graph search will work again once the balance is restored. Use resolve_entity or get_entity for known identifiers meanwhile');
202
+ }
196
203
  throw new EmbeddingProviderError('embedding_request_failed', `embedding service returned HTTP ${Number.isInteger(response.status) ? response.status : 'an invalid status'}`);
197
204
  }
198
205
  let raw;
@@ -213,6 +220,27 @@ async function requestEmbeddings(config, texts, deadline) {
213
220
  }
214
221
  return validateEmbeddingResponse(parsed, texts.length);
215
222
  }
223
+ /**
224
+ * Best-effort read of a failed response's `code` field. The error body may be
225
+ * absent, oversized, or non-JSON; any failure is swallowed because the HTTP
226
+ * status is still actionable on its own. The body text is never surfaced.
227
+ */
228
+ async function errorBodyCode(response, deadline) {
229
+ let raw;
230
+ try {
231
+ raw = await withDeadline(readResponseText(response), deadline);
232
+ }
233
+ catch {
234
+ return undefined;
235
+ }
236
+ try {
237
+ const parsed = JSON.parse(raw);
238
+ return isRecord(parsed) && typeof parsed.code === 'string' ? parsed.code : undefined;
239
+ }
240
+ catch {
241
+ return undefined;
242
+ }
243
+ }
216
244
  function createDeadline(timeoutMs) {
217
245
  return { controller: new AbortController(), expiresAt: Date.now() + timeoutMs, timeoutMs };
218
246
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.47.4",
3
+ "version": "0.47.6",
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",
@@ -624,5 +624,5 @@
624
624
  "url": "https://github.com/Unson-LLC/brainbase/issues"
625
625
  },
626
626
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
627
- "gitHead": "6a7f9223419008f3fa0cc57b19cadf2ca0a9ae52"
627
+ "gitHead": "d3b1b39f16c8626514c07bac12f23ff4d1b814fb"
628
628
  }
@@ -11,7 +11,10 @@
11
11
  * changes what it asks the server for (story-meeting-minutes-list-filters-v1).
12
12
  */
13
13
 
14
- import { workspaceActionIcon, workspaceSearchBand, workspaceCompactToolbar, workspaceCombobox, workspaceDetailDrawer } from './workspace-kit.js';
14
+ // A new lazy screen must not reuse the pre-search-band kit cached by an open tab.
15
+ // The capability query gives this compatible kit its own browser module identity.
16
+ import * as workspaceKit from './workspace-kit.js?capability=search-band-v1';
17
+ const { workspaceActionIcon, workspaceSearchBand, workspaceCompactToolbar, workspaceCombobox, workspaceDetailDrawer } = workspaceKit;
15
18
 
16
19
  export const MEETING_MINUTES_UI_CONTRACT_VERSION = 'brainbase.meeting-minutes-ui.v1';
17
20
 
@@ -732,6 +735,9 @@ export function createMeetingMinutesUI({
732
735
  let railProjectMeeting = null;
733
736
 
734
737
  const searchBand = toolbarPresentation === 'search-band';
738
+ if (searchBand && typeof workspaceSearchBand !== 'function') {
739
+ throw new Error('検索帯の共通部品を読み込めませんでした。ページを再読み込みしてください。');
740
+ }
735
741
  const compact = searchBand || toolbarPresentation === 'compact';
736
742
  const screen = makeElement(doc, 'div', { className: `bb-minutes-screen${compact ? ' bb-minutes-compact bb-ws-neutral-controls' : ''}`, attrs: { 'data-contract-version': MEETING_MINUTES_UI_CONTRACT_VERSION } });
737
743
  if (searchBand) screen.classList.add('bb-minutes-search-band');
@@ -1800,7 +1806,7 @@ export function createMeetingMinutesUI({
1800
1806
  }
1801
1807
 
1802
1808
  function renderDetail(detail, documentRecord = null, selectedVersion = null) {
1803
- detailDrawer?.setTitle('議事録の詳細');
1809
+ detailDrawer?.setTitle?.('議事録の詳細');
1804
1810
  clear(detailPane);
1805
1811
  connectionsSlot = null;
1806
1812
  participantsSlot = null;
@@ -1878,7 +1884,7 @@ export function createMeetingMinutesUI({
1878
1884
  }
1879
1885
 
1880
1886
  function renderCreateForm() {
1881
- detailDrawer?.setTitle('会議を作成');
1887
+ detailDrawer?.setTitle?.('会議を作成');
1882
1888
  detailRequestGeneration += 1;
1883
1889
  detailDrawer?.open();
1884
1890
  clear(detailPane);
@@ -821,7 +821,7 @@
821
821
 
822
822
  /* Shared dropdown symbol; pointer/keyboard behavior remains on its trigger. */
823
823
  .bb-ws-combobox-chevron { display: inline-flex; align-items: center; justify-content: center; flex: none; line-height: 0; }
824
- .bb-ws-combobox-chevron::after { content: none; }
824
+ .bb-ws-combobox-chevron:has(.bb-ws-dropdown-chevron)::after { content: none; }
825
825
  .bb-ws-dropdown-chevron { display: block; width: var(--bb-search-band-chevron-width); height: var(--bb-search-band-chevron-height); fill: none; stroke: currentColor; stroke-width: var(--bb-search-band-chevron-stroke); stroke-linecap: round; stroke-linejoin: round; }
826
826
  .bb-ws-combobox-align-end .bb-ws-combobox-popup { left: auto; right: 0; transform-origin: top right; }
827
827
  .bb-ws-combobox-multiple .bb-ws-combobox-list { scrollbar-gutter: stable both-edges; }
@@ -83,7 +83,7 @@ export function workspaceTopbar(doc, { title = '' } = {}) {
83
83
  /** A reusable right inspector whose content can refresh without replacing the modal. */
84
84
  export function workspaceDetailDrawer(doc, { title = '詳細', opener, onClose } = {}) {
85
85
  const dialog = workspaceApplyDrawer(el(doc, 'dialog', { className: 'bb-ws-dialog bb-ws-detail-drawer' }));
86
- const titleId = `bb-ws-inspector-${++workspaceSequence}`;
86
+ const titleId = `bb-ws-inspector-${nextWorkspaceSequence()}`;
87
87
  dialog.setAttribute('aria-labelledby', titleId);
88
88
  const head = el(doc, 'header', { className: 'bb-ws-detail-closebar' });
89
89
  const label = el(doc, 'h2', { className: 'bb-ws-visually-hidden', text: title, attrs: { id: titleId } });
@@ -296,12 +296,18 @@ export function workspaceSectionTitle(doc, { title, lead } = {}) {
296
296
 
297
297
 
298
298
  let workspaceSequence = 0;
299
+ // Capability-isolated modules coexist with an older kit in the same document.
300
+ const workspaceIdScope = new URL(import.meta.url).searchParams.get('capability') ?? '';
301
+ function nextWorkspaceSequence() {
302
+ const next = ++workspaceSequence;
303
+ return workspaceIdScope ? `${encodeURIComponent(workspaceIdScope)}-${next}` : next;
304
+ }
299
305
  /** Shared explanatory help: hover/focus above the control, click for touch. */
300
306
  export function workspaceHelp(doc, { text, label } = {}) {
301
307
  const wrap = el(doc, 'span', { className: 'bb-ws-help' });
302
308
  const control = workspaceButton(doc, { text: 'i', attrs: { 'aria-label': `${label}の説明`, 'aria-expanded': 'false' } });
303
309
  control.className = 'bb-ws-help-button';
304
- const bubble = el(doc, 'span', { className: 'bb-ws-help-bubble', text, attrs: { id: `bb-ws-help-${++workspaceSequence}`, role: 'tooltip' } });
310
+ const bubble = el(doc, 'span', { className: 'bb-ws-help-bubble', text, attrs: { id: `bb-ws-help-${nextWorkspaceSequence()}`, role: 'tooltip' } });
305
311
  control.setAttribute('aria-describedby', bubble.id || bubble.getAttribute?.('id') || bubble.attributes?.id);
306
312
  control.addEventListener('click', event => {
307
313
  event.stopPropagation(); event.preventDefault();
@@ -360,7 +366,7 @@ export function workspaceCloseDrawer(dialog, finish) {
360
366
  export function workspaceDialog(doc, { title, content, opener, presentation = 'center', onClose } = {}) {
361
367
  const dialog = el(doc, 'dialog', { className: 'bb-ws-dialog' });
362
368
  if (presentation === 'drawer') workspaceApplyDrawer(dialog);
363
- const headingId = `bb-ws-dialog-${++workspaceSequence}`;
369
+ const headingId = `bb-ws-dialog-${nextWorkspaceSequence()}`;
364
370
  dialog.setAttribute('aria-labelledby', headingId);
365
371
  const head = el(doc, 'header', { className: 'bb-ws-dialog-head' });
366
372
  const nativeClose = dialog.close.bind(dialog);
@@ -404,8 +410,8 @@ export function workspaceDialog(doc, { title, content, opener, presentation = 'c
404
410
  /** Anchored advanced search. Hosts destroy it before replacing its controls. */
405
411
  export function workspaceFilterPopover(doc, { content, open = false, onToggle, trigger, panel: suppliedPanel, initialFocus } = {}) {
406
412
  const root = el(doc, 'span', { className: 'bb-ws-filter-anchor' });
407
- const panel = suppliedPanel || el(doc, 'div', { className: 'bb-ws-filter-popover', attrs: { id: `bb-ws-filter-${++workspaceSequence}`, role: 'region', 'aria-label': '詳細検索' } });
408
- if (!panel.id && !panel.getAttribute?.('id')) panel.setAttribute('id', `bb-ws-filter-${++workspaceSequence}`);
413
+ const panel = suppliedPanel || el(doc, 'div', { className: 'bb-ws-filter-popover', attrs: { id: `bb-ws-filter-${nextWorkspaceSequence()}`, role: 'region', 'aria-label': '詳細検索' } });
414
+ if (!panel.id && !panel.getAttribute?.('id')) panel.setAttribute('id', `bb-ws-filter-${nextWorkspaceSequence()}`);
409
415
  panel.classList?.add('bb-ws-filter-popover');
410
416
  const control = trigger || workspaceButton(doc, { text: '詳細検索', variant: 'quiet' });
411
417
  control.setAttribute('aria-controls', panel.id || panel.getAttribute?.('id') || panel.attributes?.id);
@@ -515,7 +521,7 @@ export function workspaceCombobox(doc, {
515
521
  emptyText = '一致する候補はありません', limit = 100, searchable = 'auto', className, onChange,
516
522
  multiple = false, values = [], renderIcon, showCount = true, showHints = true, align = 'start',
517
523
  } = {}) {
518
- const sequence = ++workspaceSequence;
524
+ const sequence = nextWorkspaceSequence();
519
525
  const listId = `bb-ws-combobox-${sequence}-list`;
520
526
  const root = el(doc, 'span', { className: ['bb-ws-combobox', className].filter(Boolean).join(' ') });
521
527
  if (multiple) root.classList?.add('bb-ws-combobox-multiple');
@@ -763,7 +769,7 @@ export function workspaceTabList(root) {
763
769
  export function workspaceDropdownChevron(doc) {
764
770
  const wrap = el(doc, 'span', { className: 'bb-ws-combobox-chevron', attrs: { 'aria-hidden': 'true' } });
765
771
  const create = tag => typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', tag) : doc.createElement(tag);
766
- const svg = create('svg'); svg.setAttribute('viewBox', '0 0 12 8'); svg.setAttribute('class', 'bb-ws-dropdown-chevron');
772
+ const svg = create('svg'); svg.setAttribute('viewBox', '0 0 12 8'); svg.setAttribute('width', '10'); svg.setAttribute('height', '6'); svg.setAttribute('class', 'bb-ws-dropdown-chevron');
767
773
  const path = create('path'); path.setAttribute('d', 'M1 2.5l5 3 5-3'); svg.append(path); wrap.append(svg); return wrap;
768
774
  }
769
775