From 42153ebe2ae969b6251c8ad52b8074999ed043ea Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Mon, 16 Nov 2026 06:44:42 -0500 Subject: [PATCH 1/4] =?UTF-8?q?=F0=9F=8C=B1=20Inbox:=20remove=20the=20?= =?UTF-8?q?=E2=86=92=20dibs=E2=80=A6=20item=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson --- changelog.d/changed-inbox-remove-dibs-button.md | 1 + src/docs/dashboard-sections.md | 2 +- src/docs/dashboard-sections/workflow-and-agents.md | 4 ++-- src/docs/inbox-voice-sources.md | 2 +- src/docs/knowledge-connectors.md | 4 ++-- src/pkg/dashboard/static-src/js/inbox.js | 10 +++------- src/pkg/dashboard/static-src/js/sections.js | 2 +- src/pkg/dashboard/static/index.html | 12 ++++-------- 8 files changed, 15 insertions(+), 22 deletions(-) create mode 100644 changelog.d/changed-inbox-remove-dibs-button.md diff --git a/changelog.d/changed-inbox-remove-dibs-button.md b/changelog.d/changed-inbox-remove-dibs-button.md new file mode 100644 index 0000000000..9cd071fd7a --- /dev/null +++ b/changelog.d/changed-inbox-remove-dibs-button.md @@ -0,0 +1 @@ +- The Inbox no longer offers a "→ dibs…" item action. Recordings are filed with "→ RFC…"; dibs remains available as an auto-routing destination for existing configs. diff --git a/src/docs/dashboard-sections.md b/src/docs/dashboard-sections.md index b044045848..21d7d3b5c0 100644 --- a/src/docs/dashboard-sections.md +++ b/src/docs/dashboard-sections.md @@ -188,7 +188,7 @@ Full entry: [Knowledge](dashboard-sections/workflow-and-agents.md#knowledge). ## Inbox -Voice recordings and dictations waiting for you to file them as an RFC, send to dibs, or keep as knowledge. +Voice recordings and dictations waiting for you to file them as an RFC or keep as knowledge. Full entry: [Inbox](dashboard-sections/workflow-and-agents.md#inbox). diff --git a/src/docs/dashboard-sections/workflow-and-agents.md b/src/docs/dashboard-sections/workflow-and-agents.md index f7b7f4c12d..eccb2a57f3 100644 --- a/src/docs/dashboard-sections/workflow-and-agents.md +++ b/src/docs/dashboard-sections/workflow-and-agents.md @@ -206,7 +206,7 @@ The facts Hive has learned about your projects, where they came from, and how mu ## Inbox -Voice recordings and dictations waiting for you to file them as an RFC, send to dibs, or keep as knowledge. +Voice recordings and dictations waiting for you to file them as an RFC or keep as knowledge. **What it tells you.** Every recording a voice source (Plaud, Wispr Flow) syncs is already a Knowledge fact. The Inbox lists the ones you have not triaged yet, with the source, date, length and a short excerpt. @@ -217,7 +217,7 @@ Voice recordings and dictations waiting for you to file them as an RFC, send to - Auto-routing rules run once per new item after a sync; the first matching rule wins. - The default RFC repository, dibs URL and rules can also be edited under Settings → Inbox. -**What it is good for.** Record an idea on your recorder, then turn it into an RFC with child issues (→ RFC), a dibs idea (→ dibs), or just keep it searchable (Knowledge only) without leaving the dashboard. See [Inbox and voice sources](../inbox-voice-sources.md). +**What it is good for.** Record an idea on your recorder, then turn it into an RFC with child issues (→ RFC), or just keep it searchable (Knowledge only) without leaving the dashboard. See [Inbox and voice sources](../inbox-voice-sources.md). **Example.** A fact says tests run with `make test`, but your project uses `go test`. You edit the fact. diff --git a/src/docs/inbox-voice-sources.md b/src/docs/inbox-voice-sources.md index 312053c639..c02c6202c2 100644 --- a/src/docs/inbox-voice-sources.md +++ b/src/docs/inbox-voice-sources.md @@ -60,7 +60,7 @@ see the issue linked from the changelog entry. yet" so it can be transcribed first. If no agent is available or the kick is refused, the item shows **RFC failed** with the error inline and a **Retry RFC…** button; it never sits as pending. - - **→ dibs** (`dibs`): posts title, summary, transcript and the + - **dibs** (`dibs`, auto-routing only; the item-level **→ dibs…** button was removed): posts title, summary, transcript and the `plaud://recordings/` provenance to `POST {inbox.dibs.url}/api/ideas` as a private draft idea (Bearer token from `inbox.dibs.token_env`). - **Knowledge only** (`dismiss`): leaves the fact where it is and drops the diff --git a/src/docs/knowledge-connectors.md b/src/docs/knowledge-connectors.md index bd2b1d14d7..fc24fcc2bb 100644 --- a/src/docs/knowledge-connectors.md +++ b/src/docs/knowledge-connectors.md @@ -304,8 +304,8 @@ set yourself is never rewritten, so an explicit `@latest` still floats. @plaud-ai/mcp@0.3.14 install` signed in. See [Inbox and voice sources](inbox-voice-sources.md#hosted-hives-signing-in-to-plaud). 4. Click **Sync now**. New recordings are picked up every `interval` and - appear in the **📥 Inbox**, where you file them as a spektacular RFC, send - them to dibs, or keep them as knowledge only + appear in the **📥 Inbox**, where you file them as a spektacular RFC or + keep them as knowledge only ([Inbox and voice sources](inbox-voice-sources.md)). ### Behaviour diff --git a/src/pkg/dashboard/static-src/js/inbox.js b/src/pkg/dashboard/static-src/js/inbox.js index a13427159e..eef67f7bb2 100644 --- a/src/pkg/dashboard/static-src/js/inbox.js +++ b/src/pkg/dashboard/static-src/js/inbox.js @@ -314,8 +314,7 @@ if (owner) { const retry = (d) => routes[d] && routes[d].status === 'failed' ? 'Retry ' : '→ '; actions += ''; - actions += ''; - if (!it.dismissed) actions += ''; + if (!it.dismissed) actions += ''; else actions += ''; } actions += ''; @@ -552,14 +551,11 @@ body += '

A hive agent drafts a spec from the transcript with spektacular, then runs spektacular publish to file one RFC issue plus child issues on the chosen repository. The children are picked up by the hive like any other issue.

' + '' + (repos.length ? '' : '

No repositories configured on this hive.

'); - } else { - body += '

Posts the title, summary and transcript to dibs as a private draft idea' + (settings.dibs_url ? ' at ' + escapeHtml(settings.dibs_url) + '' : '') + '. Provenance links back to ' + escapeHtml(src) + '://recordings/' + escapeHtml(id) + '.

' + - (!settings.dibs_url ? '

dibs is not configured — set the URL under ⚙ Auto-routing and inbox.dibs.token_env in the hive config.

' : !settings.dibs_token_set ? '

dibs token missing — set the environment variable named by inbox.dibs.token_env.

' : ''); } body += '' + '
' + - '
'; - kbShowModal(dest === 'spek_rfc' ? '→ RFC (spektacular)' : '→ dibs', body, { width: '520px' }); + ''; + kbShowModal('→ RFC (spektacular)', body, { width: '520px' }); } async function inboxConfirmRoute(src, id, dest) { const repoEl = document.getElementById('inbox-route-repo'); diff --git a/src/pkg/dashboard/static-src/js/sections.js b/src/pkg/dashboard/static-src/js/sections.js index 756c1ce8ca..c4cbbb3bf0 100644 --- a/src/pkg/dashboard/static-src/js/sections.js +++ b/src/pkg/dashboard/static-src/js/sections.js @@ -163,7 +163,7 @@ 'sessions-section': { heading: 'Inception (spek)', help: 'Named terminal sessions running command-line AI tools inside Hive; everyone who can see one watches live and one person at a time holds the keyboard.' }, 'knowledge-section': { heading: 'Knowledge', help: 'The facts Hive has learned about your projects, where they came from, and how much Hive trusts each one.' }, 'meetings-section': { heading: 'Meetings', help: 'Meetings hive joins to take notes: send it to one, follow the live transcript, notes and research, or make it leave.' }, - 'inbox-section': { heading: 'Inbox', help: 'Voice recordings and dictations waiting for you to file them as an RFC, send to dibs, or keep as knowledge.' }, + 'inbox-section': { heading: 'Inbox', help: 'Voice recordings and dictations waiting for you to file them as an RFC or keep as knowledge.' }, 'contributors-section': { heading: 'Contributors', help: 'The people who lend their computers or AI helpers to your projects, and how far Hive trusts each of them.' }, 'debug-section': { heading: 'Diagnostics', help: 'Health checks for Hive itself, such as its connections, credentials and safety switches, to help you find out why something is not working.' }, 'logs-section': { heading: 'Agent Logs', help: 'The raw text output of each worker, for following what it is doing line by line.' }, diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 44de8ac73d..94bd768454 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -10815,7 +10815,7 @@

Where to get help

'sessions-section': { heading: 'Inception (spek)', help: 'Named terminal sessions running command-line AI tools inside Hive; everyone who can see one watches live and one person at a time holds the keyboard.' }, 'knowledge-section': { heading: 'Knowledge', help: 'The facts Hive has learned about your projects, where they came from, and how much Hive trusts each one.' }, 'meetings-section': { heading: 'Meetings', help: 'Meetings hive joins to take notes: send it to one, follow the live transcript, notes and research, or make it leave.' }, - 'inbox-section': { heading: 'Inbox', help: 'Voice recordings and dictations waiting for you to file them as an RFC, send to dibs, or keep as knowledge.' }, + 'inbox-section': { heading: 'Inbox', help: 'Voice recordings and dictations waiting for you to file them as an RFC or keep as knowledge.' }, 'contributors-section': { heading: 'Contributors', help: 'The people who lend their computers or AI helpers to your projects, and how far Hive trusts each of them.' }, 'debug-section': { heading: 'Diagnostics', help: 'Health checks for Hive itself, such as its connections, credentials and safety switches, to help you find out why something is not working.' }, 'logs-section': { heading: 'Agent Logs', help: 'The raw text output of each worker, for following what it is doing line by line.' }, @@ -47648,8 +47648,7 @@ if (owner) { const retry = (d) => routes[d] && routes[d].status === 'failed' ? 'Retry ' : '→ '; actions += ''; - actions += ''; - if (!it.dismissed) actions += ''; + if (!it.dismissed) actions += ''; else actions += ''; } actions += ''; @@ -47886,14 +47885,11 @@ body += '

A hive agent drafts a spec from the transcript with spektacular, then runs spektacular publish to file one RFC issue plus child issues on the chosen repository. The children are picked up by the hive like any other issue.

' + '' + (repos.length ? '' : '

No repositories configured on this hive.

'); - } else { - body += '

Posts the title, summary and transcript to dibs as a private draft idea' + (settings.dibs_url ? ' at ' + escapeHtml(settings.dibs_url) + '' : '') + '. Provenance links back to ' + escapeHtml(src) + '://recordings/' + escapeHtml(id) + '.

' + - (!settings.dibs_url ? '

dibs is not configured — set the URL under ⚙ Auto-routing and inbox.dibs.token_env in the hive config.

' : !settings.dibs_token_set ? '

dibs token missing — set the environment variable named by inbox.dibs.token_env.

' : ''); } body += '' + '
' + - '
'; - kbShowModal(dest === 'spek_rfc' ? '→ RFC (spektacular)' : '→ dibs', body, { width: '520px' }); + ''; + kbShowModal('→ RFC (spektacular)', body, { width: '520px' }); } async function inboxConfirmRoute(src, id, dest) { const repoEl = document.getElementById('inbox-route-repo'); From a1048e2218b56978766ab572f2e2a75da787b70e Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Mon, 16 Nov 2026 06:49:38 -0500 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8C=B1=20Inbox:=20one=20Share=20menu?= =?UTF-8?q?=20with=20a=20Hive=20group=20(RFC,=20spek,=20Knowledge,=20DIBS)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson --- .../changed-inbox-remove-dibs-button.md | 2 +- .../dashboard-sections/workflow-and-agents.md | 2 +- src/docs/inbox-voice-sources.md | 18 ++- src/pkg/dashboard/inbox_share_menu_test.go | 101 ++++++++++++ src/pkg/dashboard/static-src/js/inbox.js | 148 ++++++++++++++++-- src/pkg/dashboard/static/index.html | 148 ++++++++++++++++-- 6 files changed, 379 insertions(+), 40 deletions(-) create mode 100644 src/pkg/dashboard/inbox_share_menu_test.go diff --git a/changelog.d/changed-inbox-remove-dibs-button.md b/changelog.d/changed-inbox-remove-dibs-button.md index 9cd071fd7a..a1eac275c7 100644 --- a/changelog.d/changed-inbox-remove-dibs-button.md +++ b/changelog.d/changed-inbox-remove-dibs-button.md @@ -1 +1 @@ -- The Inbox no longer offers a "→ dibs…" item action. Recordings are filed with "→ RFC…"; dibs remains available as an auto-routing destination for existing configs. +- The Inbox item row now has only Play, Transcript and a 🔗 Share ▾ menu with a Hive group (RFC…, Knowledge, DIBS) and a Link group (Copy link, Share…); the "→ dibs…", "→ RFC…" and "Knowledge only" row buttons are gone and the selection bar gets a Hive menu. Auto-routing and config are unchanged. diff --git a/src/docs/dashboard-sections/workflow-and-agents.md b/src/docs/dashboard-sections/workflow-and-agents.md index eccb2a57f3..e0015d58ca 100644 --- a/src/docs/dashboard-sections/workflow-and-agents.md +++ b/src/docs/dashboard-sections/workflow-and-agents.md @@ -217,7 +217,7 @@ Voice recordings and dictations waiting for you to file them as an RFC or keep a - Auto-routing rules run once per new item after a sync; the first matching rule wins. - The default RFC repository, dibs URL and rules can also be edited under Settings → Inbox. -**What it is good for.** Record an idea on your recorder, then turn it into an RFC with child issues (→ RFC), or just keep it searchable (Knowledge only) without leaving the dashboard. See [Inbox and voice sources](../inbox-voice-sources.md). +**What it is good for.** Record an idea on your recorder, then turn it into an RFC with child issues (🔗 Share → Hive → RFC…), send it to dibs (DIBS), or just keep it searchable (Knowledge) without leaving the dashboard. See [Inbox and voice sources](../inbox-voice-sources.md). **Example.** A fact says tests run with `make test`, but your project uses `go test`. You edit the fact. diff --git a/src/docs/inbox-voice-sources.md b/src/docs/inbox-voice-sources.md index c02c6202c2..5281e3e278 100644 --- a/src/docs/inbox-voice-sources.md +++ b/src/docs/inbox-voice-sources.md @@ -60,7 +60,7 @@ see the issue linked from the changelog entry. yet" so it can be transcribed first. If no agent is available or the kick is refused, the item shows **RFC failed** with the error inline and a **Retry RFC…** button; it never sits as pending. - - **dibs** (`dibs`, auto-routing only; the item-level **→ dibs…** button was removed): posts title, summary, transcript and the + - **DIBS** (`dibs`; chosen by auto-routing or from **🔗 Share → Hive → DIBS**): posts title, summary, transcript and the `plaud://recordings/` provenance to `POST {inbox.dibs.url}/api/ideas` as a private draft idea (Bearer token from `inbox.dibs.token_env`). - **Knowledge only** (`dismiss`): leaves the fact where it is and drops the @@ -107,9 +107,19 @@ Each Inbox item shows what the source has for the recording: presigned link itself (`{url, expires_at}`, audited as `inbox_audio`) for API clients. The Plaud card's *Include 24h audio link* option only decides whether a sync also writes a link into the fact. -- **🔗 Share** — shares a deep link to the item in the Inbox - (`#section-inbox-section?item=%2F`), through the - browser's share sheet when it has one, else the clipboard. It never shares +- **🔗 Share ▾** — the only per-item menu besides ▶ Play and Transcript + (arrow keys move, Esc closes and returns focus). It has two labelled groups. + **Hive** (owners only): **RFC…** (**Retry RFC…** after a failure), **Knowledge** + (**Back to inbox** on a kept item) and **DIBS**. RFC… is disabled with a + hint when the item has no text yet (use 🎧 Transcribe) or no RFC repository is + set; DIBS is disabled until `inbox.dibs.url` (Settings → Inbox → dibs URL) + and the token variable named by `inbox.dibs.token_env` are set. Other + features add their own entry to this group. **Link** (everyone who can see + the Inbox): **Copy link** copies a deep link to the item + (`#section-inbox-section?item=%2F`); **Share…** + opens the browser's share sheet and appears only where the browser has one. + The selection bar has the same kind of **Hive ▾** menu for bulk Knowledge. + Sharing never shares the media URL: the recipient signs in to this hive and needs owner or read-write access to play. Opening the link opens the Inbox, shows processed items when the item is one, and scrolls to it. The player's own diff --git a/src/pkg/dashboard/inbox_share_menu_test.go b/src/pkg/dashboard/inbox_share_menu_test.go new file mode 100644 index 0000000000..7a34d5626b --- /dev/null +++ b/src/pkg/dashboard/inbox_share_menu_test.go @@ -0,0 +1,101 @@ +package dashboard + +import ( + "strings" + "testing" +) + +// The Inbox item row carries only Play, Transcript and a 🔗 Share ▾ menu; the +// menu has a Hive group (RFC…, Knowledge, DIBS, plus registered entries) and a +// Link group (Copy link, Share…). Helpers run under node with the globals +// injected. +func TestInboxShareMenuRowIsThreeControls(t *testing.T) { + html := indexHTML(t) + row := jsFunc(t, html, "inboxItemHtml") + for _, gone := range []string{`data-arg2="spek_rfc"`, `data-action="inboxDismiss"`, `data-action="inboxUndismiss"`, `data-arg2="dibs"`} { + if strings.Contains(row, gone) { + t.Fatalf("item row still carries %s", gone) + } + } + for _, want := range []string{`data-action="inboxPlay"`, `data-action="inboxToggleTranscript"`, `data-action="inboxShare"`, `aria-haspopup="menu"`} { + if !strings.Contains(row, want) { + t.Fatalf("item row missing %s", want) + } + } +} + +func TestInboxShareMenuBehaviour(t *testing.T) { + html := indexHTML(t) + script := strings.Join([]string{ + "const assert = require('assert');", + "function escapeHtml(s) { return String(s).replace(/&/g,'&').replace(//g,'>').replace(/\"/g,'"'); }", + "var window = { _hiveRole: 'owner' }; var navigator = {}; var _inboxCache = null;", + "var calls = [];", + "function inboxOpenRoute(s, i, d) { calls.push(['route', s, i, d]); }", + "function inboxDismiss(s, i) { calls.push(['dismiss', s, i]); } function inboxUndismiss(s, i) { calls.push(['undismiss', s, i]); }", + "function inboxShareCopy(s, i) { calls.push(['copy', s, i]); } async function inboxShareNative(s, i) { calls.push(['native', s, i]); }", + "function inboxDismissSelected() { calls.push(['bulk-dismiss']); } const _inboxSelected = new Set(['plaud/r1']);", + "function inboxFind(s, i) { return ((_inboxCache || {}).items || []).find(it => it.source === s && it.id === i); }", + jsConstLine(t, html, "INBOX_NO_TEXT_REASON"), + jsConstBlock(t, html, "inboxShareHiveActions"), + jsConstBlock(t, html, "inboxShareLinkActions"), + jsFunc(t, html, "inboxDibsReady"), + jsFunc(t, html, "inboxShareMenuGroups"), + jsFunc(t, html, "inboxShareMenuHtml"), + jsFunc(t, html, "inboxShareMenuRun"), + jsFunc(t, html, "inboxBulkMenuGroups"), + jsFunc(t, html, "inboxBulkMenuRun"), + ` +const item = (o) => Object.assign({ source: 'plaud', id: 'r1', title: 'T', routes: {} }, o || {}); +const ready = (items) => ({ items: items || [item()], repos: ['o/r'], settings: { dibs_url: 'https://d.example', dibs_token_set: true } }); +const ids = (gs) => gs.map(g => g.id + ':' + g.items.map(i => i.id).join(',')); +(async () => { + // Groups and order; Share… only with navigator.share. + _inboxCache = ready(); navigator = { share: () => {} }; + let gs = inboxShareMenuGroups(item()); + assert.deepStrictEqual(ids(gs), ['hive:rfc,knowledge,dibs', 'link:copy,native']); + const markup = inboxShareMenuHtml(gs, 'plaud', 'r1'); + assert(markup.includes('role="menu"') && markup.includes('role="group" aria-label="Hive"') && markup.includes('aria-label="Link"')); + assert(markup.indexOf('Hive') < markup.indexOf('>Link<')); + assert.strictEqual((markup.match(/role="menuitem"/g) || []).length, 5); + navigator = {}; + assert.deepStrictEqual(ids(inboxShareMenuGroups(item())), ['hive:rfc,knowledge,dibs', 'link:copy']); + // Role gating: read and read-write only get the Link group. + for (const role of ['read', 'read-write']) { window._hiveRole = role; assert.deepStrictEqual(ids(inboxShareMenuGroups(item())), ['link:copy']); } + assert.deepStrictEqual(inboxBulkMenuGroups(), []); + window._hiveRole = 'owner'; + // Disabled reasons. + _inboxCache = { items: [], repos: [], settings: {} }; + let hive = inboxShareMenuGroups(item({ pending: true }))[0].items; + assert(hive.find(i => i.id === 'rfc').disabled && hive.find(i => i.id === 'rfc').hint.includes('Transcribe')); + hive = inboxShareMenuGroups(item())[0].items; + assert(hive.find(i => i.id === 'rfc').hint.includes('RFC repository')); + const dibs = hive.find(i => i.id === 'dibs'); + assert(dibs.disabled && dibs.hint.includes('Settings → Inbox → dibs URL')); + assert(inboxShareMenuHtml(inboxShareMenuGroups(item()), 'plaud', 'r1').includes('aria-disabled="true"')); + // Failed route labels a retry; dismissed items offer Back to inbox. + _inboxCache = ready(); + hive = inboxShareMenuGroups(item({ routes: { spek_rfc: { status: 'failed' } }, dismissed: true }))[0].items; + assert.strictEqual(hive[0].label, 'Retry RFC…'); assert.strictEqual(hive[1].label, 'Back to inbox'); + // Each entry calls its existing handler. + _inboxCache = ready([item()]); navigator = { share: () => {} }; + await inboxShareMenuRun('hive', 'rfc', 'plaud', 'r1'); + await inboxShareMenuRun('hive', 'dibs', 'plaud', 'r1'); + await inboxShareMenuRun('hive', 'knowledge', 'plaud', 'r1'); + await inboxShareMenuRun('link', 'copy', 'plaud', 'r1'); + await inboxShareMenuRun('link', 'native', 'plaud', 'r1'); + assert.deepStrictEqual(calls, [['route', 'plaud', 'r1', 'spek_rfc'], ['route', 'plaud', 'r1', 'dibs'], ['dismiss', 'plaud', 'r1'], ['copy', 'plaud', 'r1'], ['native', 'plaud', 'r1']]); + // Bulk menu: Knowledge runs the bulk handler. + calls.length = 0; + assert.deepStrictEqual(ids(inboxBulkMenuGroups()), ['hive:knowledge']); + inboxBulkMenuRun('knowledge'); assert.deepStrictEqual(calls, [['bulk-dismiss']]); + // Registration point: another feature adds one entry. + const ran = []; + inboxShareHiveActions.splice(1, 0, { id: 'spek', label: 'spek…', enabled: (it, role) => role === 'owner' ? true : false, run: it => ran.push(it.id) }); + assert.deepStrictEqual(ids(inboxShareMenuGroups(item()))[0], 'hive:rfc,spek,knowledge,dibs'); + await inboxShareMenuRun('hive', 'spek', 'plaud', 'r1'); assert.deepStrictEqual(ran, ['r1']); +})().catch(e => { console.error(e); process.exit(1); }); +`, + }, "\n") + runStageTrackerRowActionsScript(t, script) +} diff --git a/src/pkg/dashboard/static-src/js/inbox.js b/src/pkg/dashboard/static-src/js/inbox.js index eef67f7bb2..2540e5d750 100644 --- a/src/pkg/dashboard/static-src/js/inbox.js +++ b/src/pkg/dashboard/static-src/js/inbox.js @@ -311,13 +311,7 @@ let actions = ''; if (inboxViewerCanPlay()) actions += ''; actions += ''; - if (owner) { - const retry = (d) => routes[d] && routes[d].status === 'failed' ? 'Retry ' : '→ '; - actions += ''; - if (!it.dismissed) actions += ''; - else actions += ''; - } - actions += ''; + actions += ''; return '
' + (owner ? '' : '') + '
' + inboxSourceIcon(it.source) + '
' + @@ -417,17 +411,135 @@ if (at < 0) return ''; try { return decodeURIComponent(h.slice(at + INBOX_SHARE_HASH.length).split('&')[0]); } catch (e) { return ''; } } - async function inboxShare(src, id) { - const it = inboxFind(src, id); + async function inboxShareCopy(src, id) { const url = inboxShareLink(src, id); - const title = (it && it.title) || 'Inbox item'; - if (navigator.share) { - try { await navigator.share({ title: title, url: url }); return; } - catch (e) { if (e && e.name === 'AbortError') return; } - } if (await writeClipboardText(url)) showToast('Inbox link copied', 'success'); else showToast('Copy this Inbox link: ' + url, 'info', true); } + async function inboxShareNative(src, id) { + const it = inboxFind(src, id); + try { await navigator.share({ title: (it && it.title) || 'Inbox item', url: inboxShareLink(src, id) }); } + catch (e) { if (!e || e.name !== 'AbortError') await inboxShareCopy(src, id); } + } + // The Share menu has two groups. Hive actions file or keep the item and + // are owner-only (the route and dismiss APIs are); Link actions only share + // a link. Each entry is {id, label, enabled(item, role), run(item)} where + // label is a string or fn(item), and enabled returns true, false (hide) or + // a string (show disabled, the string is the reason). Other features add + // one entry to inboxShareHiveActions (in menu order), e.g. the spek + // session action, instead of a new row button. An entry may also carry + // bulk(items) to appear in the multi-select Hive menu. + const inboxShareHiveActions = [ + { id: 'rfc', dest: 'spek_rfc', label: 'RFC…', enabled: (it, role) => role !== 'owner' ? false : it.pending ? INBOX_NO_TEXT_REASON : !(((_inboxCache || {}).repos || []).length) ? 'No RFC repository configured: set one in Settings → Inbox' : true, run: it => inboxOpenRoute(it.source, it.id, 'spek_rfc') }, + { id: 'knowledge', label: it => it.dismissed ? 'Back to inbox' : 'Knowledge', enabled: (it, role) => role === 'owner', run: it => it.dismissed ? inboxUndismiss(it.source, it.id) : inboxDismiss(it.source, it.id), bulkLabel: 'Knowledge', bulk: () => inboxDismissSelected() }, + { id: 'dibs', dest: 'dibs', label: 'DIBS', enabled: (it, role) => role !== 'owner' ? false : inboxDibsReady() ? true : 'Not configured: set the dibs URL in Settings → Inbox → dibs URL', run: it => inboxOpenRoute(it.source, it.id, 'dibs') }, + ]; + const inboxShareLinkActions = [ + { id: 'copy', label: 'Copy link', enabled: () => true, run: it => inboxShareCopy(it.source, it.id) }, + { id: 'native', label: 'Share…', enabled: () => typeof navigator !== 'undefined' && !!navigator.share, run: it => inboxShareNative(it.source, it.id) }, + ]; + const INBOX_NO_TEXT_REASON = 'No transcript yet: use 🎧 Transcribe first'; + function inboxDibsReady() { const st = (_inboxCache || {}).settings || {}; return !!st.dibs_url && !!st.dibs_token_set; } + // inboxShareMenuGroups resolves the registries for one item and the + // viewer's role into labelled groups; empty groups are dropped. + function inboxShareMenuGroups(it) { + const role = window._hiveRole; + const routes = (it && it.routes) || {}; + const resolve = (list) => list.map(a => { + const en = a.enabled(it, role); + if (en === false) return null; + let label = typeof a.label === 'function' ? a.label(it) : a.label; + if (a.dest && routes[a.dest] && routes[a.dest].status === 'failed') label = 'Retry ' + label; + return { id: a.id, label, disabled: typeof en === 'string', hint: typeof en === 'string' ? en : '' }; + }).filter(Boolean); + return [{ id: 'hive', label: 'Hive', items: resolve(inboxShareHiveActions) }, { id: 'link', label: 'Link', items: resolve(inboxShareLinkActions) }].filter(g => g.items.length); + } + function inboxShareMenuHtml(groups, src, id) { + return ''; + } + // inboxShareMenuRun calls the registered handler of one entry. + async function inboxShareMenuRun(group, act, src, id) { + const it = inboxFind(src, id); + const entry = (group === 'hive' ? inboxShareHiveActions : inboxShareLinkActions).find(a => a.id === act); + if (it && entry) await entry.run(it); + } + // Bulk Hive menu: entries with bulk(), owner only. + function inboxBulkMenuGroups() { + if (window._hiveRole !== 'owner') return []; + const items = inboxShareHiveActions.filter(a => typeof a.bulk === 'function').map(a => ({ id: a.id, label: a.bulkLabel || (typeof a.label === 'function' ? a.id : a.label), disabled: false, hint: '' })); + return items.length ? [{ id: 'hive', label: 'Hive', items }] : []; + } + function inboxBulkMenuRun(act) { + const entry = inboxShareHiveActions.find(a => a.id === act); + if (entry && entry.bulk) return entry.bulk(Array.from(_inboxSelected)); + } + let _inboxShareMenu = null; + function inboxShareMenuClose(restore) { + const m = _inboxShareMenu; + if (!m) return; + _inboxShareMenu = null; + document.removeEventListener('pointerdown', m.onAway, true); + document.removeEventListener('keydown', m.onKey, true); + m.el.remove(); + m.btn.setAttribute('aria-expanded', 'false'); + if (restore && m.btn.focus) m.btn.focus(); + } + function inboxShareMenuFocus(el, dir, from) { + const items = Array.from(el.querySelectorAll('[role="menuitem"]')).filter(b => b.getAttribute('aria-disabled') !== 'true'); + if (!items.length) { el.focus(); return; } + let i = items.indexOf(from); + if (dir === 'first') i = 0; else if (dir === 'last') i = items.length - 1; else i = (i + dir + items.length) % items.length; + items[i].focus(); + } + function inboxPopMenu(btn, html, onPick) { + if (_inboxShareMenu) { const same = _inboxShareMenu.btn === btn; inboxShareMenuClose(false); if (same) return; } + const tpl = document.createElement('template'); + tpl.innerHTML = html; + const el = tpl.content.firstElementChild; + document.body.appendChild(el); + const r = btn.getBoundingClientRect(); + el.style.setProperty('left', Math.max(0, Math.min(r.left, window.innerWidth - el.offsetWidth)) + 'px'); + el.style.setProperty('top', r.bottom + 'px'); + btn.setAttribute('aria-expanded', 'true'); + const m = { el, btn }; + m.onAway = e => { if (!el.contains(e.target) && !btn.contains(e.target)) inboxShareMenuClose(false); }; + m.onKey = e => { + if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); inboxShareMenuClose(true); return; } + const b = e.target.closest ? e.target.closest('[role="menuitem"]') : null; + switch (e.key) { + case 'ArrowDown': e.preventDefault(); inboxShareMenuFocus(el, 1, b); break; + case 'ArrowUp': e.preventDefault(); inboxShareMenuFocus(el, -1, b); break; + case 'Home': e.preventDefault(); inboxShareMenuFocus(el, 'first'); break; + case 'End': e.preventDefault(); inboxShareMenuFocus(el, 'last'); break; + case 'Tab': inboxShareMenuClose(true); break; + } + }; + el.addEventListener('click', e => { + const b = e.target.closest('[data-inbox-share-act]'); + if (!b || b.getAttribute('aria-disabled') === 'true') return; + e.preventDefault(); + inboxShareMenuClose(true); + onPick(b.dataset); + }); + document.addEventListener('pointerdown', m.onAway, true); + document.addEventListener('keydown', m.onKey, true); + _inboxShareMenu = m; + inboxShareMenuFocus(el, 'first'); + } + // inboxShare opens the per-item Share menu under its button. + function inboxShare(src, id, btn) { + const it = inboxFind(src, id); + if (!it) return; + inboxPopMenu(btn, inboxShareMenuHtml(inboxShareMenuGroups(it), src, id), d => inboxShareMenuRun(d.inboxShareGroup, d.inboxShareAct, d.src, d.id)); + } + // inboxBulkMenu opens the Hive menu of the multi-select bar. + function inboxBulkMenu(btn) { + inboxPopMenu(btn, inboxShareMenuHtml(inboxBulkMenuGroups(), '', ''), d => inboxBulkMenuRun(d.inboxShareAct)); + } let _inboxFocusKey = inboxFocusKeyFromHash(location.hash); window.addEventListener('hashchange', (e) => { const key = inboxFocusKeyFromHash(e.newURL || location.hash); @@ -490,7 +602,7 @@ if (owner && shown.length) { const sel = _inboxSelected.size; html += '
' + - (sel ? '' : '') + '
'; + (sel ? '' : '') + '
'; } if (!shown.length) html += '
' + (items.length ? 'Everything is triaged. Toggle “show processed” to see filed and dismissed items.' : 'Nothing yet. Connect Plaud or another voice source under Knowledge → Integrations; new recordings land here after the next sync (a newly added connector starts on the next hive restart).') + '
'; else html += '
' + shown.map(inboxItemHtml).join('') + '
'; @@ -551,11 +663,13 @@ body += '

