@unson/brainbase-mcp 0.34.0 → 0.35.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.
- package/package.json +2 -2
- package/ui/world/world-view.js +46 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unson/brainbase-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
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",
|
|
@@ -479,5 +479,5 @@
|
|
|
479
479
|
"engines": {
|
|
480
480
|
"node": ">=20"
|
|
481
481
|
},
|
|
482
|
-
"gitHead": "
|
|
482
|
+
"gitHead": "e343d28419451fde27b9d35b1c226fc769e68420"
|
|
483
483
|
}
|
package/ui/world/world-view.js
CHANGED
|
@@ -1514,6 +1514,47 @@ function memoryLines(answer) {
|
|
|
1514
1514
|
return lines;
|
|
1515
1515
|
}
|
|
1516
1516
|
|
|
1517
|
+
/**
|
|
1518
|
+
* @param {() => (WaitingQueuesAnswer | Promise<WaitingQueuesAnswer>)} [options.waitingQueues] Other queues of things
|
|
1519
|
+
* the owner decides, listed next to the waiting judgments (story-world-waiting-queues-v1, ledger P17 / D9). The
|
|
1520
|
+
* world knows nothing about them beyond `{ status: 'available', queues: [{ id, label, count, href, link_label? }] }`.
|
|
1521
|
+
* A queue with zero is not shown; an unreadable one is never shown as zero. `href` must be `https:` or a link
|
|
1522
|
+
* inside the host (`/…`, `?…`); others get no link. Without it the world is drawn exactly as before.
|
|
1523
|
+
* @typedef {{ status: string, reason?: string, queues?: object[] }} WaitingQueuesAnswer
|
|
1524
|
+
*/
|
|
1525
|
+
async function readWaitingQueues(waitingQueues) {
|
|
1526
|
+
if (typeof waitingQueues !== 'function') return null;
|
|
1527
|
+
try {
|
|
1528
|
+
const answer = await waitingQueues();
|
|
1529
|
+
return answer && typeof answer === 'object' ? answer : { status: 'failed', reason: 'invalid_answer' };
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
return { status: 'failed', reason: error instanceof Error ? error.message : 'request_failed' };
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/** The waiting queues as world notes. Zero is quiet; unknown is said out loud and never counted as zero. */
|
|
1536
|
+
function waitingQueueLines(answer) {
|
|
1537
|
+
if (!answer) return [];
|
|
1538
|
+
if (answer.status !== 'available' || !Array.isArray(answer.queues)) {
|
|
1539
|
+
return [{ text: `ほかの待っているもの:読めない(${answer.reason ?? answer.status ?? '理由不明'})。件数は0件とは確認できません。`, tone: 'warning', summary: 'ほかの待っているもの:読めない', link: null }];
|
|
1540
|
+
}
|
|
1541
|
+
const lines = [];
|
|
1542
|
+
for (const queue of answer.queues) {
|
|
1543
|
+
const label = typeof queue?.label === 'string' && queue.label.trim() ? queue.label.trim() : null;
|
|
1544
|
+
if (!label) continue;
|
|
1545
|
+
const count = queue.count;
|
|
1546
|
+
if (!Number.isInteger(count) || count < 0) {
|
|
1547
|
+
lines.push({ text: `${label}:読めない(${queue.reason ?? '理由不明'})。件数は0件とは確認できません。`, tone: 'warning', summary: `${label}:読めない`, link: null });
|
|
1548
|
+
continue;
|
|
1549
|
+
}
|
|
1550
|
+
if (count === 0) continue;
|
|
1551
|
+
const href = exitHrefKind(queue.href) ? queue.href : null;
|
|
1552
|
+
const linkLabel = typeof queue.link_label === 'string' && queue.link_label.trim() ? queue.link_label.trim() : `${label}を開く`;
|
|
1553
|
+
lines.push({ text: `${label} ${count}件。`, tone: 'attention', summary: `${label} ${count}件`, link: href ? { href, label: linkLabel, className: 'bb-world-waiting-queue-link' } : null });
|
|
1554
|
+
}
|
|
1555
|
+
return lines;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1517
1558
|
/** At most this many waiting judgments are listed in the world; the rest are counted, never hidden. */
|
|
1518
1559
|
const WAITING_LIST_LIMIT = 3;
|
|
1519
1560
|
|
|
@@ -1540,7 +1581,7 @@ function defaultJudgmentHref(decisionAttemptId) {
|
|
|
1540
1581
|
return decisionAttemptId ? `#value-proofs?decision=${encodeURIComponent(decisionAttemptId)}` : '#value-proofs';
|
|
1541
1582
|
}
|
|
1542
1583
|
|
|
1543
|
-
export function createWorldView({ root, rail, page, presentation = 'standard', document: explicitDocument, fetcher, projectHref = (project) => `#projects?project=${encodeURIComponent(project.id)}`, taskHref = null, judgmentHref = defaultJudgmentHref, selection = addressSelection(), businessExits = null, memoryStatus = null }) {
|
|
1584
|
+
export function createWorldView({ root, rail, page, presentation = 'standard', document: explicitDocument, fetcher, projectHref = (project) => `#projects?project=${encodeURIComponent(project.id)}`, taskHref = null, judgmentHref = defaultJudgmentHref, selection = addressSelection(), businessExits = null, memoryStatus = null, waitingQueues = null }) {
|
|
1544
1585
|
const exitsEnabled = typeof businessExits === 'function';
|
|
1545
1586
|
const doc = explicitDocument ?? globalThis.document;
|
|
1546
1587
|
const reducedMotion = Boolean(globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches);
|
|
@@ -2384,6 +2425,7 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
|
|
|
2384
2425
|
|
|
2385
2426
|
async function load() {
|
|
2386
2427
|
const memoryRead = readMemoryStatus(memoryStatus);
|
|
2428
|
+
const queuesRead = readWaitingQueues(waitingQueues);
|
|
2387
2429
|
const businessesResult = await readJson(fetcher, '/api/extensions/world/businesses');
|
|
2388
2430
|
if (disposed) return;
|
|
2389
2431
|
// A world drawn from an organization's Graph shows only that organization's judgments: the host keeps
|
|
@@ -2463,6 +2505,9 @@ export function createWorldView({ root, rail, page, presentation = 'standard', d
|
|
|
2463
2505
|
if (judgmentsConnected) {
|
|
2464
2506
|
for (const line of waitingLines(proofs, judgmentHref)) note('待っている判断', line.text, 'attention', line.summary, line.link);
|
|
2465
2507
|
}
|
|
2508
|
+
const queues = await queuesRead;
|
|
2509
|
+
if (disposed) return;
|
|
2510
|
+
for (const line of waitingQueueLines(queues)) note('待っている', line.text, line.tone, line.summary, line.link);
|
|
2466
2511
|
const rowItems = new Map(rows.map((row) => [row.key, Array.isArray(row.items) ? row.items : []]));
|
|
2467
2512
|
const memory = await memoryRead;
|
|
2468
2513
|
if (disposed) return;
|