@unson/brainbase-mcp 0.50.22 → 0.50.24

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.
@@ -0,0 +1,26 @@
1
+ export interface JudgmentProjectBindingCandidates {
2
+ /** The Host runtime of the turn (`codex` or `claude-code`). */
3
+ hostRuntime: string;
4
+ /** BRAINBASE_JUDGMENT_PROJECT_CODE as the Host received it. */
5
+ configuredProjectCode?: string | null;
6
+ /** The enabled public relay's project for the cwd's repository. */
7
+ relayProjectCode?: string | null;
8
+ /** The owner-local repository mapping's project for the cwd. */
9
+ ownerRepositoryProjectCode?: string | null;
10
+ /** The cwd's repository name, as the last fallback. */
11
+ sourceRepository?: string | null;
12
+ }
13
+ /**
14
+ * Order:
15
+ * 1. A Claude Code turn's configured project. The owner's bridge sets it only
16
+ * from that request's project header and removes it otherwise, so it is
17
+ * the project the turn named.
18
+ * 2. The enabled public relay's repository mapping. In a Codex environment it
19
+ * stays authoritative over a configured project left from earlier work.
20
+ * When a Claude Code turn named another project, the relay refuses the
21
+ * receipt at delivery (project mapping mismatch) instead of publishing it
22
+ * under the relay's project.
23
+ * 3. The configured project, then the owner-local repository mapping, then
24
+ * the repository name.
25
+ */
26
+ export declare function selectJudgmentProjectBinding(candidates: JudgmentProjectBindingCandidates): string | null;
@@ -0,0 +1,30 @@
1
+ // The project a judgment turn is resolved and audited for, chosen from the
2
+ // candidates a Host already holds. The Host reads the environment, the
3
+ // public relay's repository map, and the cwd's repository; this module only
4
+ // orders them, so every Host that resolves a turn picks the same project.
5
+ function present(value) {
6
+ const trimmed = typeof value === 'string' ? value.trim() : '';
7
+ return trimmed ? trimmed : null;
8
+ }
9
+ /**
10
+ * Order:
11
+ * 1. A Claude Code turn's configured project. The owner's bridge sets it only
12
+ * from that request's project header and removes it otherwise, so it is
13
+ * the project the turn named.
14
+ * 2. The enabled public relay's repository mapping. In a Codex environment it
15
+ * stays authoritative over a configured project left from earlier work.
16
+ * When a Claude Code turn named another project, the relay refuses the
17
+ * receipt at delivery (project mapping mismatch) instead of publishing it
18
+ * under the relay's project.
19
+ * 3. The configured project, then the owner-local repository mapping, then
20
+ * the repository name.
21
+ */
22
+ export function selectJudgmentProjectBinding(candidates) {
23
+ const configured = present(candidates.configuredProjectCode);
24
+ if (candidates.hostRuntime === 'claude-code' && configured)
25
+ return configured;
26
+ return present(candidates.relayProjectCode)
27
+ ?? configured
28
+ ?? present(candidates.ownerRepositoryProjectCode)
29
+ ?? present(candidates.sourceRepository);
30
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.22",
3
+ "version": "0.50.24",
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",
@@ -79,6 +79,10 @@
79
79
  "types": "./dist/judgment-frame-evidence.d.ts",
80
80
  "import": "./dist/judgment-frame-evidence.js"
81
81
  },
82
+ "./judgment-project-binding": {
83
+ "types": "./dist/judgment-project-binding.d.ts",
84
+ "import": "./dist/judgment-project-binding.js"
85
+ },
82
86
  "./judgment-event-adapter": {
83
87
  "types": "./dist/judgment-event-adapter.d.ts",
84
88
  "import": "./dist/judgment-event-adapter.js"
@@ -657,5 +661,5 @@
657
661
  "url": "https://github.com/Unson-LLC/brainbase/issues"
658
662
  },
659
663
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
660
- "gitHead": "f419a25d1acca1bc6548a4419968efdfca053c42"
664
+ "gitHead": "a5b10747c2cea7d6370bb977def167093efbdbc8"
661
665
  }
@@ -1320,6 +1320,23 @@
1320
1320
  .bb-ws-status-pill.is-success { background:var(--bb-color-accent-soft); color:var(--bb-color-success); }
1321
1321
  .bb-ws-status-pill.is-warning { background:var(--bb-color-warning-soft); color:var(--bb-color-warning); font-weight:600; }
1322
1322
  .bb-ws-status-pill.is-danger { background:var(--bb-color-danger-soft); color:var(--bb-color-danger); }