A hive agent drafts a spec from the transcript with spektacular, then runs spektacular publish to file one RFC issue plus child issues on the chosen repository. The children are picked up by the hive like any other issue.

' + '' + (repos.length ? '' : '

No repositories configured on this hive.

'); + } else { + body += '

Posts the title, summary and transcript to dibs as a private draft idea' + (settings.dibs_url ? ' at ' + escapeHtml(settings.dibs_url) + '' : '') + '. Provenance links back to ' + escapeHtml(src) + '://recordings/' + escapeHtml(id) + '.

'; } body += '' + '
' + - '
'; - kbShowModal('→ RFC (spektacular)', body, { width: '520px' }); + ''; + kbShowModal(dest === 'spek_rfc' ? '→ RFC (spektacular)' : '→ DIBS', body, { width: '520px' }); } async function inboxConfirmRoute(src, id, dest) { const repoEl = document.getElementById('inbox-route-repo'); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index 94bd768454..5e03ac745c 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -47645,13 +47645,7 @@ let actions = ''; if (inboxViewerCanPlay()) actions += ''; actions += ''; - if (owner) { - const retry = (d) => routes[d] && routes[d].status === 'failed' ? 'Retry ' : '→ '; - actions += ''; - if (!it.dismissed) actions += ''; - else actions += ''; - } - actions += ''; + actions += ''; return '
' + (owner ? '' : '') + '
' + inboxSourceIcon(it.source) + '
' + @@ -47751,17 +47745,135 @@ if (at < 0) return ''; try { return decodeURIComponent(h.slice(at + INBOX_SHARE_HASH.length).split('&')[0]); } catch (e) { return ''; } } - async function inboxShare(src, id) { - const it = inboxFind(src, id); + async function inboxShareCopy(src, id) { const url = inboxShareLink(src, id); - const title = (it && it.title) || 'Inbox item'; - if (navigator.share) { - try { await navigator.share({ title: title, url: url }); return; } - catch (e) { if (e && e.name === 'AbortError') return; } - } if (await writeClipboardText(url)) showToast('Inbox link copied', 'success'); else showToast('Copy this Inbox link: ' + url, 'info', true); } + async function inboxShareNative(src, id) { + const it = inboxFind(src, id); + try { await navigator.share({ title: (it && it.title) || 'Inbox item', url: inboxShareLink(src, id) }); } + catch (e) { if (!e || e.name !== 'AbortError') await inboxShareCopy(src, id); } + } + // The Share menu has two groups. Hive actions file or keep the item and + // are owner-only (the route and dismiss APIs are); Link actions only share + // a link. Each entry is {id, label, enabled(item, role), run(item)} where + // label is a string or fn(item), and enabled returns true, false (hide) or + // a string (show disabled, the string is the reason). Other features add + // one entry to inboxShareHiveActions (in menu order), e.g. the spek + // session action, instead of a new row button. An entry may also carry + // bulk(items) to appear in the multi-select Hive menu. + const inboxShareHiveActions = [ + { id: 'rfc', dest: 'spek_rfc', label: 'RFC…', enabled: (it, role) => role !== 'owner' ? false : it.pending ? INBOX_NO_TEXT_REASON : !(((_inboxCache || {}).repos || []).length) ? 'No RFC repository configured: set one in Settings → Inbox' : true, run: it => inboxOpenRoute(it.source, it.id, 'spek_rfc') }, + { id: 'knowledge', label: it => it.dismissed ? 'Back to inbox' : 'Knowledge', enabled: (it, role) => role === 'owner', run: it => it.dismissed ? inboxUndismiss(it.source, it.id) : inboxDismiss(it.source, it.id), bulkLabel: 'Knowledge', bulk: () => inboxDismissSelected() }, + { id: 'dibs', dest: 'dibs', label: 'DIBS', enabled: (it, role) => role !== 'owner' ? false : inboxDibsReady() ? true : 'Not configured: set the dibs URL in Settings → Inbox → dibs URL', run: it => inboxOpenRoute(it.source, it.id, 'dibs') }, + ]; + const inboxShareLinkActions = [ + { id: 'copy', label: 'Copy link', enabled: () => true, run: it => inboxShareCopy(it.source, it.id) }, + { id: 'native', label: 'Share…', enabled: () => typeof navigator !== 'undefined' && !!navigator.share, run: it => inboxShareNative(it.source, it.id) }, + ]; + const INBOX_NO_TEXT_REASON = 'No transcript yet: use 🎧 Transcribe first'; + function inboxDibsReady() { const st = (_inboxCache || {}).settings || {}; return !!st.dibs_url && !!st.dibs_token_set; } + // inboxShareMenuGroups resolves the registries for one item and the + // viewer's role into labelled groups; empty groups are dropped. + function inboxShareMenuGroups(it) { + const role = window._hiveRole; + const routes = (it && it.routes) || {}; + const resolve = (list) => list.map(a => { + const en = a.enabled(it, role); + if (en === false) return null; + let label = typeof a.label === 'function' ? a.label(it) : a.label; + if (a.dest && routes[a.dest] && routes[a.dest].status === 'failed') label = 'Retry ' + label; + return { id: a.id, label, disabled: typeof en === 'string', hint: typeof en === 'string' ? en : '' }; + }).filter(Boolean); + return [{ id: 'hive', label: 'Hive', items: resolve(inboxShareHiveActions) }, { id: 'link', label: 'Link', items: resolve(inboxShareLinkActions) }].filter(g => g.items.length); + } + function inboxShareMenuHtml(groups, src, id) { + return ''; + } + // inboxShareMenuRun calls the registered handler of one entry. + async function inboxShareMenuRun(group, act, src, id) { + const it = inboxFind(src, id); + const entry = (group === 'hive' ? inboxShareHiveActions : inboxShareLinkActions).find(a => a.id === act); + if (it && entry) await entry.run(it); + } + // Bulk Hive menu: entries with bulk(), owner only. + function inboxBulkMenuGroups() { + if (window._hiveRole !== 'owner') return []; + const items = inboxShareHiveActions.filter(a => typeof a.bulk === 'function').map(a => ({ id: a.id, label: a.bulkLabel || (typeof a.label === 'function' ? a.id : a.label), disabled: false, hint: '' })); + return items.length ? [{ id: 'hive', label: 'Hive', items }] : []; + } + function inboxBulkMenuRun(act) { + const entry = inboxShareHiveActions.find(a => a.id === act); + if (entry && entry.bulk) return entry.bulk(Array.from(_inboxSelected)); + } + let _inboxShareMenu = null; + function inboxShareMenuClose(restore) { + const m = _inboxShareMenu; + if (!m) return; + _inboxShareMenu = null; + document.removeEventListener('pointerdown', m.onAway, true); + document.removeEventListener('keydown', m.onKey, true); + m.el.remove(); + m.btn.setAttribute('aria-expanded', 'false'); + if (restore && m.btn.focus) m.btn.focus(); + } + function inboxShareMenuFocus(el, dir, from) { + const items = Array.from(el.querySelectorAll('[role="menuitem"]')).filter(b => b.getAttribute('aria-disabled') !== 'true'); + if (!items.length) { el.focus(); return; } + let i = items.indexOf(from); + if (dir === 'first') i = 0; else if (dir === 'last') i = items.length - 1; else i = (i + dir + items.length) % items.length; + items[i].focus(); + } + function inboxPopMenu(btn, html, onPick) { + if (_inboxShareMenu) { const same = _inboxShareMenu.btn === btn; inboxShareMenuClose(false); if (same) return; } + const tpl = document.createElement('template'); + tpl.innerHTML = html; + const el = tpl.content.firstElementChild; + document.body.appendChild(el); + const r = btn.getBoundingClientRect(); + el.style.setProperty('left', Math.max(0, Math.min(r.left, window.innerWidth - el.offsetWidth)) + 'px'); + el.style.setProperty('top', r.bottom + 'px'); + btn.setAttribute('aria-expanded', 'true'); + const m = { el, btn }; + m.onAway = e => { if (!el.contains(e.target) && !btn.contains(e.target)) inboxShareMenuClose(false); }; + m.onKey = e => { + if (e.key === 'Escape') { e.preventDefault(); e.stopPropagation(); inboxShareMenuClose(true); return; } + const b = e.target.closest ? e.target.closest('[role="menuitem"]') : null; + switch (e.key) { + case 'ArrowDown': e.preventDefault(); inboxShareMenuFocus(el, 1, b); break; + case 'ArrowUp': e.preventDefault(); inboxShareMenuFocus(el, -1, b); break; + case 'Home': e.preventDefault(); inboxShareMenuFocus(el, 'first'); break; + case 'End': e.preventDefault(); inboxShareMenuFocus(el, 'last'); break; + case 'Tab': inboxShareMenuClose(true); break; + } + }; + el.addEventListener('click', e => { + const b = e.target.closest('[data-inbox-share-act]'); + if (!b || b.getAttribute('aria-disabled') === 'true') return; + e.preventDefault(); + inboxShareMenuClose(true); + onPick(b.dataset); + }); + document.addEventListener('pointerdown', m.onAway, true); + document.addEventListener('keydown', m.onKey, true); + _inboxShareMenu = m; + inboxShareMenuFocus(el, 'first'); + } + // inboxShare opens the per-item Share menu under its button. + function inboxShare(src, id, btn) { + const it = inboxFind(src, id); + if (!it) return; + inboxPopMenu(btn, inboxShareMenuHtml(inboxShareMenuGroups(it), src, id), d => inboxShareMenuRun(d.inboxShareGroup, d.inboxShareAct, d.src, d.id)); + } + // inboxBulkMenu opens the Hive menu of the multi-select bar. + function inboxBulkMenu(btn) { + inboxPopMenu(btn, inboxShareMenuHtml(inboxBulkMenuGroups(), '', ''), d => inboxBulkMenuRun(d.inboxShareAct)); + } let _inboxFocusKey = inboxFocusKeyFromHash(location.hash); window.addEventListener('hashchange', (e) => { const key = inboxFocusKeyFromHash(e.newURL || location.hash); @@ -47824,7 +47936,7 @@ if (owner && shown.length) { const sel = _inboxSelected.size; html += '
' + - (sel ? '' : '') + '
'; + (sel ? '' : '') + '
'; } if (!shown.length) html += '
' + (items.length ? 'Everything is triaged. Toggle “show processed” to see filed and dismissed items.' : 'Nothing yet. Connect Plaud or another voice source under Knowledge → Integrations; new recordings land here after the next sync (a newly added connector starts on the next hive restart).') + '
'; else html += '
' + shown.map(inboxItemHtml).join('') + '
'; @@ -47885,11 +47997,13 @@ body += '

