@unson/brainbase-mcp 0.49.0 → 0.50.0

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.
@@ -1073,10 +1073,6 @@ function appendReferenceList(doc, references) {
1073
1073
  if (list.children?.length) wrap.append(list);
1074
1074
  if (bare.length) {
1075
1075
  wrap.append(makeWorkspaceElement(doc, 'p', { className: 'bb-jh-reference-kinds', text: referenceKindCounts(bare) }));
1076
- wrap.append(makeWorkspaceElement(doc, 'p', {
1077
- className: 'bb-jh-reference-note',
1078
- text: 'この記録には参照の名前が残っていません。どの記録かは「記録の詳細」のIDで確かめられます。',
1079
- }));
1080
1076
  }
1081
1077
  return wrap;
1082
1078
  }
@@ -1466,10 +1462,6 @@ function appendNormalRecordDetails(doc, record, { onCopyReference, open = false,
1466
1462
  ]));
1467
1463
  const handoff = makeWorkspaceElement(doc, 'div', { className: 'bb-jh-handoff' });
1468
1464
  handoff.append(makeWorkspaceElement(doc, 'h4', { text: '次の判断に引き継ぐ' }));
1469
- handoff.append(makeWorkspaceElement(doc, 'p', {
1470
- className: 'bb-jh-reference-note',
1471
- text: 'この判断を別の判断の根拠として使うときに、AIへ渡す参照です。コピーしてAIとの会話に貼ります。',
1472
- }));
1473
1465
  handoff.append(appendNormalReferenceExport(doc, record, null, { onCopyReference }));
1474
1466
  for (const event of events) handoff.append(appendNormalReferenceExport(doc, record, event, { onCopyReference }));
1475
1467
  details.append(handoff);
@@ -1896,13 +1888,6 @@ function summaryLine(doc, aggregate, { loading = false } = {}) {
1896
1888
  if (aggregate?.mode !== 'normal') return line;
1897
1889
  line.append(makeWorkspaceElement(doc, 'span', { text: ' ・ 結果を確かめた判断 ' }));
1898
1890
  line.append(makeWorkspaceElement(doc, Number.isInteger(confirmed) ? 'strong' : 'span', { text: Number.isInteger(confirmed) ? `${confirmed}件` : '数えられません' }));
1899
- // Results are never recorded automatically; say how a person adds one.
1900
- if (Number.isInteger(confirmed) && confirmed < retrieved) {
1901
- line.append(makeWorkspaceElement(doc, 'span', {
1902
- className: 'bb-jh-summary-note',
1903
- text: ' 結果は自動では記録されません。判断を開いて「良かったか」を記録すると数えられます。',
1904
- }));
1905
- }
1906
1891
  return line;
1907
1892
  }
1908
1893
 