1323
+ .bb-ws-status-pill.bb-ws-status-pill--compact { min-height:20px; height:20px; padding:0 8px; font-size:11px; }
1324
+ .bb-ws-tabs--header .bb-ws-tab-count.is-zero { background:none; color:var(--bb-color-muted); font-weight:400; }
1325
+ .bb-ws-progress-bar { display:block; width:100%; height:6px; overflow:hidden; border-radius:3px; background:var(--bb-color-canvas); }
1326
+ .bb-ws-progress-segment.is-done { fill:var(--bb-color-action); }
1327
+ .bb-ws-progress-segment.is-remaining { fill:var(--bb-color-mint); opacity:.55; }
1328
+ .bb-ws-progress-segment.is-review { fill:var(--bb-color-review); }
1329
+ .bb-ws-empty-state { display:grid; justify-items:center; gap:14px; padding:0; color:var(--bb-color-slate); font-size:13.5px; text-align:center; }
1330
+ .bb-ws-empty-state > p { margin:0; }
1331
+ .bb-ws-empty-state-mark { display:grid; place-items:center; width:48px; height:48px; border-radius:var(--bb-radius-pill); background:var(--bb-color-accent-soft); color:var(--bb-color-mint); }
1332
+ .bb-ws-empty-state-mark .bb-ws-action-icon { width:22px; height:22px; stroke-width:2.2; }
1333
+ .bb-ws-empty-state-action { margin-top:4px; }
1334
+ .bb-ws-form-row.is-stacked { display:grid; grid-template-columns:minmax(0,1fr); align-items:start; min-height:0; gap:6px; padding:0; box-shadow:none; }
1335
+ .bb-ws-form-row.is-stacked:focus-within { box-shadow:none; }
1336
+ .bb-ws-form-row.is-stacked > :is(input,textarea) { box-sizing:border-box; width:100%; min-width:0; height:36px; margin:0; padding:0 12px; border:0; border-radius:7px; background:var(--bb-color-canvas); color:var(--bb-color-ink); font:400 13.5px/1.6 var(--bb-font-sans); outline:none; box-shadow:none; }
1337
+ .bb-ws-form-row.is-stacked > textarea { height:auto; min-height:84px; padding-block:8px; resize:vertical; }
1338
+ .bb-ws-form-row.is-stacked > :is(input,textarea):focus { border:0; outline:none; background:var(--bb-color-accent-soft); box-shadow:none; }
1339
+ .bb-ws-form-row.is-stacked > small { color:var(--bb-color-muted); font-size:11.5px; }
1323
1340
 
1324
1341
  .bb-ws-checkbox { appearance:none; display:inline-grid; place-items:center; flex:none; box-sizing:border-box; width:16px; min-width:16px; height:16px; margin:0; padding:0; border:0; border-radius:4px; background:var(--bb-color-paper); box-shadow:inset 0 0 0 1.5px var(--bb-color-border); color:transparent; vertical-align:middle; cursor:pointer; }
1325
1342
  .bb-ws-checkbox:hover:not(:disabled) { box-shadow:inset 0 0 0 1.5px var(--bb-color-muted); }
@@ -273,14 +273,56 @@ export function workspaceActions(doc, buttons = []) {
273
273
  }
274
274
 
275
275
  /** A business-neutral status label. The host supplies its text and meaning. */