A hive agent drafts a spec from the transcript with spektacular, then runs spektacular publish to file one RFC issue plus child issues on the chosen repository. The children are picked up by the hive like any other issue.

' + '' + (repos.length ? '' : '

No repositories configured on this hive.

'); + } else { + body += '

Posts the title, summary and transcript to dibs as a private draft idea' + (settings.dibs_url ? ' at ' + escapeHtml(settings.dibs_url) + '' : '') + '. Provenance links back to ' + escapeHtml(src) + '://recordings/' + escapeHtml(id) + '.

'; } body += '' + '
' + - '
'; - kbShowModal('→ RFC (spektacular)', body, { width: '520px' }); + ''; + kbShowModal(dest === 'spek_rfc' ? '→ RFC (spektacular)' : '→ DIBS', body, { width: '520px' }); } async function inboxConfirmRoute(src, id, dest) { const repoEl = document.getElementById('inbox-route-repo'); From 4b7b07f14b1fbbb8916798185767391be29765d6 Mon Sep 17 00:00:00 2001 From: Andy Anderson Date: Mon, 16 Nov 2026 07:01:49 -0500 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=8C=B1=20Inbox:=20update=20row=20test?= =?UTF-8?q?=20for=20the=20Share=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andy Anderson --- dashboard/test/inbox-item.test.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dashboard/test/inbox-item.test.js b/dashboard/test/inbox-item.test.js index 09be6f6957..857d0b5feb 100644 --- a/dashboard/test/inbox-item.test.js +++ b/dashboard/test/inbox-item.test.js @@ -67,7 +67,8 @@ test('pending item explains that Plaud has no text yet and never shows the MCP e assert.match(html, /▶ Play recording/); assert.match(html, /data-action="inboxToggleTranscript"/); assert.match(html, /data-inbox-media="plaud\/f_1"/); - for (const action of ['inboxOpenRoute', 'inboxDismiss', 'inboxOpenFact']) assert.match(html, new RegExp('data-action="' + action + '"'), action + ' action kept'); + for (const action of ['inboxShare', 'inboxOpenFact']) assert.match(html, new RegExp('data-action="' + action + '"'), action + ' action kept'); + for (const action of ['inboxOpenRoute', 'inboxDismiss']) assert.doesNotMatch(html, new RegExp('data-action="' + action + '"'), action + ' moved into the Share menu'); assert.doesNotMatch(html, /