Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Merge batch 11-05 i2125: #3185 #3180 (#3189)

0xken15b4b6a75218f6
diff --git a/backend/integration/superTabMessageEdits.test.ts b/backend/integration/superTabMessageEdits.test.ts
index 9acc724d0..f846b5252 100644
--- a/backend/integration/superTabMessageEdits.test.ts
+++ b/backend/integration/superTabMessageEdits.test.ts
@@ -12,6 +12,7 @@ import { SuperTabStore } from '../src/superTabs/store.js'
import { EXPIRED_UPLOAD, MemoryAttachmentStore } from '../src/superTabs/attachments.js'
import type { Command } from '../src/superTabs/commands.js'
import { DELETED_TEXT } from '../src/superTabs/messageEdits.js'
+import { sweepUnsentAttachments } from '../src/lib/attachmentSweep.js'
import { poolRows } from './hostRows.test-support.js'
import { profiled } from './plans.test-support.js'
@@ -153,6 +154,75 @@ describe('message.edit', () => {
})
describe('message.delete', () => {
+ it.each([false, true])('lets only the owner delete their Buddy proposal, removing its content with replies: %s', async hasReplies => {
+ const f = await swarm()
+ const { chat, agentId } = await f.buddy()
+ const line = 'Fix my login'
+ const ask = await f.send(chat, line)
+ const command: Command = { type: 'buddy.propose', conversationId: chat, ownerMessageId: ask, projectId: f.web.projectId,
+ text: line, goal: line, scope: 'Private detail copied into the scope', priority: 'normal' }
+ const id = String((await f.execute(command, peer, agentId)).result.messageId)
+ const answer = hasReplies ? await f.send(f.web.conversationId, 'I can reproduce it.', other, { replyTo: id }) : undefined
+ for (const person of [owner, other]) await expect(f.remove(f.web.conversationId, id, person)).rejects.toThrow(refused('FORBIDDEN'))
+ await expect(f.remove(f.web.conversationId, id, owner, f.pm)).rejects.toThrow(expect.objectContaining({ status: 403 }))
+ await expect(f.remove(f.web.conversationId, id, peer, agentId)).rejects.toThrow(expect.objectContaining({ status: 403 }))
+ await expect(f.edit(f.web.conversationId, id, 'Rewritten')).rejects.toThrow(refused('FORBIDDEN'))
+ expect((await f.remove(f.web.conversationId, id)).result).toMatchObject({ changed: true, kept: hasReplies })
+ const row = await db.superTabMessage.findUnique({ where: { id } })
+ if (hasReplies) {
+ expect(row).toMatchObject({ text: DELETED_TEXT, deletedAt: expect.any(Date) })
+ expect(row?.source ?? null).toBeNull()
+ const thread = await f.page(f.web.conversationId, other, { thread: id })
+ expect(thread.messages.map(m => m.id)).toEqual([id, answer])
+ expect(JSON.stringify(thread)).not.toContain(line)
+ expect(JSON.stringify(thread)).not.toContain(command.scope)
+ await expect(f.remove(f.web.conversationId, id)).rejects.toThrow(refused('MESSAGE_DELETED'))
+ } else {
+ expect(row).toBeNull()
+ expect((await f.page(f.web.conversationId)).messages.some(m => m.id === id)).toBe(false)
+ }
+ expect(await db.superTabDelivery.count({ where: { tabId: f.tab, messageId: id, status: { in: ['queued', 'claimed', 'gathered'] } } })).toBe(0)
+ // Deleting the post does not grant the Buddy permission to post the same ask again.
+ await expect(f.execute(command, peer, agentId)).rejects.toThrow(refused('PROPOSAL_SENT'))
+ })
+
+ it('never treats a non-proposal source or a mismatched source owner as permission to delete', async () => {
+ const f = await swarm()
+ const id = await f.send(f.web.conversationId, 'Own message')
+ for (const source of [{ kind: 'buddy-proposal', personId: other.sub }, { kind: 'task-request', personId: peer.sub }, { kind: 'buddy-proposal' }]) {
+ await db.superTabMessage.update({ where: { id }, data: { source } })
+ await expect(f.remove(f.web.conversationId, id)).rejects.toThrow(refused('FORBIDDEN'))
+ }
+ })
+
+ it.each([false, true])('preserves files handed on from the owner chat when deleting a proposal, with replies: %s', async hasReplies => {
+ const f = await swarm()
+ const { chat, agentId } = await f.buddy()
+ const upload = async (name: string, asBuddy = false) => (await f.store.upload(peer, f.tab, chat,
+ { name, mime: 'text/plain', body: Readable.from([Buffer.from(name)]) }, asBuddy ? agentId : undefined)).attachment.id
+ const handed = await upload('owner-note.txt'), owned = await upload('proposal-note.txt', true)
+ const ask = await f.send(chat, 'Send the notes to the PM', peer, { attachmentIds: [handed] })
+ const id = String((await f.execute({ type: 'buddy.propose', conversationId: chat, ownerMessageId: ask, projectId: f.web.projectId,
+ text: 'Send the notes to the PM', goal: 'Fix drafts', scope: 'Desktop', priority: 'normal', attachmentIds: [handed, owned] }, peer, agentId)).result.messageId)
+ expect(await db.superTabAttachment.findUniqueOrThrow({ where: { id: handed } })).toMatchObject({ usedBy: ask, proposedBy: id })
+ expect(await db.superTabAttachment.findUniqueOrThrow({ where: { id: owned } })).toMatchObject({ usedBy: id })
+ if (hasReplies) await f.send(f.web.conversationId, 'I can reproduce it.', other, { replyTo: id })
+ const entries = await profiled(db, () => f.remove(f.web.conversationId, id))
+ const kept = await db.superTabAttachment.findUniqueOrThrow({ where: { id: handed } })
+ expect(kept.usedBy).toBe(ask)
+ expect(kept.proposedBy ?? null).toBeNull()
+ expect((await db.superTabAttachment.findUniqueOrThrow({ where: { id: owned } })).usedBy).toBe(EXPIRED_UPLOAD)
+ expect((await f.page(chat, peer)).messages.find(m => m.id === ask)?.attachments).toEqual([expect.objectContaining({ id: handed })])
+ const updates = entries.filter(e => e.ns.endsWith('.SuperTabAttachment'))
+ expect(updates.length).toBeGreaterThan(0)
+ expect(updates.filter(e => /COLLSCAN/.test(String(e.planSummary)))).toEqual([])
+ await sweepUnsentAttachments(db, { store: f.files, prefix: 'super-tabs', publicBase: 'https://cdn.example.test' },
+ new Date(Date.now() + 48 * 3_600_000), { chunk: 100, chunks: 1, pauseMs: 0 })
+ expect(await db.superTabAttachment.findUnique({ where: { id: handed } })).toMatchObject({ usedBy: ask })
+ expect(await f.files.read(kept.objectKey)).toEqual(Buffer.from('owner-note.txt'))
+ expect(await db.superTabAttachment.findUnique({ where: { id: owned } })).toBeNull()
+ })
+
it('removes a message with no replies: its row, reactions, Activity, open deliveries and files', async () => {
const f = await swarm()
const root = await f.send(f.web.conversationId, 'Owner root', owner)
diff --git a/backend/integration/superTabSwarmBuddy.test.ts b/backend/integration/superTabSwarmBuddy.test.ts
index cd92e80b6..adaba81be 100644
--- a/backend/integration/superTabSwarmBuddy.test.ts
+++ b/backend/integration/superTabSwarmBuddy.test.ts
@@ -186,6 +186,29 @@ describe('the one Buddy sends a proposal to a project its person reads (Scholes,
expect(await f.store.delivery(owner, f.tab, f.pms.web, delivery.id, { type: 'claim', claimId: randomUUID() })).toMatchObject({ otherAccount: true })
})
+ it('refuses private text after an unquoted offer, then posts only the quoted line after a fresh ok', async () => {
+ const f = await swarm()
+ const { chat, main } = await buddy(f)
+ const line = 'Keep drafts offline'
+ const privateText = 'This sentence is only for you. My plans must stay private.'
+ await send(f, chat, `I'll post this as you: ${line}\n\n${privateText}`, {}, peer, main)
+ const firstOk = await ask(f, chat, 'ok')
+ for (const text of [line, `${line}\n\n${privateText}`]) {
+ await expect(propose(f, chat, firstOk, f.web.projectId, main, { text })).rejects.toMatchObject({ code: 'PROPOSAL_UNSHOWN' })
+ }
+ expect(await texts(f, f.web.conversationId, owner)).not.toContain(privateText)
+ // A missing closing quote must not turn later private lines into the approved offer when a quote appears there.
+ await send(f, chat, `I'll post this as you: "${line}\n\n${privateText}"`, {}, peer, main)
+ const multilineOk = await ask(f, chat, 'ok')
+ await expect(propose(f, chat, multilineOk, f.web.projectId, main, { text: `${line}\n\n${privateText}` })).rejects.toMatchObject({ code: 'PROPOSAL_UNSHOWN' })
+ await send(f, chat, `I'll post this as you: "${line}"\n\n${privateText}`, {}, peer, main)
+ const ok = await ask(f, chat, 'ok')
+ await expect(propose(f, chat, ok, f.web.projectId, main, { text: `${line}\n\n${privateText}` })).rejects.toMatchObject({ code: 'PROPOSAL_UNSHOWN' })
+ const sent = String((await propose(f, chat, ok, f.web.projectId, main, { text: line })).result.messageId)
+ expect(await db.superTabMessage.findUniqueOrThrow({ where: { id: sent } })).toMatchObject({ text: line, author: { kind: 'person', id: peer.sub } })
+ expect(JSON.stringify(await texts(f, f.web.conversationId, owner))).not.toContain(privateText)
+ })
+
it('tells its person in their chat, in the Swarm\'s own words, waking nobody; a refused send says nothing', async () => {
const f = await swarm()
const { chat, main } = await buddy(f)
diff --git a/backend/src/superTabs/buddies.test.ts b/backend/src/superTabs/buddies.test.ts
index 66a79247a..224f22d47 100644
--- a/backend/src/superTabs/buddies.test.ts
+++ b/backend/src/superTabs/buddies.test.ts
@@ -611,7 +611,7 @@ describe('a Buddy\'s proposal to the PM', () => {
expect(() => f.run({ type: 'buddy.propose', conversationId: f.chat, ownerMessageId: 'ask', ...proposal, text: 'Offline drafts' }, buddy,
okayed(f, [], 'Send this to the PM: Offline drafts please'))).toThrow(expect.objectContaining({ code: 'PROPOSAL_UNSHOWN' })) }
expect(send('Keep drafts\noffline', ['I\'ll post this as you: “Keep drafts offline”'])).toBe('Keep drafts\noffline')
- expect(send('Fix the jump-to freeze', ['In Secret, Ken said the client is leaving. I’ll post this as you: Fix the jump-to freeze'])).toBe('Fix the jump-to freeze')
+ expect(send('Fix the jump-to freeze', ['In Secret, Ken said the client is leaving. I’ll post this as you: “Fix the jump-to freeze”'])).toBe('Fix the jump-to freeze')
// Words the owner never saw: not in their ask, not in a line shown before it.
// A shown line or the ask whole, never a piece cut from it (security review 1 of #3024): every word seen, not that line.
const both = 'I\'ll post this as you: “Fix the login. Don\'t delete the old accounts table.” OK?'
@@ -656,17 +656,60 @@ describe('a Buddy\'s proposal to the PM', () => {
// The rest of the message around the first quoted line, which passed whole, is not a line the owner was shown to post.
expect(passes('“Fix the login” or, if you prefer, “Delete the old accounts table', [two])).toBe(false)
expect(passes('"Keep drafts offline" OK?', ['I\'ll post this as you: "Keep drafts offline" OK?'])).toBe(false)
- // An unquoted line after the marker is still taken whole, as today, and never a piece of it or a quote inside it.
- expect(passes('Fix the "login" page', ['I’ll post this as you: Fix the "login" page'])).toBe(true)
+ // A quote inside an unquoted offer never makes that offer safe to send.
+ expect(passes('Fix the "login" page', ['I’ll post this as you: Fix the "login" page'])).toBe(false)
expect(passes('login', ['I’ll post this as you: Fix the "login" page'])).toBe(false)
// Only a pair of the same kind closes the line (security review 2 of #3055): a straight quote inside a curly one, or a
- // curly one opened inside it, is part of the line the owner read, never its end. An unclosed one leaves all of it whole, as today.
+ // curly one opened inside it, is part of the line the owner read, never its end. An unclosed offer cannot be posted.
for (const [text, shown] of [['Ship it', 'I\'ll post this as you: “Ship it" is wrong, wait for the fix”'],
['We merge', 'I\'ll post this as you: "We merge” only after Ken signs off"'],
['A “B', 'I\'ll post this as you: “A “B” C”'], ['ship it', 'I\'ll post this as you: “Keep drafts offline" and then “ship it”']] as const)
expect(passes(text, [shown])).toBe(false)
expect(passes('We merge” only after Ken signs off', ['I\'ll post this as you: "We merge” only after Ken signs off"'])).toBe(true)
- expect(passes('“Keep drafts offline', ['I\'ll post this as you: “Keep drafts offline'])).toBe(true)
+ expect(passes('“Keep drafts offline', ['I\'ll post this as you: “Keep drafts offline'])).toBe(false)
+ })
+
+ it('refuses an unquoted offer followed by private sentences and tells the Buddy to show it again quoted', () => {
+ const { f } = asked()
+ const line = 'Fix the login'
+ const privateText = 'This next sentence is only for you. Please keep my plans private.'
+ const shown = `I'll post this as you: ${line}\n\n${privateText}`
+ for (const text of [`${line}\n\n${privateText}`, line, privateText]) {
+ expect(() => f.run({ type: 'buddy.propose', conversationId: f.chat, ownerMessageId: 'ask', ...proposal, text }, buddy,
+ okayed(f, [shown]))).toThrow(expect.objectContaining({ code: 'PROPOSAL_UNSHOWN', message: expect.stringContaining('quotes') }))
+ expect(group(f, f.chat).proposals).toBeUndefined()
+ }
+ })
+
+ it.each([['"', '"'], ['“', '”']])('posts exactly the line between %s and %s, never the private sentences after it', (open, close) => {
+ const { f } = asked()
+ const line = 'Fix the login'
+ const privateText = 'This next sentence is only for you. Please keep my plans private.'
+ const shown = `I'll post this as you: ${open}${line}${close}\n\n${privateText}`
+ for (const text of [`${line}\n\n${privateText}`, privateText]) expect(passes(text, [shown])).toBe(false)
+ const sent = f.run({ type: 'buddy.propose', conversationId: f.chat, ownerMessageId: 'ask', ...proposal, text: line }, buddy,
+ okayed(f, [shown])).messages.filter(m => m.conversationId === f.app.conversationId)
+ expect(sent).toHaveLength(1)
+ expect(sent[0]).toMatchObject({ text: line, author: { kind: 'person', id: 'peer' } })
+ expect(JSON.stringify(sent)).not.toContain(privateText)
+ })
+
+ it.each(['Fix the login', '“Fix the login', '"Fix the login', '“Fix “the login” now”', ''])('invalidates older consent when the newest offer is not a complete quoted line: %s', after => {
+ const older = 'I\'ll post this as you: “Keep drafts offline”'
+ const newer = `I'll post this as you: ${after}`
+ expect(passes('Keep drafts offline', [newer, older])).toBe(false)
+ expect(passes('Keep drafts offline', [`${older}\n${newer}`])).toBe(false)
+ if (after) expect(passes(after, [newer])).toBe(false)
+ })
+
+ it.each(['\n', '\r\n', '\u0085', '\u2028', '\u2029'])('never lets a quote span a line break into private talk (%j)', lineBreak => {
+ const older = 'I\'ll post this as you: “Keep drafts offline”'
+ const words = `Fix the login${lineBreak}This sentence is only for you.`
+ for (const [open, close] of [['"', '"'], ['“', '”']]) {
+ const shown = `I'll post this as you: ${open}${words}${close}`
+ expect(passes(words, [shown])).toBe(false)
+ expect(passes('Keep drafts offline', [shown, older])).toBe(false)
+ }
})
// Task #2989: the Buddy showed one line, then replaced it; the owner's ok is for the newest one only.
diff --git a/backend/src/superTabs/buddies.ts b/backend/src/superTabs/buddies.ts
index 68f98577c..ce3c85fd5 100644
--- a/backend/src/superTabs/buddies.ts
+++ b/backend/src/superTabs/buddies.ts
@@ -244,21 +244,21 @@ const ownerLines = (said: string): string[] => {
return [said, ...lead ? [unquoted(said.slice(colon + 1))] : [], ...quotedIn(said)].map(comparable).filter(Boolean)
}
-/** The skill's marker before the line a Buddy shows its owner (swarmSkills.ts): "I'll post this as you: …". */
+/** The skill's marker before the quoted line a Buddy shows its owner (swarmSkills.ts): I'll post this as you: "…". */
const SHOWN_MARKER = /post this as you\s*:/giu
-/** The line a Buddy's message showed to post, or null with no marker. Only what follows its last marker counts (security
- * review 2 of #3024): what comes before is the Buddy's own talk, which may quote any project. If it opens with a quote, only
- * that first quoted line counts (task #2989): after the closing quote comes the Buddy's talk again ("OK?", another quote).
- * Otherwise all of it counts, whole. */
+/** The quoted line a Buddy showed to post, or null with no marker. Only its last marker counts (security review 2 of #3024).
+ * Unquoted offers exposed private sentences after the intended line (task #3322), so only a complete leading quote counts.
+ * A marker with no valid quote replaces older consent with nothing; null would incorrectly revive an older offer. */
const shownLine = (said: string): string | null => {
const marker = [...said.matchAll(SHOWN_MARKER)].at(-1)
if (!marker) return null
const after = said.slice(marker.index! + marker[0].length)
- // A pair of the same kind, with no curly opener inside (security review 2 of #3055): a mixed or nested quote is part of the
- // line the owner read, so it never ends it early; with no such pair, all of it counts whole.
- const quoted = /^\s*(?:“([^“”]*)”|"([^"]*)")/u.exec(after)
- return comparable(quoted ? quoted[1] ?? quoted[2]! : unquoted(after))
+ // A pair of the same kind, with no curly opener inside (security review 2 of #3055): a mixed or nested quote must not end
+ // the line early. A missing closing quote must not consume later private lines when another quote appears there.
+ // Anything after the closing quote is the Buddy's private talk, never part of the consent.
+ const quoted = /^\s*(?:“([^“”\r\n\u0085\u2028\u2029]*)”|"([^"\r\n\u0085\u2028\u2029]*)")/u.exec(after)
+ return quoted ? comparable(quoted[1] ?? quoted[2]!) : ''
}
/** Whether [words] are what the owner okayed (anh Dee, task #2926): the whole of their own message that asked, or the line
diff --git a/backend/src/superTabs/commands.ts b/backend/src/superTabs/commands.ts
index 940c064db..f686fee83 100644
--- a/backend/src/superTabs/commands.ts
+++ b/backend/src/superTabs/commands.ts
@@ -2638,9 +2638,9 @@ function applyCommandOnce(original: SuperTabState, actor: Actor, input: Command,
}
// What goes out is the owner's own message (anh Dee, task #2926): their words, or the one line they saw and okayed, and
// nothing else of their private chat.
- const words = command.text ?? fail('PROPOSAL_TEXT', 'Send the words to post as your owner in "text": show them the line first ("I\'ll post this as you: …"), and send it once they say ok.', 400)
+ const words = command.text ?? fail('PROPOSAL_TEXT', 'Send the words to post as your owner in "text": show them the line first with quotes (I\'ll post this as you: "…"), and send it once they say ok.', 400)
if (!okayedWords(words, ask)) {
- fail('PROPOSAL_UNSHOWN', 'Post only your owner\'s own words, or the exact line you showed them just before they said ok. Show it to them ("I\'ll post this as you: …") and send it once they agree.', 403)
+ fail('PROPOSAL_UNSHOWN', 'Post only your owner\'s own words, or the exact quoted line you showed them just before they said ok. Show it again with quotes (I\'ll post this as you: "…") and send only that line once they agree.', 403)
}
if (chat.proposals?.includes(command.ownerMessageId)) fail('PROPOSAL_SENT', 'A proposal was already sent for that message. Ask your owner before sending another.')
const attachments = [...new Set(command.attachmentIds ?? [])]
diff --git a/backend/src/superTabs/messageEdits.test.ts b/backend/src/superTabs/messageEdits.test.ts
index b6a51bed7..452e2676b 100644
--- a/backend/src/superTabs/messageEdits.test.ts
+++ b/backend/src/superTabs/messageEdits.test.ts
@@ -63,6 +63,35 @@ describe('message edits', () => {
expect(f.lead().reactionSeq ?? 0).toBe(0)
})
+ it.each([false, true])('lets only the attributed owner delete their Buddy proposal, with replies: %s', hasReplies => {
+ const f = fixture()
+ f.invite()
+ const proposalTarget = { ...target({ plain: false, author: { kind: 'person', id: 'peer' }, hasReplies }).messageChange!, proposalOwnerId: 'peer' }
+ // Even the Swarm owner cannot delete another person's proposal.
+ expect(() => f.run(remove(), owner, { messageChange: proposalTarget })).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))
+ expect(() => f.run(edit(), peer, { messageChange: proposalTarget })).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))
+ const asAgent: Actor = { kind: 'agent', agentId: f.agent(), machineOwnerId: 'peer' }
+ expect(() => f.run(remove(), asAgent, { messageChange: proposalTarget })).toThrow(expect.objectContaining({ status: 403 }))
+ expect(f.run(remove(), peer, { messageChange: proposalTarget }).result).toMatchObject({ changed: true, kept: hasReplies })
+ expect(f.lead().reactionSeq).toBe(1)
+ })
+
+ it('refuses proposal deletion when the source owner and attributed person disagree', () => {
+ const f = fixture()
+ f.invite()
+ const messageChange = { ...target({ plain: false }).messageChange!, proposalOwnerId: 'peer' }
+ for (const actor of [owner, peer]) expect(() => f.run(remove(), actor, { messageChange }))
+ .toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))
+ expect(f.lead().reactionSeq ?? 0).toBe(0)
+ })
+
+ it('keeps deleted proposals deleted and never makes a system message deletable', () => {
+ const f = fixture()
+ const messageChange = { ...target({ plain: false, deleted: true }).messageChange!, proposalOwnerId: 'owner' }
+ expect(() => f.run(remove(), owner, { messageChange })).toThrow(expect.objectContaining({ code: 'MESSAGE_DELETED' }))
+ expect(() => f.run(remove(), owner, target({ plain: false }))).toThrow(expect.objectContaining({ code: 'FORBIDDEN' }))
+ })
+
it('refuses a viewer, a system row, a deleted message and a message the store did not find', () => {
const f = fixture()
for (const command of [edit(), remove()]) {
diff --git a/backend/src/superTabs/messageEdits.ts b/backend/src/superTabs/messageEdits.ts
index a19dbc8b6..02ad106de 100644
--- a/backend/src/superTabs/messageEdits.ts
+++ b/backend/src/superTabs/messageEdits.ts
@@ -11,6 +11,8 @@ export interface MessageChangeTarget {
author: { kind: string; id: string }
/** A person's own post: no system source (parts/commit.ts counts the same rows as a person's). */
plain: boolean
+ /** Only a stored Buddy proposal supplies this: the person it was posted for. Delete only, never edit. */
+ proposalOwnerId?: string
deleted: boolean
hasFiles: boolean
/** For a delete: some other row replies in its thread, so it stays as DELETED_TEXT. */
@@ -24,11 +26,13 @@ export interface MessageChangeTarget {
type Counters = { reactionSeq?: number; lastMessageSequence: number; lastMainSequence?: number; lastPersonSequence?: number }
-/** Only the author changes a message: a person, on their own plain post. An agent (a Buddy too) never does, for anyone.
+/** Only the author changes a message: a person, on their own plain post, or deleting their own Buddy proposal (#3322).
+ * Its source owner must agree with its attribution. An agent (a Buddy too) never does, for anyone.
* A message the actor cannot see reads as unavailable, so a refusal tells nothing about it. */
-function changeable(actor: Actor, messageId: string, target: MessageChangeTarget | undefined): MessageChangeTarget {
+function changeable(actor: Actor, messageId: string, target: MessageChangeTarget | undefined, operation: 'edit' | 'delete'): MessageChangeTarget {
if (target?.messageId !== messageId) fail('NOT_FOUND', 'This message is unavailable.', 404)
- if (actor.kind !== 'person' || target.author.kind !== 'person' || target.author.id !== actor.userId || !target.plain) {
+ if (actor.kind !== 'person' || target.author.kind !== 'person' || target.author.id !== actor.userId
+ || (!target.plain && !(operation === 'delete' && target.proposalOwnerId === actor.userId))) {
fail('FORBIDDEN', 'Only its author can change this message.', 403)
}
if (target.deleted) fail('MESSAGE_DELETED', 'This message was deleted.', 409)
@@ -39,7 +43,7 @@ function changeable(actor: Actor, messageId: string, target: MessageChangeTarget
* A change bumps the group, so every reader's next read takes the page again (reactions.ts). */
export function editMessage(group: { reactionSeq?: number }, actor: Actor, messageId: string, text: string,
target: MessageChangeTarget | undefined): boolean {
- const found = changeable(actor, messageId, target)
+ const found = changeable(actor, messageId, target, 'edit')
if (!text && !found.hasFiles) fail('INVALID_MESSAGE', 'Write something, or delete the message.', 400)
if (found.text === text) return false
group.reactionSeq = (group.reactionSeq ?? 0) + 1
@@ -49,7 +53,7 @@ export function editMessage(group: { reactionSeq?: number }, actor: Actor, messa
/** `message.delete`: the row goes, or stays as DELETED_TEXT while replies hang under it. The store removes the rest. */
export function deleteMessage(group: Counters, actor: Actor, messageId: string,
target: MessageChangeTarget | undefined): { kept: boolean } {
- const found = changeable(actor, messageId, target)
+ const found = changeable(actor, messageId, target, 'delete')
group.reactionSeq = (group.reactionSeq ?? 0) + 1
if (found.hasReplies) return { kept: true }
// Each counter that pointed at the row steps back to the newest row left of its kind (parts/commit.ts numberMessages).
diff --git a/backend/src/superTabs/store.ts b/backend/src/superTabs/store.ts
index 2ef4d7ace..7966d4d72 100644
--- a/backend/src/superTabs/store.ts
+++ b/backend/src/superTabs/store.ts
@@ -2637,7 +2637,9 @@ export class SuperTabStore {
if (group && !sessionReadsRow(reader, group, state)(message)) return undefined
if ((await deliveredCopies(tx, tabId, [message])).size) return undefined
const author = message.author as { kind?: string; id?: string } | null
+ const source = message.source as { kind?: unknown; personId?: unknown } | null
const target: MessageChangeTarget = { messageId: message.id, author: { kind: String(author?.kind ?? ''), id: String(author?.id ?? '') },
+ proposalOwnerId: source?.kind === 'buddy-proposal' && typeof source.personId === 'string' ? source.personId : undefined,
plain: message.source == null, deleted: !!message.deletedAt, hasFiles: Array.isArray(message.attachments) && message.attachments.length > 0,
hasReplies: false, text: message.text, sequence: message.sequence }
// Only an author's delete reads further; anyone else is refused on the row alone.
@@ -2658,7 +2660,12 @@ export class SuperTabStore {
const row = await tx.superTabMessage.findUniqueOrThrow({ where: { id: command.messageId }, select: { id: true, conversationId: true, thread: true, attachments: true, mentions: true } })
const files = Array.isArray(row.attachments) ? (row.attachments as unknown as Attachment[]).map(a => a.id) : []
// Raw `$in` filters: Prisma sends `in` as $expr, which no index bounds (hotFilters.test.ts). By _id, and by [tabId, messageId].
- if (files.length) await tx.$runCommandRaw({ update: 'SuperTabAttachment', updates: [{ q: { _id: { $in: files }, tabId }, u: { $set: { usedBy: EXPIRED_UPLOAD } }, multi: true }] })
+ // A proposal can carry its owner's chat files without owning them (#3322 security review): expire only this row's
+ // uploads, and release only its forwarding claim. The original chat message must keep its file through the sweep.
+ if (files.length) await tx.$runCommandRaw({ update: 'SuperTabAttachment', updates: [
+ { q: { _id: { $in: files }, tabId, usedBy: row.id }, u: { $set: { usedBy: EXPIRED_UPLOAD } }, multi: true },
+ { q: { _id: { $in: files }, tabId, proposedBy: row.id }, u: { $unset: { proposedBy: '' } }, multi: true },
+ ] })
// Activity has no index by message: its rows go by the ids they were written with (activity.ts), each reaction's from its row,
// the reply's for every member it could have told.
const reactions = await tx.superTabReaction.findMany({ where: { tabId, messageId: row.id }, select: { id: true } })
@@ -2671,9 +2678,10 @@ export class SuperTabStore {
await tx.$runCommandRaw({ update: 'SuperTabDelivery', updates: [{ q: { tabId, messageId: row.id, status: { $in: [...CANCELLABLE_DELIVERY] } },
u: { $set: { status: 'cancelled', holdReason: null, holdSince: null, updatedAt: { $date: new Date(now).toISOString() } } }, multi: true }] })
if (kept) {
- // Raw: Prisma writes `{ unset: true }` into a Json field as a value instead of removing it.
+ // Raw: Prisma writes `{ unset: true }` into a Json field as a value instead of removing it. A deleted Buddy proposal's
+ // goal and scope must go too (#3322): they can repeat its text, and its source would still make it an open proposal.
await tx.$runCommandRaw({ update: 'SuperTabMessage', updates: [{ q: { _id: row.id, tabId }, u: { $set: { text: DELETED_TEXT, mentions: [],
- deletedAt: { $date: new Date(now).toISOString() } }, $unset: { attachments: '', editedAt: '' } } }] })
+ deletedAt: { $date: new Date(now).toISOString() } }, $unset: { attachments: '', editedAt: '', source: '' } } }] })
// Its own thread's summary drops the people only this root tagged.
await refreshThreads(tx, tabId, row.conversationId, [row.id])
return
diff --git a/cli/src/lib/swarmSkills.spec.ts b/cli/src/lib/swarmSkills.spec.ts
index 07c1ebdc4..a92c11e07 100644
--- a/cli/src/lib/swarmSkills.spec.ts
+++ b/cli/src/lib/swarmSkills.spec.ts
@@ -886,9 +886,11 @@ describe('the Buddy skill (Ken\'s Buddy spec, 10-28)', () => {
expect(text).toContain('One short note in your chat at each milestone: the PM took it, the task it went to, its pull request merged or released.')
expect(text).toContain('Nothing when nothing changed')
// anh Dee (task #2926): a proposal is its owner's own message: shown to them first, posted in full once they say ok.
- expect(text).toContain('Before you send, show your owner the exact line you will post as them, in their voice: "I\'ll post this as you: …", and wait for their ok.')
+ expect(text).toContain('Before you send, show your owner the exact line you will post as them, in their voice: I\'ll post this as you: "…", and wait for their ok.')
expect(text).toContain('"text":"the line they okayed, or their own words"')
- expect(text).toContain('Only what follows "I\'ll post this as you:" in your message counts as shown')
+ expect(text).toContain('Quotes around that line are required')
+ expect(text).toContain('Only the quoted line immediately after "I\'ll post this as you:" counts as shown; nothing after its closing quote counts')
+ expect(text).toContain('If an unquoted line is refused, show it again in quotes and wait for a new ok')
expect(text).toContain('in full, never cut, as their own message, with no reply from you in the chat')
expect(text).not.toContain('Short name (at most 80 characters)')
expect(text).not.toContain('with your full proposal as the first reply in its thread')
diff --git a/cli/src/lib/swarmSkills.ts b/cli/src/lib/swarmSkills.ts
index 5eca1560f..cbafdf910 100644
--- a/cli/src/lib/swarmSkills.ts
+++ b/cli/src/lib/swarmSkills.ts
@@ -693,7 +693,7 @@ You are one person's Buddy. Your start note says which: their one Buddy for ever
- As your owner's one Buddy, you send to the PM of a project they read yourself, and name it: never tell them to open a session just to send. If they read several and it is unclear which one this is for, ask them first. A session in one project sends only to that project's PM.
- Only when your owner asks (for example "send to the PM"), never on your own, and once for each time they ask.
- Write the goal, the scope and a priority (low, normal or high) from what you agreed. Put in only what your owner wants sent; anything private stays in your chat.
-- Before you send, show your owner the exact line you will post as them, in their voice: "I'll post this as you: …", and wait for their ok. It is their message to the team: one plain line, as they would say it. Only what follows "I'll post this as you:" in your message counts as shown, so put nothing after it but that line; send it whole, never a piece of it. When they wrote the words to send themselves, send those. A change they ask for is a new line to show them.
+- Before you send, show your owner the exact line you will post as them, in their voice: I'll post this as you: "…", and wait for their ok. It is their message to the team: one plain line, as they would say it. Quotes around that line are required. Only the quoted line immediately after "I'll post this as you:" counts as shown; nothing after its closing quote counts. Put nothing after it but that line in quotes; send the words inside the quotes whole, never a piece of them. If an unquoted line is refused, show it again in quotes and wait for a new ok. When they wrote the words to send themselves, send those. A change they ask for is a new line to show them.
- Send it with harness super-tab --tab TAB propose OPERATION_ID '{"conversationId":"CHAT","ownerMessageId":"MESSAGE","projectId":"PROJECT","text":"the line they okayed, or their own words","goal":"...","scope":"...","priority":"normal"}', where MESSAGE is the id of your owner's message saying ok or asking you to send it and PROJECT is the project's id from status (a session in one project leaves projectId out). One message sends one proposal, to one project.
- To hand the PM a plan, spec, log or screenshot, attach it, up to 5 files of 10 MB each: add --attach PATH for a file inside your folder (as your owner's one Buddy, inside that project's folder under projects/), and "attachmentIds":["ID"] in the JSON for a file your owner sent in your chat (its id is on their message). Attach only what your owner wants sent; nothing from anywhere else.
- The Swarm posts the text in the project chat in full, never cut, as their own message, with no reply from you in the chat. The goal, scope and priority go to the PM with it and become the task's brief. It refuses words your owner did not see and okay. Tell your owner it went; the PM answers in the project chat.
diff --git a/desktop/lib/super_tabs/attachment_chips.dart b/desktop/lib/super_tabs/attachment_chips.dart
index 00be1d167..4cbf0930d 100644
--- a/desktop/lib/super_tabs/attachment_chips.dart
+++ b/desktop/lib/super_tabs/attachment_chips.dart
@@ -25,19 +25,17 @@ import 'voice_bubble.dart';
/// browser. Links last minutes (backend fileLinks.ts): one about to end is
/// asked for again, of message [messageId] in [conversationId], before it is
/// opened. A voice message's file is a bubble that plays it
-/// (`voice_bubble.dart`), with the message's [words] behind its →A.
+/// (`voice_bubble.dart`) and nothing more: it plays only.
class SuperTabAttachments extends StatelessWidget {
const SuperTabAttachments(
this.attachments, {
super.key,
this.conversationId,
this.messageId,
- this.words = '',
});
final List<SuperTabAttachment> attachments;
final String? conversationId, messageId;
- final String words;
@override
Widget build(BuildContext context) {
@@ -66,7 +64,6 @@ class SuperTabAttachments extends StatelessWidget {
SuperTabVoiceBubble(
key: ValueKey('super-attachment-voice:${file.id}'),
file: ref(file),
- words: words,
),
for (final file in pictures)
SuperTabInlineImage(
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index ea31d5791..4a7d57282 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -433,7 +433,13 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
],
);
+ /// A voice message's text is its words, which are never shown or handed
+ /// over: it plays only (anh Dee, 2026-11-04). It has no Copy, no ⌘C and
+ /// no Edit.
+ bool get _voice => superTabVoiceOf(widget.message) != null;
+
Future<void> _copy() async {
+ if (_voice) return;
await Clipboard.setData(ClipboardData(text: widget.message.text));
if (!mounted) return;
ScaffoldMessenger.maybeOf(context)?.showSnackBar(
@@ -474,7 +480,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
/// The author's own changes, under the menu's rule.
List<SuperTabMoreChange> get _changes => [
- if (widget.onEdit != null)
+ if (widget.onEdit != null && !_voice)
(
label: 'Edit message',
icon: AppIcons.pencil,
@@ -656,7 +662,8 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
}
if (event.logicalKey == LogicalKeyboardKey.keyC &&
(keys.isMetaPressed || keys.isControlPressed) &&
- !keys.isAltPressed) {
+ !keys.isAltPressed &&
+ !_voice) {
_copy();
return KeyEventResult.handled;
}
@@ -828,8 +835,8 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
),
child: _editor(context, editing),
)
- // A voice message's text is its words, shown
- // under its bubble from →A.
+ // A voice message's text is its words, never
+ // shown: it plays only (anh Dee, 2026-11-04).
else if (message.text.isNotEmpty && !voiceMessage)
Opacity(
opacity: widget.dimmed ? 0.6 : 1,
@@ -872,7 +879,6 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
message.attachments,
conversationId: message.conversationId,
messageId: message.id,
- words: message.text,
),
),
),
@@ -949,14 +955,15 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
onPressed: widget.onReply,
),
),
- fingerTarget(
- enabled: phone,
- AppIconButton(
- icon: AppIcons.copy,
- tooltip: 'Copy message',
- onPressed: _copy,
+ if (!voiceMessage)
+ fingerTarget(
+ enabled: phone,
+ AppIconButton(
+ icon: AppIcons.copy,
+ tooltip: 'Copy message',
+ onPressed: _copy,
+ ),
),
- ),
if ((_moreActions, _changes)
case (final actions, final changes)
when actions.isNotEmpty || changes.isNotEmpty)
diff --git a/desktop/lib/super_tabs/voice_bubble.dart b/desktop/lib/super_tabs/voice_bubble.dart
index b3dfc8b89..60cbe922a 100644
--- a/desktop/lib/super_tabs/voice_bubble.dart
+++ b/desktop/lib/super_tabs/voice_bubble.dart
@@ -34,22 +34,16 @@ VideoPlayerController _player(Uri source) => source.isScheme('file')
/// system's player, as its chip would.
bool get _playsHere => kIsWeb || defaultTargetPlatform != TargetPlatform.linux;
-/// A voice message as Telegram draws one: `( ▶ ) ıllıllııılll 1:21 →A`. Play
+/// A voice message as Telegram draws one: `( ▶ ) ıllıllııılll 1:21`. Play
/// plays a copy of the file read once to this computer, never the signed
-/// link, which stops opening within minutes; →A shows the [words] under it.
+/// link, which stops opening within minutes. It plays only: no words and no
+/// option to show them (anh Dee, 2026-11-04).
class SuperTabVoiceBubble extends StatefulWidget {
- const SuperTabVoiceBubble({
- super.key,
- required this.file,
- required this.words,
- });
+ const SuperTabVoiceBubble({super.key, required this.file});
/// A file whose [SuperTabAttachment.voice] is set.
final SuperTabFileRef file;
- /// The message's text: the clip's words, when it was transcribed.
- final String words;
-
@override
State<SuperTabVoiceBubble> createState() => _SuperTabVoiceBubbleState();
}
@@ -60,7 +54,7 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {
/// Where the local copy is; removed with the bubble.
Directory? _copy;
- bool _loading = false, _showWords = false;
+ bool _loading = false;
/// The last read failed: the next one asks for a fresh link first.
bool _stale = false;
@@ -189,14 +183,17 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {
? (position.inMilliseconds / length.inMilliseconds).clamp(0.0, 1.0)
: 0.0;
final finger = workspaceIsCompact(context);
- final bubble = Material(
+ return Material(
// The file chip's fill: the bubble is the chip of a voice file.
color: DesktopChrome.foreground.withValues(alpha: .055),
shape: const StadiumBorder(),
child: Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.menuInset,
- vertical: grid.AppDesktop.menuInset,
+ // The length ends it, a group's gap in from the bubble's round end.
+ padding: const EdgeInsetsDirectional.fromSTEB(
+ grid.AppDesktop.menuInset,
+ grid.AppDesktop.menuInset,
+ grid.AppDesktop.groupGap,
+ grid.AppDesktop.menuInset,
),
child: Row(
mainAxisSize: MainAxisSize.min,
@@ -218,66 +215,10 @@ class _SuperTabVoiceBubbleState extends State<SuperTabVoiceBubble> {
fontFeatures: const [FontFeature.tabularFigures()],
),
),
- const SizedBox(width: grid.AppDesktop.groupGap),
- fingerTarget(
- enabled: finger,
- Tooltip(
- message: _showWords ? 'Hide words' : 'Show words',
- child: TextButton(
- key: ValueKey('super-voice-words-toggle:$id'),
- onPressed: () => setState(() => _showWords = !_showWords),
- style: TextButton.styleFrom(
- minimumSize: const Size.square(
- DesktopChrome.compactControlHeight,
- ),
- padding: const EdgeInsets.symmetric(
- horizontal: grid.AppDesktop.menuInset,
- ),
- tapTargetSize: MaterialTapTargetSize.shrinkWrap,
- visualDensity: VisualDensity.compact,
- ),
- child: Text(
- '→A',
- style: DesktopChrome.control(
- color: _showWords
- ? DesktopChrome.accent
- : DesktopChrome.muted,
- medium: true,
- ),
- ),
- ),
- ),
- ),
],
),
),
);
- if (!_showWords) return bubble;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- spacing: grid.AppDesktop.controlGap,
- children: [
- bubble,
- ConstrainedBox(
- // The width a message's text keeps (message_row.dart).
- constraints: const BoxConstraints(maxWidth: 960),
- // The chat's selection area makes the words selectable.
- child: voice.transcribed
- ? Text(
- widget.words,
- key: ValueKey('super-voice-words:$id'),
- style: DesktopChrome.text(),
- )
- : Text(
- voice.failure == 'limit'
- ? 'Not transcribed: today’s voice limit was used'
- : 'Not transcribed',
- key: ValueKey('super-voice-words:$id'),
- style: DesktopChrome.metadata(),
- ),
- ),
- ],
- );
}
}
diff --git a/desktop/lib/super_tabs/voice_send.dart b/desktop/lib/super_tabs/voice_send.dart
index 3f03cde73..b92b5668b 100644
--- a/desktop/lib/super_tabs/voice_send.dart
+++ b/desktop/lib/super_tabs/voice_send.dart
@@ -11,12 +11,6 @@ import 'voice_take.dart';
/// for it, as a file (the phone's swarmVoiceFileName).
const superTabVoiceFileName = 'Voice message.wav';
-/// What the composer says when a voice message went without its words.
-const superTabVoiceOverLimit =
- "Sent without words: today's voice limit is used";
-const superTabVoiceNotTranscribed =
- "Sent without words: they couldn't be heard";
-
/// What it says when the clip's read got no answer; the take is kept.
const superTabVoiceNoAnswer = "Not sent · couldn't reach the server";
@@ -85,14 +79,9 @@ extension SuperTabVoiceSend on SuperTabController {
'attachmentIds': [id],
if (oneBuddy) 'oneBuddy': true,
});
- return (
- sent: true,
- notice: voice.transcribed
- ? null
- : voice.failure == 'limit'
- ? superTabVoiceOverLimit
- : superTabVoiceNotTranscribed,
- );
+ // Nothing to say once sent: a voice message plays only, and never has
+ // words to go without (anh Dee, 2026-11-04).
+ return (sent: true, notice: null);
}
/// Has the server read the uploaded clip [attachmentId] as a voice message,
diff --git a/desktop/test/super_tab_message_edit_test.dart b/desktop/test/super_tab_message_edit_test.dart
index 7cb430789..c3819dbbf 100644
--- a/desktop/test/super_tab_message_edit_test.dart
+++ b/desktop/test/super_tab_message_edit_test.dart
@@ -369,4 +369,90 @@ void main() {
expect(root.deleted, isTrue);
expect(root.text, 'This message was deleted.');
});
+
+ // A voice message plays only, and its words are never handed over (anh
+ // Dee, 2026-11-04): no Copy message, no ⌘C and no Edit message on one.
+ // Delete stays (#3335 review).
+ group('a voice message of your own', () {
+ const words = 'Ship the login fix today.';
+ ConversationServer voice() => ConversationServer()
+ ..append(
+ words,
+ attachments: [
+ {
+ 'id': 'v1',
+ 'name': 'Voice message.wav',
+ 'mime': 'audio/wav',
+ 'size': 64044,
+ 'url': 'https://cdn.harness.autonomous.ai/v1/Voice%20message.wav',
+ 'voice': {
+ 'durationMs': 2000,
+ 'waveform': List.filled(48, 9),
+ 'transcribed': true,
+ },
+ },
+ ],
+ );
+
+ late List<String> copied;
+ setUp(() {
+ copied = [];
+ final messenger =
+ TestWidgetsFlutterBinding.instance.defaultBinaryMessenger;
+ messenger.setMockMethodCallHandler(SystemChannels.platform, (call) async {
+ if (call.method == 'Clipboard.setData') {
+ copied.add((call.arguments as Map)['text'] as String);
+ }
+ return null;
+ });
+ addTearDown(
+ () => messenger.setMockMethodCallHandler(SystemChannels.platform, null),
+ );
+ });
+
+ testWidgets('offers no Copy message', (tester) async {
+ await show(tester, voice());
+ await hover(tester, 'message-1');
+ expect(
+ find.descendant(
+ of: row('message-1'),
+ matching: find.byTooltip('Copy message'),
+ ),
+ findsNothing,
+ );
+ });
+
+ testWidgets('⌘C on it copies nothing', (tester) async {
+ await show(tester, voice());
+ final focus = tester
+ .widgetList<Focus>(
+ find.descendant(of: row('message-1'), matching: find.byType(Focus)),
+ )
+ .map((widget) => widget.focusNode)
+ .whereType<FocusNode>()
+ .first;
+ focus.requestFocus();
+ await tester.pump();
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.metaLeft);
+ await tester.sendKeyEvent(LogicalKeyboardKey.keyC);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.metaLeft);
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
+ await tester.sendKeyEvent(LogicalKeyboardKey.keyC);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
+ await tester.pumpAndSettle();
+ expect(copied, isNot(contains(words)));
+ expect(find.text('Message copied'), findsNothing);
+ });
+
+ testWidgets('its More menu offers Delete message, never Edit', (
+ tester,
+ ) async {
+ await show(tester, voice());
+ await openMore(tester, 'message-1');
+ expect(find.text('Delete message'), findsOneWidget);
+ expect(find.text('Edit message'), findsNothing);
+ expect(field('message-1'), findsNothing);
+ expect(find.text(words), findsNothing);
+ });
+ });
}
diff --git a/desktop/test/super_tab_voice_message_shots_test.dart b/desktop/test/super_tab_voice_message_shots_test.dart
index c2cc3b9e2..866193211 100644
--- a/desktop/test/super_tab_voice_message_shots_test.dart
+++ b/desktop/test/super_tab_voice_message_shots_test.dart
@@ -15,8 +15,8 @@ import 'support/super_tab_fixture.dart';
/// Set to a folder to write the voice message PR's pictures there.
final shots = Platform.environment['SUPER_TAB_VOICE_SHOTS'];
-/// A chat with a voice message, as the PR shows it (#2584): at rest, with its
-/// words open under →A, and playing at 40%, in both appearances.
+/// A chat with a voice message, as the PR shows it (#2584): at rest and
+/// playing at 40%, in both appearances.
void main() {
setUpAll(() => loadCaptureFonts(shots));
@@ -124,13 +124,6 @@ void main() {
await tester.pumpAndSettle();
await captureWindow(tester, shots, 'voice-chat-${brightness.name}');
- final words = find.byKey(const ValueKey('super-voice-words-toggle:v1'));
- await tester.tap(words);
- await tester.pumpAndSettle();
- await captureWindow(tester, shots, 'voice-words-${brightness.name}');
- await tester.tap(words);
- await tester.pumpAndSettle();
-
await tester.tap(find.byTooltip('Play'));
for (var i = 0; i < 20 && player == null; i++) {
await tester.runAsync(
diff --git a/desktop/test/super_tab_voice_message_test.dart b/desktop/test/super_tab_voice_message_test.dart
index cd5909a69..fb8f0a2f0 100644
--- a/desktop/test/super_tab_voice_message_test.dart
+++ b/desktop/test/super_tab_voice_message_test.dart
@@ -301,7 +301,9 @@ void main() {
await tester.pump();
}
- testWidgets('shows play, the waveform, its length and →A, and no text', (
+ // Voice messages play only, as Telegram draws them: no →A, no words, no
+ // option to show them (anh Dee, 11-04, and 11-05 "I already told you NO").
+ testWidgets('plays only: play, the waveform and its length; no →A', (
tester,
) async {
await show(tester, withVoice());
@@ -316,10 +318,9 @@ void main() {
find.descendant(of: bubble, matching: find.text('1:21')),
findsOneWidget,
);
- expect(
- find.descendant(of: bubble, matching: find.text('→A')),
- findsOneWidget,
- );
+ expect(find.text('→A'), findsNothing);
+ expect(toggle, findsNothing);
+ expect(find.byTooltip('Show words'), findsNothing);
expect(find.text(_words), findsNothing);
expect(
find.descendant(of: row, matching: find.byType(SuperTabMessageText)),
@@ -331,26 +332,9 @@ void main() {
await close(tester);
});
- testWidgets('→A shows the words under the bubble, and again hides them', (
+ testWidgets('a clip without words says nothing about words', (
tester,
) async {
- await show(tester, withVoice());
- expect(find.byTooltip('Show words'), findsOneWidget);
- await tester.tap(toggle);
- await tester.pumpAndSettle();
- expect(find.text(_words), findsOneWidget);
- expect(find.byTooltip('Hide words'), findsOneWidget);
- expect(
- tester.getTopLeft(find.text(_words)).dy,
- greaterThan(tester.getBottomLeft(toggle).dy),
- );
- await tester.tap(toggle);
- await tester.pumpAndSettle();
- expect(find.text(_words), findsNothing);
- await close(tester);
- });
-
- testWidgets('a clip with no words says so, and why', (tester) async {
await show(
tester,
ConversationServer()
@@ -362,16 +346,8 @@ void main() {
],
),
);
- await tester.tap(toggle);
- await tester.tap(
- find.byKey(const ValueKey('super-voice-words-toggle:v2')),
- );
- await tester.pumpAndSettle();
- expect(find.text('Not transcribed'), findsOneWidget);
- expect(
- find.text('Not transcribed: today’s voice limit was used'),
- findsOneWidget,
- );
+ expect(find.text('→A'), findsNothing);
+ expect(find.textContaining('transcribed'), findsNothing);
await close(tester);
});
@@ -446,33 +422,27 @@ void main() {
await close(tester);
});
- testWidgets(
- 'on Linux Play opens the file as a chip does',
- (tester) async {
- await show(tester, withVoice());
- await tester.tap(find.byTooltip('Play'));
- await tester.pumpAndSettle();
- expect(opened, [url]);
- expect(fetched, isEmpty);
- expect(sources, isEmpty);
- await close(tester);
- },
- variant: TargetPlatformVariant.only(TargetPlatform.linux),
- );
+ testWidgets('on Linux Play opens the file as a chip does', (tester) async {
+ await show(tester, withVoice());
+ await tester.tap(find.byTooltip('Play'));
+ await tester.pumpAndSettle();
+ expect(opened, [url]);
+ expect(fetched, isEmpty);
+ expect(sources, isEmpty);
+ await close(tester);
+ }, variant: TargetPlatformVariant.only(TargetPlatform.linux));
- testWidgets(
- 'on Windows Play plays in the chat, from a local copy',
- (tester) async {
- await show(tester, withVoice());
- await tester.tap(find.byTooltip('Play'));
- await settleFiles(tester);
- expect(opened, isEmpty);
- expect(sources, hasLength(1));
- expect(sources.single.isScheme('file'), isTrue);
- await close(tester);
- },
- variant: TargetPlatformVariant.only(TargetPlatform.windows),
- );
+ testWidgets('on Windows Play plays in the chat, from a local copy', (
+ tester,
+ ) async {
+ await show(tester, withVoice());
+ await tester.tap(find.byTooltip('Play'));
+ await settleFiles(tester);
+ expect(opened, isEmpty);
+ expect(sources, hasLength(1));
+ expect(sources.single.isScheme('file'), isTrue);
+ await close(tester);
+ }, variant: TargetPlatformVariant.only(TargetPlatform.windows));
});
}
diff --git a/desktop/test/super_tab_voice_send_test.dart b/desktop/test/super_tab_voice_send_test.dart
index 61dc7e488..5645789cf 100644
--- a/desktop/test/super_tab_voice_send_test.dart
+++ b/desktop/test/super_tab_voice_send_test.dart
@@ -99,27 +99,34 @@ void main() {
expect(sent(), isNull);
});
- test('over the daily voice limit it sends and says so', () async {
- server.voiceAnswers = [
- {
- 'voice': {
- 'durationMs': 1000,
- 'waveform': List.filled(48, 3),
- 'transcribed': false,
- 'failure': 'limit',
- },
+ // A voice message plays only and never has words (anh Dee, 11-04), so
+ // one sent without them says nothing about words (River, 11-05).
+ for (final failure in [null, 'limit']) {
+ test(
+ 'sent without words (${failure ?? 'not heard'}), it says nothing',
+ () async {
+ server.voiceAnswers = [
+ {
+ 'voice': {
+ 'durationMs': 1000,
+ 'waveform': List.filled(48, 3),
+ 'transcribed': false,
+ 'failure': ?failure,
+ },
+ },
+ ];
+ final posted = await c.sendVoice(
+ conversationId: 'lead',
+ root: null,
+ wav: _wav,
+ lang: 'en',
+ );
+ expect(posted.sent, isTrue);
+ expect(posted.notice, isNull);
+ expect(sent(), isNotNull);
},
- ];
- final posted = await c.sendVoice(
- conversationId: 'lead',
- root: null,
- wav: _wav,
- lang: 'en',
);
- expect(posted.sent, isTrue);
- expect(posted.notice, superTabVoiceOverLimit);
- expect(sent(), isNotNull);
- });
+ }
test('a refused upload keeps the take and says why', () async {
server.failUpload = 'Voice message.wav';
diff --git a/docs/plans/2026-11-05-buddy-quoted-consent-plan.md b/docs/plans/2026-11-05-buddy-quoted-consent-plan.md
new file mode 100644
index 000000000..b51deb666
--- /dev/null
+++ b/docs/plans/2026-11-05-buddy-quoted-consent-plan.md
@@ -0,0 +1,79 @@
+# Buddy quoted consent and owner deletion implementation plan
+
+> Implement task by task in this Engineer session, test first, with independent security reviews of the completed pull request.
+
+**Goal:** A Buddy can post only the quoted line its owner saw and approved, and that owner can delete the proposal posted as them.
+
+**Architecture:** Keep consent enforcement in `okayedWords` and command authorization in `messageEdits.ts`. Read proposal ownership from the existing stored source, allow deletion separately from editing, and reuse transactional message deletion.
+
+**Tech Stack:** TypeScript, Vitest, Prisma/MongoDB, generated CLI skill text.
+
+**Spec:** Swarm task #3322, requested by emma: require a quoted line after `I'll post this as you:`, exclude everything after its closing quote, and let only the attributed owner delete their Buddy proposal.
+
+## Global Constraints
+
+- This PR owns backend and CLI skill text; River assigned the companion Desktop/phone delete-only eligibility to task #3330 on November 5, in a separate PR based on this branch. No new protocol, dependencies or core code.
+- Two independent security reviews before merge; Integrator owns review/test routing and shipping.
+- Commit this plan first, then each task's failing tests before implementation. Push the draft and each completed task.
+- Keep the owner's direct-word consent path and existing quote styles and whitespace normalization.
+- Test fixtures use synthetic content and isolated stores; never sign out a real CLI or use production data.
+
+## Design
+
+- Growth: no new records. Owner deletion removes a reply-free proposal; a root with replies becomes the existing tombstone. Remove its proposal source as well so goal/scope cannot retain deleted content. Expire only uploads owned by the deleted message; forwarded files keep their original owner-chat message and lose only this proposal's forwarding claim.
+- Concurrency: existing command transaction and group revision guard authorization and deletion; operation receipts retain retry idempotency. Keep the original ask consumed after deletion.
+- Read cost: use the already selected source/author fields; existing indexed message/thread/counter reads only. Attachment cleanup uses two updates in one existing database call, both bounded by the message's attachment IDs and tab, guarded respectively by `usedBy` and `proposedBy`. The focused regression profiles them and rejects collection scans.
+- Scale: parser work stays linear in the bounded messages already loaded; deletion uses the existing bounded lookbacks. Compare consent timing before/after at normal and maximum message sizes; command latency is the first warning metric.
+- Compatibility: no wire/schema change. Older unquoted Buddy summaries fail visibly and must be shown again with quotes; direct owner words keep working. Backend ships before the refreshed skill.
+- Migration + rollback: no migration. Reverting code restores the defect and should be avoided; deletion is intentionally irreversible and existing thread replies remain.
+- Audience: server verifies readable conversation, person author, source ownership and actor identity. Other people, the Swarm owner and every agent remain unauthorized.
+- Identity: authenticated actor only, never the host computer's login. Proposal attribution and source person must agree.
+- Failure: refuse unquoted/malformed summaries with `PROPOSAL_UNSHOWN` and guidance to show a quoted line again. Preserve existing deleted/not-found errors.
+- Platforms: backend behavior is common to all clients; generated skill is shared by macOS/Linux/Windows. Desktop/phone must offer Delete for the owner's own proposal, while Edit remains limited to plain messages. No process-launch changes.
+
+## Review Focus
+
+- A malformed or unquoted newest marker must invalidate older quoted consent, including within the same message.
+- Mixed/unclosed/nested quote delimiters must never broaden consent or reveal a trailing private sentence.
+- A quoted public sentence followed by private text must post exactly the public sentence.
+- Deletion must require the attributed person and proposal source owner to agree; editing and unrelated system rows stay forbidden.
+- A proposal with replies must lose its source content and pending deliveries while preserving its thread; deletion must not allow the Buddy to resend the same ask.
+
+## Validation plan
+
+Run focused backend consent/message-edit unit files, the CLI skill spec, and both component typechecks locally, with at most two test workers and ten-minute command limits. Add store-level cases to the existing Super Tab integration files; their full Linux suite and both component unit suites run in automatic ready-PR CI, per project instructions revision 74. Record red/green commands and counts in a PR comment before Ready. No full local suite repeated after CI. Retain separate implementation, validation and waiting timings; merge/publication belong to the Integrator.
+
+### Task 1: Require quoted consent and teach recovery
+
+**Files:** `backend/src/superTabs/buddies.ts`, `backend/src/superTabs/buddies.test.ts`, `backend/src/superTabs/commands.ts`, `backend/integration/superTabSwarmBuddy.test.ts`, `cli/src/lib/swarmSkills.ts`, `cli/src/lib/swarmSkills.spec.ts`.
+
+**Interfaces:** Preserve `okayedWords(words: string, ask: { text?: string; shown?: readonly string[] }): boolean`. `shownLine` returns null only when there is no marker, and an empty non-consenting value for a marker without a valid quoted line, so older consent is not revived.
+
+- [x] Commit tests rejecting an unquoted public line followed by private sentences, the unquoted line alone, unclosed/malformed quotes, and fallback to an older quoted offer. Assert the quoted line posts verbatim and appended/private-only text is refused. Require quote guidance in the generated skill and refusal.
+- [x] Run `vitest run src/superTabs/buddies.test.ts --maxWorkers=2` in backend and `vitest run src/lib/swarmSkills.spec.ts --maxWorkers=2` in CLI; record expected consent/wording failures.
+- [x] Remove the unquoted fallback, retain newest-marker invalidation, and require quotes in the skill example and server recovery text.
+- [x] Run the consent file and affected skill cases green, record evidence, commit and push. The full skill file had 12 pre-existing Windows failures; its full Linux run belongs to CI.
+
+### Task 2: Let only the owner delete their proposal
+
+**Files:** `backend/src/superTabs/messageEdits.ts`, `backend/src/superTabs/messageEdits.test.ts`, `backend/src/superTabs/store.ts`, `backend/integration/superTabMessageEdits.test.ts`.
+
+**Interfaces:** Extend internal `MessageChangeTarget` with optional `proposalOwnerId`, derived only from stored `buddy-proposal` source. `deleteMessage` allows matching person author/source owner; `editMessage` keeps the plain-message rule. Existing return/effect shapes remain unchanged.
+
+- [x] Commit tests for owner deletion with and without replies; reject other members, Swarm owner, agents, mismatched source owner and unrelated system rows. Add store tests creating a real Buddy proposal, deleting it, preserving replies without proposal content, cancelling pending delivery and refusing reuse of the original ask.
+- [x] Run `vitest run src/superTabs/messageEdits.test.ts --maxWorkers=2`; record owner deletion failing before the fix.
+- [x] Derive trusted proposal ownership, permit delete only, and remove source metadata when retaining a deleted root.
+- [x] Run focused unit files/typechecks, record evidence and push: 710 backend tests, 3 Buddy skill cases and both typechecks passed. [Red/green evidence](https://github.com/autonomous-ai/openharness/pull/3180#issuecomment-6657171229).
+- [ ] Full automatic CI and two security reviews, shared with #3330, plus independent testing. Integrator owns these steps and shipping.
+
+### Companion task #3330: Offer owner-only Delete in Desktop and phone
+
+River assigned the app work to #3330 on a Mac with Flutter after inspection found `canChange` hides both actions for every proposal. Its own PR builds on this branch, so the two Engineers never push the same branch. Both PRs go to the same two security reviewers. The following is the app handoff, not additional implementation in this PR.
+
+**Files:** Desktop `lib/super_tabs/profile_actions.dart`, `lib/super_tabs/view.dart`, their focused tests, and the matching phone eligibility/menu code and tests.
+
+**Interfaces:** Keep the existing edit eligibility unchanged. Add a separate delete eligibility check that retains write/access/archive/deleted checks and admits only a `buddy-proposal` whose person author and source `personId` both equal the signed-in account. The server remains authoritative.
+
+- [ ] Commit failing app tests: the owner sees Delete but no Edit for their proposal; another person, an agent-authored row and a mismatched source owner do not gain Delete; plain messages retain both actions.
+- [ ] Run the affected Flutter tests red on the Mac, implement the separate eligibility, then run them green and analyze changed Dart files.
+- [ ] Record light/dark menu evidence with a memory store and fake sign-in, push, and hand the complete stable revision to the Integrator. No real CLI sign-out.
diff --git a/docs/plans/2026-11-05-voice-play-only-plan.md b/docs/plans/2026-11-05-voice-play-only-plan.md
new file mode 100644
index 000000000..5b861fc5d
--- /dev/null
+++ b/docs/plans/2026-11-05-voice-play-only-plan.md
@@ -0,0 +1,53 @@
+# Voice messages play only Implementation Plan
+
+> Implemented by the task's Engineer, test first, task by task (project instructions: Engineer). No Execution Handoff.
+
+**Goal:** A voice message is a play-only bubble on the phone, Desktop and web: play, the waveform and the length, with
+no →A, no "Show words" and no transcript under it (anh Dee, 2026-11-04 and 2026-11-05). A voice message just sent plays
+on the phone.
+
+**Architecture:** Both bubbles lose their words toggle and the text they showed. Their `words` input goes, and so does
+the `words` the callers passed in (`swarm_message_row.dart`, `swarm_conversation_page.dart`, `attachment_chips.dart`,
+`message_row.dart`). A voice message's text stays hidden on both apps, as it is now. Playback on the phone already keeps
+the clip as `.wav` since #3027 (merged in #3053 on 11-05 00:21); a test pins that for a message the phone just sent.
+
+**Tech Stack:** Flutter (mobile/ and desktop/), flutter_test, video_player.
+
+**Spec:** Task #3335; project instructions, Product decisions (anh Dee): "Voice messages play only, as Telegram draws
+them: no transcript, no →A or Transcribe option, on any app."
+
+## Global Constraints
+
+- Phone and Desktop (web shares Desktop). No backend change: the server still stores the words, agents still read them.
+- Simulator only; nothing installed on anyone's phone.
+- Phone tests, Desktop tests and `scripts/check-ui-style.py` before Ready.
+
+## Review Focus
+
+- No path left that shows a voice message's words or offers to show them, on either app.
+- The bubble's layout without the toggle (right padding, narrow phone column).
+
+## Task 1: Phone bubble plays only
+
+**Files:** `mobile/lib/swarm/swarm_voice_bubble.dart`, `mobile/lib/swarm/swarm_message_row.dart`,
+`mobile/lib/swarm/swarm_conversation_page.dart`; tests `mobile/test/swarm/swarm_voice_bubble_test.dart`,
+`mobile/test/swarm/swarm_chat_voice_test.dart`, `mobile/test/render/swarm_voice_render_test.dart`.
+
+**Interfaces:** `SwarmVoiceBubble({file, voice, fileRef})`; `words`, `swarmVoiceNoWords` and `swarmVoiceNoWordsLimit` go.
+
+- [ ] Test: a voice bubble has no →A, no "Show words", and never shows the message's words; a chat's voice message
+ shows no words either. Run, watch it fail.
+- [ ] Remove the toggle and the words. Run, watch it pass.
+- [ ] Test: a voice message the phone just sent plays from a `.wav` copy, served with the headers the backend's
+ direct upload stores.
+
+## Task 2: Desktop bubble plays only
+
+**Files:** `desktop/lib/super_tabs/voice_bubble.dart`, `desktop/lib/super_tabs/attachment_chips.dart`,
+`desktop/lib/super_tabs/message_row.dart`; tests `desktop/test/super_tab_voice_message_test.dart`,
+`desktop/test/super_tab_voice_message_shots_test.dart`.
+
+**Interfaces:** `SuperTabVoiceBubble({file})`; `SuperTabAttachments` loses `words`.
+
+- [ ] Test: no →A, no "Show words" tooltip, no words under the bubble. Run, watch it fail.
+- [ ] Remove the toggle and the words. Run, watch it pass.
diff --git a/mobile/lib/swarm/swarm_conversation.dart b/mobile/lib/swarm/swarm_conversation.dart
index fb896bbae..1e33e0450 100644
--- a/mobile/lib/swarm/swarm_conversation.dart
+++ b/mobile/lib/swarm/swarm_conversation.dart
@@ -1043,7 +1043,9 @@ class SwarmConversation extends ChangeNotifier
_answered(post, outcome);
final sent =
outcome == SwarmPostOutcome.taken || outcome == SwarmPostOutcome.lost;
- return (sent: sent, notice: sent ? swarmVoiceSentNote(voice) : null);
+ // It says nothing once sent: a voice message plays only, and never
+ // has words to go without (anh Dee, 2026-11-04).
+ return (sent: sent, notice: null);
}
/// The thread whose session the last post started, once the backend took
diff --git a/mobile/lib/swarm/swarm_conversation_page.dart b/mobile/lib/swarm/swarm_conversation_page.dart
index ae0fa4829..2a8f98caf 100644
--- a/mobile/lib/swarm/swarm_conversation_page.dart
+++ b/mobile/lib/swarm/swarm_conversation_page.dart
@@ -1864,7 +1864,7 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
readerId: c.reader.accountId,
react: c.canPost,
link: _linkTo(c, id),
- onEdit: mine
+ onEdit: mine && !_isVoice(message)
? () => unawaited(_edit(shown, (m, text) => t.editMessage(m, text)))
: null,
onDelete: mine ? () => unawaited(_delete(shown, t.deleteMessage)) : null,
@@ -1873,6 +1873,12 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
if (shown() case final now?) await t.react(now, emoji);
}
+ /// Whether [message] is a voice message: its text is its words, never
+ /// opened to edit, as they are never shown (anh Dee, 2026-11-04). Delete
+ /// stays.
+ static bool _isVoice(SuperTabMessage message) =>
+ message.attachments.any((file) => file.voice != null);
+
/// Edit message on the message [shown] finds: its text in a sheet, and the
/// new text through [edit]. A refusal says why at the foot; the old text
/// stays.
@@ -1931,7 +1937,9 @@ class _SwarmConversationPageState extends State<SwarmConversationPage>
readerId: c.reader.accountId,
react: c.canPost,
link: link ? _linkTo(c, id) : null,
- onEdit: mine ? () => unawaited(_edit(shown, c.editMessage)) : null,
+ onEdit: mine && !_isVoice(message)
+ ? () => unawaited(_edit(shown, c.editMessage))
+ : null,
onDelete: mine ? () => unawaited(_delete(shown, c.deleteMessage)) : null,
);
if (emoji == null || !mounted) return;
@@ -3511,7 +3519,6 @@ class _Pending extends StatelessWidget {
'url': '',
}),
voice: voice,
- words: '',
)
else
for (final file in files)
diff --git a/mobile/lib/swarm/swarm_message_row.dart b/mobile/lib/swarm/swarm_message_row.dart
index 0bc10c01b..f5dd8b770 100644
--- a/mobile/lib/swarm/swarm_message_row.dart
+++ b/mobile/lib/swarm/swarm_message_row.dart
@@ -388,14 +388,9 @@ class SwarmMessageRow extends StatelessWidget {
messageId: message.id,
reader: SwarmFiles.of(context),
);
- // A voice message's clip is its bubble, its words behind →A.
+ // A voice message's clip is its bubble, which plays only.
if (file.voice case final voice?) {
- return SwarmVoiceBubble(
- file: file,
- voice: voice,
- words: message.text,
- fileRef: ref,
- );
+ return SwarmVoiceBubble(file: file, voice: voice, fileRef: ref);
}
final link = ref.current;
return SwarmAttachment(
@@ -490,7 +485,8 @@ class SwarmMessageRow extends StatelessWidget {
SizedBox(key: ValueKey('swarm-match-${message.id}')),
?quote,
?swarmTerminalNote(message),
- // A voice message's text is its words: under its bubble, on →A.
+ // A voice message's text is its words, never shown: it plays only
+ // (anh Dee, 2026-11-04).
if (!message.attachments.any((file) => file.voice != null))
for (final part in swarmTextParts(message.text))
if (part.code)
@@ -544,7 +540,10 @@ class SwarmMessageRow extends StatelessWidget {
label: inThread ? 'Reply in thread' : 'Reply',
onTap: reply,
),
- SwarmCopyButton(text: message.text),
+ // A voice message's text is its words, never handed
+ // over: it plays only (anh Dee, 2026-11-04).
+ if (!message.attachments.any((file) => file.voice != null))
+ SwarmCopyButton(text: message.text),
],
),
),
diff --git a/mobile/lib/swarm/swarm_thread.dart b/mobile/lib/swarm/swarm_thread.dart
index a1360c2f5..5aa14cada 100644
--- a/mobile/lib/swarm/swarm_thread.dart
+++ b/mobile/lib/swarm/swarm_thread.dart
@@ -743,7 +743,9 @@ class SwarmThread extends ChangeNotifier
_answered(post, outcome, current);
final sent =
outcome == SwarmPostOutcome.taken || outcome == SwarmPostOutcome.lost;
- return (sent: sent, notice: sent ? swarmVoiceSentNote(voice) : null);
+ // It says nothing once sent: a voice message plays only, and never
+ // has words to go without (anh Dee, 2026-11-04).
+ return (sent: sent, notice: null);
}
/// Sends the draft to the thread's root, to the agents it names and tagging
diff --git a/mobile/lib/swarm/swarm_voice_bubble.dart b/mobile/lib/swarm/swarm_voice_bubble.dart
index 326110b0c..024f73a4a 100644
--- a/mobile/lib/swarm/swarm_voice_bubble.dart
+++ b/mobile/lib/swarm/swarm_voice_bubble.dart
@@ -20,10 +20,6 @@ import 'swarm_attachment_store.dart';
import 'swarm_file_links.dart';
import 'voice_length.dart';
-/// What →A says for a voice message with no words.
-const swarmVoiceNoWords = 'Not transcribed';
-const swarmVoiceNoWordsLimit = "Not transcribed: today's voice limit was used";
-
/// A copy of [ref]'s file on the phone, kept in the account's file cache
/// (swarm_attachment_store.dart); null when none could be had. Replaced by
/// tests.
@@ -58,24 +54,22 @@ Future<File?> _cachedCopy(BuildContext context, SwarmFileRef ref) async {
/// A voice message (task #2584), on the phone as on Desktop:
///
-/// ( ▶ ) ıllıllııılllıı.ılıı.ıll 1:21 →A
+/// ( ▶ ) ıllıllııılllıı.ılıı.ıll 1:21
///
/// Play hears it, and the bars it has played fill in; the time counts what
-/// was played, its length at rest. →A shows its [words] under it, the
-/// message's text, and a second tap hides them. With no [fileRef] — a post
-/// still on its way — nothing plays yet.
+/// was played, its length at rest. It plays only, as Telegram draws it: no
+/// words and no option to show them (anh Dee, 2026-11-04). With no
+/// [fileRef] — a post still on its way — nothing plays yet.
class SwarmVoiceBubble extends StatefulWidget {
const SwarmVoiceBubble({
super.key,
required this.file,
required this.voice,
- required this.words,
this.fileRef,
});
final SuperTabAttachment file;
final SuperTabVoice voice;
- final String words;
final SwarmFileRef? fileRef;
@override
@@ -84,7 +78,7 @@ class SwarmVoiceBubble extends StatefulWidget {
class _SwarmVoiceBubbleState extends State<SwarmVoiceBubble> {
VideoPlayerController? _player;
- bool _opening = false, _words = false;
+ bool _opening = false;
String? _problem;
bool get _playing => _player?.value.isPlaying ?? false;
@@ -166,7 +160,6 @@ class _SwarmVoiceBubbleState extends State<SwarmVoiceBubble> {
final shown = value != null && (playing || position > Duration.zero)
? position
: length;
- final words = widget.words.trim();
return Padding(
key: ValueKey('swarm-voice-bubble-${widget.file.id}'),
padding: const EdgeInsets.only(top: AppSpace.s),
@@ -252,50 +245,9 @@ class _SwarmVoiceBubbleState extends State<SwarmVoiceBubble> {
fontFeatures: const [FontFeature.tabularFigures()],
),
),
- const SizedBox(width: AppSpace.s),
- Semantics(
- button: true,
- label: _words ? 'Hide words' : 'Show words',
- excludeSemantics: true,
- child: GestureDetector(
- key: const ValueKey('swarm-voice-words-toggle'),
- behavior: HitTestBehavior.opaque,
- onTap: () => setState(() => _words = !_words),
- child: SizedBox(
- height: 44,
- child: Center(
- child: Text(
- '→A',
- style: AppType.label(
- color: _words
- ? AppPalette.accent
- : AppPalette.textSecondary,
- ),
- ),
- ),
- ),
- ),
- ),
],
),
),
- if (_words)
- Padding(
- padding: const EdgeInsets.only(
- top: AppSpace.s,
- left: AppSpace.xs,
- ),
- child: Text(
- words.isNotEmpty
- ? words
- : widget.voice.overLimit
- ? swarmVoiceNoWordsLimit
- : swarmVoiceNoWords,
- style: words.isNotEmpty
- ? AppType.body(color: AppPalette.textPrimary)
- : AppType.caption(color: AppPalette.textSecondary),
- ),
- ),
if (_problem case final problem?)
Padding(
padding: const EdgeInsets.only(
diff --git a/mobile/lib/swarm/swarm_voice_send.dart b/mobile/lib/swarm/swarm_voice_send.dart
index a07022bdc..777749a02 100644
--- a/mobile/lib/swarm/swarm_voice_send.dart
+++ b/mobile/lib/swarm/swarm_voice_send.dart
@@ -7,10 +7,6 @@ import 'swarm_request.dart';
/// for it, as a file.
const swarmVoiceFileName = 'Voice message.wav';
-/// What the chat says when a voice message went without its words.
-const swarmVoiceOverLimit = "Sent without words: today's voice limit is used";
-const swarmVoiceNotTranscribed = "Sent without words: they couldn't be heard";
-
/// What the chat says when the read of a clip got no answer, from the
/// backend or the computer it goes through; the take is kept.
const swarmVoiceNoAnswer = "Not sent · couldn't reach the server";
@@ -67,10 +63,3 @@ Future<({SuperTabVoice? voice, String? refused})> swarmReadVoice(
}
}
}
-
-/// What a sent voice message says, when it went without words.
-String? swarmVoiceSentNote(SuperTabVoice voice) => voice.transcribed
- ? null
- : voice.overLimit
- ? swarmVoiceOverLimit
- : swarmVoiceNotTranscribed;
diff --git a/mobile/test/render/swarm_voice_render_test.dart b/mobile/test/render/swarm_voice_render_test.dart
index cf13f2661..ae5156d21 100644
--- a/mobile/test/render/swarm_voice_render_test.dart
+++ b/mobile/test/render/swarm_voice_render_test.dart
@@ -19,9 +19,9 @@ import '../voice_fakes.dart';
import '../swarm/swarm_fixture.dart';
/// Renders a phone Swarm chat's voice messages (task #2584) — the mic at
-/// rest, a take recording, a voice message with its words hidden and shown,
-/// and the mic refused — in light and dark, at iPhone 14 size in the system
-/// fonts, to PNGs a reviewer can look at without a phone.
+/// rest, a take recording, a voice message and the mic refused — in light
+/// and dark, at iPhone 14 size in the system fonts, to PNGs a reviewer can
+/// look at without a phone.
///
/// Skipped unless PHONE_RENDER_DIR names a directory to write into:
///
@@ -235,15 +235,6 @@ void main() {
await shoot(tester, key, 'swarm-voice-message-$look');
});
- testWidgets('a voice message\'s words open ($look)', skip: skip, (
- tester,
- ) async {
- final key = await chat(tester, _MeteredRecorder());
- await tester.tap(find.byKey(const ValueKey('swarm-voice-words-toggle')));
- await tester.pumpAndSettle();
- await shoot(tester, key, 'swarm-voice-words-$look');
- });
-
testWidgets('recording ($look)', skip: skip, (tester) async {
final recorder = _MeteredRecorder();
final key = await chat(tester, recorder);
diff --git a/mobile/test/swarm/swarm_chat_voice_test.dart b/mobile/test/swarm/swarm_chat_voice_test.dart
index 133827506..b3452da7e 100644
--- a/mobile/test/swarm/swarm_chat_voice_test.dart
+++ b/mobile/test/swarm/swarm_chat_voice_test.dart
@@ -194,7 +194,7 @@ void main() {
expect(fake.commands, isEmpty);
});
- testWidgets('a voice message draws its bubble, its words behind →A', (
+ testWidgets('a voice message draws its bubble, which plays only', (
tester,
) async {
fake.routes[messages] = (_) => {
@@ -230,9 +230,8 @@ void main() {
expect(find.text('1:21'), findsOneWidget);
expect(find.text('Ship the parser today.'), findsNothing);
expect(find.text('Voice message.wav'), findsNothing, reason: 'no chip');
- await tester.tap(key('swarm-voice-words-toggle'));
- await tester.pump();
- expect(find.text('Ship the parser today.'), findsOneWidget);
+ expect(find.text('→A'), findsNothing);
+ expect(key('swarm-voice-words-toggle'), findsNothing);
});
testWidgets('no mic where none can be heard', (tester) async {
diff --git a/mobile/test/swarm/swarm_copy_button_test.dart b/mobile/test/swarm/swarm_copy_button_test.dart
index 13e57c966..79c5fff0a 100644
--- a/mobile/test/swarm/swarm_copy_button_test.dart
+++ b/mobile/test/swarm/swarm_copy_button_test.dart
@@ -33,7 +33,12 @@ void main() {
.setMockMethodCallHandler(SystemChannels.platform, null),
);
- Widget row(String id, String text, {bool inThread = false}) => MaterialApp(
+ Widget row(
+ String id,
+ String text, {
+ bool inThread = false,
+ List<Map<String, dynamic>> attachments = const [],
+ }) => MaterialApp(
home: Scaffold(
body: ListView(
children: [
@@ -43,6 +48,7 @@ void main() {
'conversationId': 'g1',
'text': text,
'sequence': 1,
+ 'attachments': attachments,
'author': {'kind': 'agent', 'id': 'agent-lead', 'name': 'Lead'},
'createdAt': DateTime.utc(2026, 11, 2).toIso8601String(),
}),
@@ -226,4 +232,33 @@ void main() {
expect(find.bySemanticsLabel('Copied'), findsOneWidget);
semantics.dispose();
});
+
+ // A voice message's text is its words, which are never handed over: it
+ // plays only (anh Dee, 2026-11-04; #3335 review).
+ testWidgets('a voice message offers Reply but no Copy', (tester) async {
+ await tester.pumpWidget(
+ row(
+ 'm1',
+ 'the words',
+ attachments: [
+ {
+ 'id': 'v1',
+ 'name': 'Voice message.wav',
+ 'mime': 'audio/wav',
+ 'size': 64044,
+ 'url': 'https://cdn.example.test/v1/Voice_message.wav',
+ 'voice': {
+ 'durationMs': 2000,
+ 'waveform': List.filled(48, 9),
+ 'transcribed': true,
+ },
+ },
+ ],
+ ),
+ );
+ expect(find.text('Reply'), findsOneWidget);
+ expect(find.text('Copy'), findsNothing);
+ expect(find.byIcon(LucideIcons.copy), findsNothing);
+ expect(copied, isEmpty);
+ });
}
diff --git a/mobile/test/swarm/swarm_message_edit_test.dart b/mobile/test/swarm/swarm_message_edit_test.dart
index 6f808e7a2..ae070ffa6 100644
--- a/mobile/test/swarm/swarm_message_edit_test.dart
+++ b/mobile/test/swarm/swarm_message_edit_test.dart
@@ -209,6 +209,45 @@ void main() {
}
});
+ // Its text is its words, which are never shown or handed over: it plays
+ // only (anh Dee, 2026-11-04; #3335 review). Delete stays.
+ testWidgets('on your own voice message offers Delete message, never Edit', (
+ tester,
+ ) async {
+ await pump(
+ tester,
+ backend([
+ message(
+ 'm1',
+ 1,
+ text: 'Ship the parser today.',
+ attachments: [
+ {
+ 'id': 'v1',
+ 'name': 'Voice message.wav',
+ 'mime': 'audio/wav',
+ 'size': 64044,
+ 'url': 'https://cdn.example.test/v1/Voice_message.wav',
+ 'voice': {
+ 'durationMs': 2000,
+ 'waveform': List.filled(48, 9),
+ 'transcribed': true,
+ },
+ },
+ ],
+ ),
+ ]),
+ );
+
+ await tester.longPress(key('swarm-voice-bars'));
+ await tester.pumpAndSettle();
+
+ expect(key('swarm-copy-link'), findsOneWidget);
+ expect(delete, findsOneWidget);
+ expect(edit, findsNothing);
+ expect(find.text('Ship the parser today.'), findsNothing);
+ });
+
testWidgets('never for a person who may not write here', (tester) async {
await pump(
tester,
diff --git a/mobile/test/swarm/swarm_voice_bubble_test.dart b/mobile/test/swarm/swarm_voice_bubble_test.dart
index 0cfe2ca99..ef7f6c4c8 100644
--- a/mobile/test/swarm/swarm_voice_bubble_test.dart
+++ b/mobile/test/swarm/swarm_voice_bubble_test.dart
@@ -14,10 +14,10 @@ import 'swarm_attachment_fakes.dart';
/// A voice message as both apps draw it (task #2584):
///
-/// ( ▶ ) ıllıllııılllıı.ılıı.ıll 1:21 →A
+/// ( ▶ ) ıllıllııılllıı.ılıı.ıll 1:21
///
-/// Play hears it, from a copy of the file on the phone; →A shows its words
-/// under it, and a second tap hides them.
+/// Play hears it, from a copy of the file on the phone. It plays only: no
+/// words and no option to show them (anh Dee, 11-04).
void main() {
final cachedCopy = swarmVoiceFile;
final clip = SuperTabAttachment.fromJson({
@@ -55,11 +55,7 @@ void main() {
});
});
- Future<void> pump(
- WidgetTester tester, {
- SuperTabAttachment? file,
- String words = 'Ship the parser today.',
- }) async {
+ Future<void> pump(WidgetTester tester, {SuperTabAttachment? file}) async {
final shown = file ?? clip;
await tester.pumpWidget(
MaterialApp(
@@ -68,7 +64,6 @@ void main() {
body: SwarmVoiceBubble(
file: shown,
voice: shown.voice!,
- words: words,
fileRef: SwarmFileRef(shown),
),
),
@@ -78,30 +73,37 @@ void main() {
Finder key(String value) => find.byKey(ValueKey(value));
- testWidgets('shows play, its waveform, its length and →A, and no words', (
+ // Voice messages play only, as Telegram draws them: no →A, no words, no
+ // option to show them (anh Dee, 11-04, and 11-05 "I already told you NO").
+ testWidgets('plays only: play, its waveform and its length; no →A', (
tester,
) async {
await pump(tester);
expect(key('swarm-voice-play'), findsOneWidget);
expect(key('swarm-voice-bars'), findsOneWidget);
expect(find.text('1:21'), findsOneWidget);
- expect(key('swarm-voice-words-toggle'), findsOneWidget);
+ expect(find.text('→A'), findsNothing);
+ expect(key('swarm-voice-words-toggle'), findsNothing);
+ expect(
+ find.bySemanticsLabel(RegExp('words', caseSensitive: false)),
+ findsNothing,
+ );
+ expect(
+ find.textContaining(RegExp('transcri', caseSensitive: false)),
+ findsNothing,
+ );
expect(find.text('Ship the parser today.'), findsNothing);
});
- testWidgets('→A shows its words under it, and a second tap hides them', (
- tester,
- ) async {
+ testWidgets('a tap anywhere on it never shows its words', (tester) async {
await pump(tester);
- await tester.tap(key('swarm-voice-words-toggle'));
- await tester.pump();
- expect(find.text('Ship the parser today.'), findsOneWidget);
- await tester.tap(key('swarm-voice-words-toggle'));
+ await tester.tap(key('swarm-voice-bubble-clip'));
+ await tester.tap(find.text('1:21'));
await tester.pump();
expect(find.text('Ship the parser today.'), findsNothing);
});
- testWidgets('without words, →A says why', (tester) async {
+ testWidgets('a clip without words says nothing about words', (tester) async {
final quiet = SuperTabAttachment.fromJson({
'id': 'quiet',
'name': 'Voice message.wav',
@@ -115,10 +117,13 @@ void main() {
'failure': 'limit',
},
});
- await pump(tester, file: quiet, words: '');
- await tester.tap(key('swarm-voice-words-toggle'));
- await tester.pump();
- expect(find.text(swarmVoiceNoWordsLimit), findsOneWidget);
+ await pump(tester, file: quiet);
+ expect(find.text('0:02'), findsOneWidget);
+ expect(find.text('→A'), findsNothing);
+ expect(
+ find.textContaining(RegExp('transcri', caseSensitive: false)),
+ findsNothing,
+ );
});
testWidgets('Play hears a copy of the file on the phone, and shows pause', (
@@ -168,7 +173,6 @@ void main() {
child: SwarmVoiceBubble(
file: clip,
voice: clip.voice!,
- words: '',
fileRef: SwarmFileRef(clip),
),
),
@@ -262,6 +266,44 @@ void main() {
await closed(tester);
});
+ // anh Dee, 11-05 18:45: his own 0:20 voice message, just sent in a
+ // project chat, said "Couldn't play it". Its clip went up through a
+ // direct upload, whose signed headers are what storage serves it with
+ // (backend attachments.ts linkHeaders); the phone keeps it as .wav.
+ testWidgets('a voice message just sent plays on the phone', (tester) async {
+ storage.headers = {
+ 'content-type': 'application/octet-stream',
+ 'content-disposition':
+ "attachment; filename*=UTF-8''Voice%20message.wav",
+ 'cache-control': 'private, max-age=600',
+ };
+ await tester.runAsync(() => swarmAttachments.keepOnly('person-dee'));
+ final sent = SuperTabAttachment.fromJson({
+ 'id': 'sent-clip',
+ 'name': 'Voice message.wav',
+ 'mime': 'audio/wav',
+ 'size': 640044,
+ 'url': 'https://cdn.example.test/super-tabs/tab/f00/Voice_message.wav',
+ 'link':
+ 'https://storage.googleapis.com/harness-cdn/super-tabs/tab/f00/'
+ 'Voice_message.wav?X-Goog-Signature=fresh',
+ 'expiresAt': DateTime(2100).millisecondsSinceEpoch,
+ 'voice': {
+ 'durationMs': 20000,
+ 'waveform': List.generate(48, (i) => (i * 7) % 32),
+ 'transcribed': true,
+ },
+ });
+ await pump(tester, file: sent);
+ expect(find.text('0:20'), findsOneWidget);
+ await tester.tap(key('swarm-voice-play'));
+ final source = await played(tester);
+ expect(source.path, endsWith('.wav'));
+ expect(await tester.runAsync(source.readAsBytes), _Storage.wav);
+ expect(find.textContaining("Couldn't"), findsNothing);
+ await closed(tester);
+ });
+
testWidgets('a copy kept as .bin before is fetched again, never played', (
tester,
) async {
@@ -295,18 +337,23 @@ class _Storage extends http.BaseClient {
final asked = <Uri>[];
bool named = true;
+ /// What it answers with, when set, in place of the plain answer.
+ Map<String, String>? headers;
+
@override
Future<http.StreamedResponse> send(http.BaseRequest request) async {
asked.add(request.url);
return http.StreamedResponse(
Stream.value(wav),
HttpStatus.ok,
- headers: {
- 'content-type': 'application/octet-stream',
- if (named)
- 'content-disposition':
- "attachment; filename*=UTF-8''Voice%20message.wav",
- },
+ headers:
+ headers ??
+ {
+ 'content-type': 'application/octet-stream',
+ if (named)
+ 'content-disposition':
+ "attachment; filename*=UTF-8''Voice%20message.wav",
+ },
);
}
}
diff --git a/mobile/test/swarm/swarm_voice_send_test.dart b/mobile/test/swarm/swarm_voice_send_test.dart
index a38c50c52..fed77a373 100644
--- a/mobile/test/swarm/swarm_voice_send_test.dart
+++ b/mobile/test/swarm/swarm_voice_send_test.dart
@@ -116,17 +116,21 @@ void main() {
expect(r.swarm.commands, hasLength(1));
});
- test('says when it went without words past the daily limit', () async {
- final r = rig();
- r.swarm.routes['/api/super-tabs/$tab/attachments/'] = (_) =>
- facts(transcribed: false, failure: 'limit');
- final c = await open(r.reader);
- expect(await c.sendVoice(take, 'en'), (
- sent: true,
- notice: swarmVoiceOverLimit,
- ));
- expect(r.swarm.commands, hasLength(1));
- });
+ // A voice message plays only and never has words (anh Dee, 11-04), so
+ // one sent without them says nothing about words (River, 11-05).
+ for (final failure in [null, 'limit']) {
+ test(
+ 'sent without words (${failure ?? 'not heard'}), it says nothing',
+ () async {
+ final r = rig();
+ r.swarm.routes['/api/super-tabs/$tab/attachments/'] = (_) =>
+ facts(transcribed: false, failure: failure);
+ final c = await open(r.reader);
+ expect(await c.sendVoice(take, 'en'), (sent: true, notice: null));
+ expect(r.swarm.commands, hasLength(1));
+ },
+ );
+ }
test(
'keeps the take and sends nothing when the read gets no answer',