276
- export function workspaceStatusPill(doc, { label, tone = 'neutral', width, attrs = {} } = {}) {
276
+ export function workspaceStatusPill(doc, { label, tone = 'neutral', width, appearance, attrs = {} } = {}) {
277
277
  const tones = new Set(['neutral', 'success', 'warning', 'danger']);
278
- const appearance = tones.has(tone) ? tone : 'neutral';
279
- const pill = el(doc, 'span', { className: `bb-ws-status-pill is-${appearance}`, text: label, attrs });
278
+ const pill = el(doc, 'span', { className: `bb-ws-status-pill is-${tones.has(tone) ? tone : 'neutral'}${appearance === 'compact' ? ' bb-ws-status-pill--compact' : ''}`, text: label, attrs });
280
279
  if (Number.isFinite(width) && width > 0) pill.style?.setProperty('--bb-status-pill-width', `${width}px`);
281
280
  return pill;
282
281
  }
283
282
 
283
+ /** A segmented visual proportion. Hosts supply confirmed quantities and meaning. */
284
+ export function workspaceProgressBar(doc, { segments = [], label } = {}) {
285
+ const tones = new Set(['done', 'remaining', 'review']);
286
+ if (!Array.isArray(segments) || !segments.length || segments.some(segment =>
287
+ !segment || !Number.isFinite(segment.value) || segment.value < 0 || !tones.has(segment.tone))) {
288
+ throw new TypeError('workspace_progress_segments_required');
289
+ }
290
+ const total = segments.reduce((sum, segment) => sum + segment.value, 0);
291
+ if (!Number.isFinite(total) || total <= 0) throw new RangeError('workspace_progress_total_must_be_positive');
292
+ const svgElement = (name, attrs) => {
293
+ const node = typeof doc.createElementNS === 'function'
294
+ ? doc.createElementNS('http://www.w3.org/2000/svg', name) : doc.createElement(name);
295
+ for (const [key, value] of Object.entries(attrs)) node.setAttribute(key, String(value));
296
+ return node;
297
+ };
298
+ const root = svgElement('svg', { class: 'bb-ws-progress-bar', viewBox: '0 0 100 6', preserveAspectRatio: 'none',
299
+ ...(label ? { role: 'img', 'aria-label': label } : { 'aria-hidden': 'true' }) });
300
+ let offset = 0;
301
+ // Review is always the final portion; the caller's array is never mutated.
302
+ const ordered = [...segments.filter(segment => segment.tone !== 'review'), ...segments.filter(segment => segment.tone === 'review')];
303
+ for (const segment of ordered) {
304
+ if (segment.value === 0) continue;
305
+ const width = segment.value / total * 100;
306
+ root.append(svgElement('rect', { class: `bb-ws-progress-segment is-${segment.tone}`, x: offset, y: 0, width, height: 6 }));
307
+ offset += width;
308
+ }
309
+ return root;
310
+ }
311
+
312
+ /** An empty list invitation. Copy and action remain owned by the host. */
313
+ export function workspaceEmptyState(doc, { text, icon = 'folder', action } = {}) {
314
+ const root = el(doc, 'div', { className: 'bb-ws-empty-state' });
315
+ const mark = el(doc, 'span', { className: 'bb-ws-empty-state-mark', attrs: { 'aria-hidden': 'true' } });
316
+ mark.append(workspaceActionIcon(doc, icon));
317
+ root.append(mark, el(doc, 'p', { text }));
318
+ if (action) {
319
+ const actions = el(doc, 'div', { className: 'bb-ws-empty-state-action' });
320
+ appendContent(actions, doc, action);
321
+ root.append(actions);
322
+ }
323
+ return root;
324
+ }
325
+
284
326
  /** Native checkbox with the shared compact mark and caller-owned selection. */
285
327
  export function workspaceCheckbox(doc, { label, checked = false, indeterminate = false, disabled = false, onChange, attrs = {} } = {}) {
286
328
  const checkbox = el(doc, 'input', { className: 'bb-ws-checkbox', attrs: {
@@ -1384,6 +1426,7 @@ export function workspaceActionIcon(doc, name) {
1384
1426
  const path = typeof doc.createElementNS === 'function' ? doc.createElementNS('http://www.w3.org/2000/svg', 'path') : doc.createElement('path');
1385
1427
  const paths = { edit: 'M4 20h4L19 9l-4-4L4 16z M13.5 6.5l4 4', undo: 'M4 5v5h5 M4.6 10A8 8 0 1 1 6.3 17.7', check: 'M5 12l5 5 9-10', sliders: 'M4 8h8M18 8h2M4 16h2M12 16h8 M17.4 8a2.4 2.4 0 1 1-4.8 0 2.4 2.4 0 0 1 4.8 0 M11.4 16a2.4 2.4 0 1 1-4.8 0 2.4 2.4 0 0 1 4.8 0', plus: 'M12 5v14M5 12h14', search: 'M21 21l-4.35-4.35M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0', filter: 'M4 7h16M7 12h10M10 17h4', sort: 'M8 4v16m-3-3 3 3 3-3M16 20V4m-3 3 3-3 3 3', close: 'M6 6l12 12M18 6L6 18', sparkles: 'M12 3l1.8 6.7 6.7 1.8-6.7 1.8L12 20l-1.8-6.7-6.7-1.8 6.7-1.8z M19 2v4 M17 4h4' };
1386
1428
  Object.assign(paths, {
1429
+ copy: 'M9 9h12v12H9z M5 15H3V3h12v2',
1387
1430
  lock: 'M6 10h12v11H6z M8 10V7a4 4 0 1 1 8 0v3',
1388
1431
  clock: 'M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0 M12 7v5l3 2',
1389
1432
  users: 'M12.2 8a3.2 3.2 0 1 1-6.4 0 3.2 3.2 0 0 1 6.4 0 M3 20c0-3.3 2.7-5.5 6-5.5s6 2.2 6 5.5 M16 5.2a3.2 3.2 0 0 1 0 5.6 M18 14.8c1.9.7 3 2.5 3 5.2',
@@ -1650,7 +1693,7 @@ export function workspaceControlRow(doc, { label, control, tight = false } = {})
1650
1693
  }
1651
1694
 
1652
1695
  export function workspaceFormRow(doc, { label, control, required = false, top = false, appearance } = {}) {
1653
- const root = el(doc, 'div', { className: `bb-ws-form-row${top ? ' is-top' : ''}${appearance === 'quiet' ? ' is-quiet' : ''}` });
1696
+ const root = el(doc, 'div', { className: `bb-ws-form-row${top ? ' is-top' : ''}${appearance === 'quiet' ? ' is-quiet' : ''}${appearance === 'stacked' ? ' is-stacked' : ''}` });
1654
1697
  const caption = el(doc, control?.id ? 'label' : 'span', { className: 'bb-ws-form-label', text: label,
1655
1698
  attrs: { for: control?.id || undefined } });
1656
1699
  if (required) {