@@ -1931,7 +1931,7 @@ export function createMeetingMinutesUI({
1931
1931
  title: title.input.value,
1932
1932
  ...(scheduledAt ? { scheduled_at: scheduledAt } : {}),
1933
1933
  participant_ids: participants.input.value.split(',').map((value) => value.trim()).filter(Boolean),
1934
- minutes_title: minutesTitle.input.value,
1934
+ ...(minutesTitle.input.value.trim() ? { minutes_title: minutesTitle.input.value } : {}),
1935
1935
  initial_body: body.input.value,
1936
1936
  };
1937
1937
  const created = typeof createMeeting === 'function' && Array.isArray(projectOptions) ? await createMeeting(payload, projectCode) : await mutate('', payload);
@@ -7,12 +7,33 @@
7
7
 
8
8
  import { workspaceNotificationCard } from '../../workspace-kit.js';
9
9
 
10
- const SKY_MODES = Object.freeze([
10
+ // Shared so the standard presentation can reuse the same sky artwork and labels
11
+ // (RQ-152). The icons are fixed code, never host data.
12
+ export const SKY_MODES = Object.freeze([
11
13
  { value: 'auto', label: '自動(現在時刻)', icon: '<circle cx="12" cy="12" r="8.5"/><path d="M12 7.5v5l3 1.8"/>' },
12
14
  { value: 'day', label: '昼', icon: '<circle cx="12" cy="12" r="5" fill="currentColor" fill-opacity=".12"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/><path d="M10 12h.01M14 12h.01m-4 2.5q2 1.6 4 0"/>' },
13
15
  { value: 'dusk', label: '夕方', icon: '<path d="M5.5 13a6.5 6.5 0 0 1 13 0" fill="currentColor" fill-opacity=".12"/><path d="M12 2v2M3.5 5.5 5 7m15.5-1.5L19 7M2 13h20M3 17q3-2 6 0t6 0 6 0M6 21q3-2 6 0t6 0"/>' },
14
16
  { value: 'night', label: '夜', icon: '<path d="M19.5 15.5A8.5 8.5 0 0 1 8.5 4.5a8.5 8.5 0 1 0 11 11Z" fill="currentColor" fill-opacity=".12"/><path d="m18 3 .7 2.3L21 6l-2.3.7L18 9l-.7-2.3L15 6l2.3-.7ZM22 11h.01"/>' },
15
17
  ]);
18
+
19
+ /** The sky mode after `mode`, cycling in the listed order. */
20
+ export function nextSkyMode(mode) {
21
+ const index = SKY_MODES.findIndex((entry) => entry.value === mode);
22
+ return SKY_MODES[(Math.max(0, index) + 1) % SKY_MODES.length];
23
+ }
24
+
25
+ /** "空:{現在}。次は{次}" — the single sky-control label, used in both presentations. */
26
+ export function skyModeLabel(mode) {
27
+ const match = SKY_MODES.find((entry) => entry.value === mode) ?? SKY_MODES[0];
28
+ return `空:${match.label}。次は${nextSkyMode(match.value).label}`;
29
+ }
30
+
31
+ /** The fixed-artwork SVG for a sky mode, as inner HTML for an aria-hidden icon span. */
32
+ export function skyModeIconSvg(mode) {
33
+ const match = SKY_MODES.find((entry) => entry.value === mode) ?? SKY_MODES[0];
34
+ return `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${match.icon}</svg>`;
35
+ }
36
+
16
37
  const CLOSE_DELAY = 220;
17
38
  let instanceId = 0;
18
39
 
@@ -221,9 +242,8 @@ export function createWorldCanvasUI({
221
242
  if (!match) return;
222
243
  skyMode = mode;
223
244
  // Artwork is fixed code, never host data. Native button activation covers Enter/Space.
224
- skyIcon.innerHTML = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${match.icon}</svg>`;
225
- const next = SKY_MODES[(SKY_MODES.indexOf(match) + 1) % SKY_MODES.length];
226
- const label = `空:${match.label}。次は${next.label}`;
245
+ skyIcon.innerHTML = skyModeIconSvg(mode);
246
+ const label = skyModeLabel(mode);
227
247
  sky.setAttribute('aria-label', label);
228
248
  sky.setAttribute('title', label);
229
249
  }
@@ -411,7 +431,7 @@ export function createWorldCanvasUI({
411
431
  });
412
432
  listen(city, 'change', () => { if (businesses.has(city.value)) onCity?.(city.value); });
413
433
  listen(sky, 'click', () => {
414
- const next = SKY_MODES[(SKY_MODES.findIndex(entry => entry.value === skyMode) + 1) % SKY_MODES.length];
434
+ const next = nextSkyMode(skyMode);
415
435
  setSky(next.value);
416
436
  onSky?.(next.value);
417
437
  });
@@ -357,6 +357,64 @@
357
357
  display: none;
358
358
  }
359
359
 
360
+ /* RQ-003: the "?" disclosure and its panel sit above the canvas. The stage's
361
+ first child canvas fills its height and the stage clips overflow, so these
362
+ must be absolutely positioned to stay visible and clickable (not in flow). */
363
+ .bb-world-legend-toggle {
364
+ position: absolute;
365
+ top: var(--bb-space-3);
366
+ right: var(--bb-space-3);
367
+ z-index: 3;
368
+ }
369
+
370
+ .bb-world-legend-panel {
371
+ position: absolute;
372
+ top: calc(var(--bb-space-3) + 42px);
373
+ right: var(--bb-space-3);
374
+ z-index: 3;
375
+ max-width: min(360px, calc(100% - 24px));
376
+ max-height: calc(100% - 80px);
377
+ overflow: auto;
378
+ display: flex;
379
+ flex-direction: column;
380
+ gap: var(--bb-space-2);
381
+ padding: var(--bb-space-3);
382
+ background: rgb(255 255 255 / 95%);
383
+ border: 1px solid var(--bb-color-border);
384
+ border-radius: var(--bb-radius-md);
385
+ box-shadow: var(--bb-shadow);
386
+ backdrop-filter: blur(4px);
387
+ }
388
+
389
+ .bb-world-legend-panel[hidden] {
390
+ display: none;
391
+ }
392
+
393
+ /* Inside the panel the legend is static, not an overlay pinned to the stage. */
394
+ .bb-world-legend-panel .bb-world-legend {
395
+ position: static;
396
+ inset: auto;
397
+ }
398
+
399
+ /* RQ-006: the header sky switch is an icon button. The icon reuses the canvas
400
+ artwork, so its SVG needs the same explicit size or it would balloon and
401
+ break the header (the canvas rule only targets .bb-world-canvas-sky-icon). */
402
+ .bb-world-sky {
403
+ display: inline-grid;
404
+ place-items: center;
405
+ }
406
+
407
+ .bb-world-sky-icon {
408
+ display: inline-flex;
409
+ line-height: 1;
410
+ }
411
+
412
+ .bb-world-sky-icon svg {
413
+ display: block;
414
+ width: 23px;
415
+ height: 23px;
416
+ }
417
+
360
418
  .bb-world-chip.is-work-waiting::before { background: #7a6a9e; }
361
419
  .bb-world-chip.is-work-in_progress::before { background: #2f7d86; }
362
420
  .bb-world-chip.is-work-pending::before { background: #8d979e; }
@@ -29,7 +29,7 @@
29
29
  import { THREE, MapControls } from './world-vendor.js';
30
30
  import { changesSince, cityMeasures, districtChanges, districtLots, districtSnapshot, districtStage, groupJudgmentPlaces, skyAt, UNPLACED_REASON_TEXT } from './world-placement.js';
31
31
  import { createDistrictView, DISTRICT_LEGEND } from './world-district.js';
32
- import { createWorldCanvasUI } from './world-canvas-ui.js';
32
+ import { createWorldCanvasUI, SKY_MODES, skyModeLabel, skyModeIconSvg } from './world-canvas-ui.js';
33
33
  import { workCanvasNotes } from './world-canvas-notes.js';
34
34
  import { canvasTexture, drawFacade, FACADE_SIZES, FACADE_UNITS, gableRoof, hashUnit, muted, paintVertices, roundedPlate, valueNoise } from './world-scenery.js';
35
35
  import { WORK_STATES, readReasonShort, workCityBlocks, workGrowthBlock, workPickBlock, workSign, workSignBlocks, workSigns, workSiteBlocks } from './world-work-rail.js';
@@ -44,6 +44,8 @@ import {
44
44
  workspaceButton,
45
45
  } from '../../workspace-kit.js';
46
46
 
47
+ let worldLegendSequence = 0;
48
+
47
49
  export const WORLD_VIEW_CONTRACT_VERSION = 'brainbase.world-view.v0';
48
50
  /** Optional full-canvas presentation; the standard host contract remains unchanged. */
49
51
  export const WORLD_CANVAS_PRESENTATION_VERSION = 'brainbase.world-canvas.v1';
@@ -1650,17 +1652,28 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1650
1652
  let scene = null;
1651
1653
 
1652
1654
  // The sky follows the hour by default; the viewer can fix it to see the lit windows at night.
1653
- const SKY_MODES = [['auto', '空:時刻'], ['day', '空:昼'], ['dusk', '空:夕方'], ['night', '空:夜']];
1655
+ // An icon button reusing the canvas sky artwork and labels, so both presentations behave alike (RQ-152).
1654
1656
  let skyIndex = 0;
1655
1657
  const skyButton = workspaceButton(doc, {
1656
- text: SKY_MODES[0][1],
1658
+ variant: 'quiet',
1657
1659
  onClick: () => {
1658
1660
  skyIndex = (skyIndex + 1) % SKY_MODES.length;
1659
- skyButton.textContent = SKY_MODES[skyIndex][1];
1660
- scene?.setSky(SKY_MODES[skyIndex][0]);
1661
- district?.setSky(SKY_MODES[skyIndex][0]);
1661
+ renderSkyButton();
1662
+ scene?.setSky(SKY_MODES[skyIndex].value);
1663
+ district?.setSky(SKY_MODES[skyIndex].value);
1662
1664
  },
1663
1665
  });
1666
+ skyButton.classList.add('bb-world-sky');
1667
+ const skyButtonIcon = el(doc, 'span', { className: 'bb-world-sky-icon', attrs: { 'aria-hidden': 'true' } });
1668
+ skyButton.append(skyButtonIcon);
1669
+ function renderSkyButton() {
1670
+ const mode = SKY_MODES[skyIndex].value;
1671
+ skyButtonIcon.innerHTML = skyModeIconSvg(mode);
1672
+ const label = skyModeLabel(mode);
1673
+ skyButton.setAttribute('aria-label', label);
1674
+ skyButton.setAttribute('title', label);
1675
+ }
1676
+ renderSkyButton();
1664
1677
  const header = workspacePageHeader(doc, {
1665
1678
  crumbs: page?.crumbs ?? ['あなたのBrainbase', '世界'],
1666
1679
  title: '世界',
@@ -1711,9 +1724,10 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1711
1724
  if (business) openCity(business, scene?.selectKey({ code })?.center ?? null);
1712
1725
  },
1713
1726
  onSky: (mode) => {
1714
- skyIndex = Math.max(0, SKY_MODES.findIndex(([key]) => key === mode));
1715
- scene?.setSky(SKY_MODES[skyIndex][0]);
1716
- district?.setSky(SKY_MODES[skyIndex][0]);
1727
+ skyIndex = Math.max(0, SKY_MODES.findIndex((entry) => entry.value === mode));
1728
+ renderSkyButton();
1729
+ scene?.setSky(SKY_MODES[skyIndex].value);
1730
+ district?.setSky(SKY_MODES[skyIndex].value);
1717
1731
  },
1718
1732
  onDismissTask: () => dismissTask(),
1719
1733
  });
@@ -1728,7 +1742,24 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
1728
1742
  if (page?.source) help.append(el(doc, 'p', { text: page.source }));
1729
1743
  canvasUI.setHelp([help]);
1730
1744
  } else {
1731
- stage.append(notices, legend, workLegend);
1745
+ // The legend is no longer a permanent overlay (RQ-003); it folds into a small
1746
+ // "?" disclosure, closed by default, with the same keyboard and aria-expanded
1747
+ // behaviour as the canvas help button. The information is kept, just tucked away.
1748
+ const legendPanel = el(doc, 'div', { className: 'bb-world-legend-panel', attrs: { id: `bb-world-legend-${++worldLegendSequence}` } });
1749
+ legendPanel.hidden = true;
1750
+ legendPanel.append(legend, workLegend);
1751
+ const legendToggle = workspaceButton(doc, {
1752
+ text: '?',
1753
+ variant: 'quiet',
1754
+ attrs: { 'aria-label': '世界の見方と凡例', title: '世界の見方と凡例', 'aria-controls': legendPanel.id, 'aria-expanded': 'false' },
1755
+ onClick: () => {
1756
+ const open = legendPanel.hidden;
1757
+ legendPanel.hidden = !open;
1758
+ legendToggle.setAttribute('aria-expanded', String(open));
1759
+ },
1760
+ });
1761
+ legendToggle.classList.add('bb-world-legend-toggle');
1762
+ stage.append(notices, legendToggle, legendPanel);
1732
1763
  wrap.append(header, stage);
1733
1764
  }
1734
1765
 
@@ -2207,9 +2238,8 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2207
2238
  },
2208
2239
  } : {}),
2209
2240
  });
2210
- district.setSky(SKY_MODES[skyIndex][0]);
2241
+ district.setSky(SKY_MODES[skyIndex].value);
2211
2242
  scene.setPaused(true);
2212
- if (!canvasMode) { legend.hidden = true; workLegend.hidden = true; }
2213
2243
  if (districtCode !== business.code || !district.isOpen()) {
2214
2244
  district.show(business, work, { neighbours: new Map(knownBusinesses.map((entry) => [entry.code, entry.name])), exits: stationsFor(business.code) });
2215
2245
  districtCode = business.code;
@@ -2225,7 +2255,6 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2225
2255
  district.hide();
2226
2256
  districtCode = null;
2227
2257
  scene?.setPaused(false);
2228
- if (!canvasMode) legend.hidden = false;
2229
2258
  }
2230
2259
 
2231
2260
  async function loadWork(business) {
@@ -2670,7 +2699,7 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
2670
2699
  return;
2671
2700
  }
2672
2701
  scene = createScene({ doc, stage, labelsLayer, reducedMotion, onPick, onClear: clearAll, onEscape: goUp, onSign: (business, code) => showSignMeaning(business ?? knownBusinesses.find((entry) => entry.code === code) ?? null) });
2673
- scene.setSky(SKY_MODES[skyIndex][0]);
2702
+ scene.setSky(SKY_MODES[skyIndex].value);
2674
2703
  scene.buildPlaza(rows, rowItems, (row) => (rowItems.get(row.key) ?? []).filter((ref) => isWaiting(proofs.get(ref.decision_attempt_id))).length, Date.now(), { state: judgmentsUnavailable ? judgmentsUnavailable.title.replace('判断の記録:', '') : null });
2675
2704
  scene.buildCities(layoutWorld(businesses), placement.byBusiness);
2676
2705
  showChangesSinceLastVisit(note, businesses, rows);