Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Approvals in plain words, a clear @ on phones, team lead first in Ask (15e) (#655)
Oleksandr Ivanchenko9b1002dfbc39
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 4d66cb8b..cf0bda04 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -1,4 +1,5 @@import React, { Suspense, lazy, useState, useEffect, useRef, useCallback, useMemo } from 'react';+import { askOrder } from './askOrder';import { refreshDictation } from './dictation';import { DecidingMap, applyDecideEvent, decisionsApi, hydrateDeciding } from './decideFirst';import { Sidebar, Kwant, Channel, Team, memberIdsOf } from './components/Sidebar';@@ -3344,8 +3345,9 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({: []: [];+ // 15e: the lead first (the "Ask:" row and the header's faces), the rest in roster order, like the team home.const currentTeamMembers = currentTeam- ? kwants.filter((k) => currentTeamMemberIds.includes(k.id))+ ? askOrder(kwants.filter((k) => currentTeamMemberIds.includes(k.id)), currentTeam.lead_kwant_id): [];// 0.8.1 F3: whose pre-push lines a team chat or channel shows (membership, like approvalsForChat).const pointerMemberIds: string[] = currentTeam ? currentTeamMemberIds : openChat?.kind === 'channel' ? openChat.memberIds.filter((id): id is string => !!id) : [];diff --git a/frontend/src/approvalMode.ts b/frontend/src/approvalMode.tsindex 82f61ec6..cdb344c5 100644--- a/frontend/src/approvalMode.ts+++ b/frontend/src/approvalMode.ts@@ -40,11 +40,11 @@ export function parseBotApprovals(raw: unknown): BotApprovalsState | null {}export const SPACE_OPTIONS: Array<{ value: SpaceApprovals; label: string; hint: string }> = [- { value: 'ask', label: 'Ask before running commands', hint: 'A card asks you before a bot runs a command, writes a file or uses a tool.' },+ { value: 'ask', label: 'Ask before running commands', hint: 'A card asks you before a bot runs a program, changes a file or uses one of its tools.' },{value: 'smart',label: 'Ask only when risky',- hint: 'Ordinary work in the bot’s folder runs on its own; a card asks before network calls, git fetch and push, adding a new package, publishing, anything outside the folder or anything unclear. Not a sandbox: scripts, make and a plain npm install inside the folder run without a card, and can do anything you can.',+ hint: 'Everyday work in the bot’s own folder runs on its own. A card asks you before it goes online, installs something new, publishes, touches anything outside its folder, or does anything that isn’t clearly safe. It isn’t a locked box: a program the bot runs inside its folder can still do anything you can.',},{ value: 'off', label: 'Don’t ask', hint: 'Bots act without asking, including sending, deleting, publishing and signing in. Payments still ask you.' },];diff --git a/frontend/src/askOrder.ts b/frontend/src/askOrder.tsnew file mode 100644index 00000000..95883bdc--- /dev/null+++ b/frontend/src/askOrder.ts@@ -0,0 +1,10 @@+/**+ * The composer's "Ask:" row in a team chat: the team's lead first, then everyone else in the order they+ * came (roster order), so the row reads like the team home does (15e). No lead, or a lead who isn't in+ * the list, leaves the order as it is. Never drops or repeats anyone.+ */+export function askOrder<T extends { id: string }>(members: readonly T[], leadId: string | null | undefined): T[] {+ const i = leadId ? members.findIndex((m) => m.id === leadId) : -1;+ if (i <= 0) return members.slice();+ return [members[i], ...members.slice(0, i), ...members.slice(i + 1)];+}diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex 3b4d1eb1..ab1bedcc 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -2894,9 +2894,11 @@ export const ChatView: React.FC<ChatViewProps> = ({className={`relative ${phone ? toolPhone : 'w-11 h-11 sm:w-9 sm:h-9 text-zinc-300 hover:text-zinc-50 hover:bg-white/[0.08] focus-visible:outline-sky-400'} rounded-xl flex items-center justify-center flex-shrink-0 transition-colors focus-visible:outline focus-visible:outline-2`}><AtSign size={phone ? 18 : 17} aria-hidden="true" />- {/* Phone (spec A5): "New" anchors to the @ button's own box, never on the field's border or an Ask chip */}+ {/* Phone (spec A5): "New" anchors to the @ button's own box, never on the field's border or an Ask chip.+ 15e: it sits centred above the 18 px glyph with 2 px clear (its bottom edge 9 + 2 px above the+ button's middle), so it never covers the "@". Same hide rules as desktop's tag below. */}{phone && !isStreaming && (- <NewTag id="mention" className={`absolute -top-1.5 -right-1 ${isMentionOpen ? 'hidden' : ''} ${dict.popOpen ? 'hidden' : ''} ${layerPhase || budgetBanner ? 'hidden' : ''}`} />+ <NewTag id="mention" className={`absolute left-1/2 -translate-x-1/2 bottom-[calc(50%+11px)] ${isMentionOpen ? 'hidden' : ''} ${dict.popOpen ? 'hidden' : ''} ${layerPhase || budgetBanner ? 'hidden' : ''}`} />)}</button>{stacked && <span className="flex-1" aria-hidden="true" />}diff --git a/frontend/tests/approvalsSmart.test.mjs b/frontend/tests/approvalsSmart.test.mjsindex b1e7e8cc..56134060 100644--- a/frontend/tests/approvalsSmart.test.mjs+++ b/frontend/tests/approvalsSmart.test.mjs@@ -38,8 +38,8 @@ test('the space control offers "Ask only when risky" between Ask and Don\'t ask,const values = [...html.matchAll(/value="(ask|smart|off)"/g)].map((x) => x[1]);assert.deepEqual(values, ['ask', 'smart', 'off']);const t = text(html);- assert.match(t, /Ask only when risky Ordinary work in the bot's folder runs on its own; a card asks before network calls, git fetch and push, adding a new package, publishing, anything outside the folder or anything unclear\./);- assert.match(t, /Not a sandbox: scripts, make and a plain npm install inside the folder run without a card, and can do anything you can\./);+ assert.match(t, /Ask only when risky Everyday work in the bot's own folder runs on its own\. A card asks you before it goes online, installs something new, publishes, touches anything outside its folder, or does anything that isn't clearly safe\./);+ assert.match(t, /It isn't a locked box: a program the bot runs inside its folder can still do anything you can\./, 'the honest limit of "smart" stays said');assert.match(t, /Ask before running commands \(default\)/, 'Ask stays the default');});diff --git a/frontend/tests/askOrder.test.mjs b/frontend/tests/askOrder.test.mjsnew file mode 100644index 00000000..24aa7cf4--- /dev/null+++ b/frontend/tests/askOrder.test.mjs@@ -0,0 +1,29 @@+// 15e: the composer's "Ask:" row in a team chat starts with the team's lead, then the rest in roster order.+import assert from 'node:assert/strict';+import test from 'node:test';+import { loadBundled } from './bundle.mjs';++const { askOrder } = await loadBundled(`export * from './src/askOrder';`);+const ids = (xs) => xs.map((x) => x.id);+const roster = [{ id: 'a' }, { id: 'b' }, { id: 'lead' }, { id: 'c' }];++test('the lead comes first, everyone else keeps roster order', () => {+ assert.deepEqual(ids(askOrder(roster, 'lead')), ['lead', 'a', 'b', 'c']);+});++test('a lead already first, no lead, or a lead not in the team leaves the order alone', () => {+ assert.deepEqual(ids(askOrder([{ id: 'lead' }, { id: 'a' }], 'lead')), ['lead', 'a']);+ assert.deepEqual(ids(askOrder(roster, null)), ['a', 'b', 'lead', 'c']);+ assert.deepEqual(ids(askOrder(roster, undefined)), ['a', 'b', 'lead', 'c']);+ assert.deepEqual(ids(askOrder(roster, 'gone')), ['a', 'b', 'lead', 'c']);+ assert.deepEqual(askOrder([], 'lead'), []);+});++test('never drops, repeats or mutates the members', () => {+ const before = ids(roster);+ const out = askOrder(roster, 'c');+ assert.deepEqual(ids(out), ['c', 'a', 'b', 'lead']);+ assert.equal(new Set(ids(out)).size, roster.length);+ assert.deepEqual(ids(roster), before, 'input untouched');+ assert.notEqual(askOrder(roster, null), roster, 'always a new array');+});