Skip to content

Commit f5359b3

Browse files
igorcostaAutohand Evolve
andcommitted
Improve mobile handoff scanning and composer identity
Render the mobile pairing QR with a scan-grade quiet zone and retain high contrast across terminal themes. Emphasize the Autohand product name without disturbing provider, context, path, or branch status updates, and align queued-action regression coverage with sequenced work. Co-authored-by: Autohand Evolve <code-noreply@autohand.ai>
1 parent 37f7f99 commit f5359b3

6 files changed

Lines changed: 105 additions & 17 deletions

File tree

‎src/commands/go.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,12 @@ export async function go(ctx: GoContext, args: string[] = []): Promise<string |
267267

268268
const appUrl = nativeAppUrl(pairing.pairingUrl);
269269
const rawQr = await QRCode.toString(pairing.pairingUrl, {
270-
type: 'terminal',
270+
type: 'utf8',
271271
errorCorrectionLevel: 'M',
272-
small: true,
272+
margin: 4,
273273
});
274-
// Keep an explicit dark-on-light field around the compact terminal
275-
// renderer so theme colors cannot reduce scanner contrast.
274+
// Preserve a full four-module quiet zone for camera reliability while
275+
// pinning the field to dark-on-light across terminal themes.
276276
const qr = formatScannableTerminalQRCode(rawQr);
277277

278278
return [

‎src/ui/ink/AgentUI.tsx‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,20 @@ export function getComposerHelpLine(
583583
return formatLineSegments(defaultSegments, lineExtension);
584584
}
585585

586+
export function renderComposerHelpLineContent(helpLine: string, providerDisplay: string) {
587+
const productName = 'autohand';
588+
if (!providerDisplay || !helpLine.startsWith(providerDisplay)) {
589+
return helpLine;
590+
}
591+
592+
return (
593+
<>
594+
<Text bold>{productName}</Text>
595+
{helpLine.slice(productName.length)}
596+
</>
597+
);
598+
}
599+
586600
function formatContextTokenDisplay(contextTokens: ContextTokenDisplay): string {
587601
if (!Number.isFinite(contextTokens.total) || contextTokens.total <= 0) {
588602
return '';
@@ -2417,11 +2431,18 @@ const HelpLineSection = memo(function HelpLineSection({
24172431
const providerDisplay = provider
24182432
? `autohand (${t(`providers.${provider}`) ?? provider}${model ? `, ${model}` : ''})`
24192433
: '';
2434+
const helpLine = getComposerHelpLine(
2435+
isWorking,
2436+
providerDisplay,
2437+
contextDisplay,
2438+
t('ui.commandHint'),
2439+
lineExtension
2440+
);
24202441

24212442
return (
24222443
<Box>
24232444
<Text color={colors.dim}>
2424-
{getComposerHelpLine(isWorking, providerDisplay, contextDisplay, t('ui.commandHint'), lineExtension)}
2445+
{renderComposerHelpLineContent(helpLine, providerDisplay)}
24252446
</Text>
24262447
</Box>
24272448
);

‎tests/commands/go.test.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ describe('/go command', () => {
147147
expect(output).toContain('QR-CODE');
148148
expect(QRCode.toString).toHaveBeenCalledWith(
149149
'https://autohand.ai/code/go?pairing=pairing-1&token=secret',
150-
expect.objectContaining({
151-
type: 'terminal',
152-
small: true,
153-
})
150+
{
151+
type: 'utf8',
152+
errorCorrectionLevel: 'M',
153+
margin: 4,
154+
}
154155
);
155156
expect(output).toContain('autohand-code://go?pairing=pairing-1&token=secret');
156157
expect(output).toContain('https://autohand.ai/code/go?pairing=pairing-1&token=secret');

‎tests/core/agent/PostTurnActionCoordinator.test.ts‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,22 @@ describe('post-turn research publication', () => {
6262
});
6363

6464
it('carries a structured action alongside the reserved instruction', () => {
65-
expect(unpackQueuedAgentInstruction({
65+
const structuredInstruction = unpackQueuedAgentInstruction({
6666
text: 'Run the research',
6767
postTurnAction: action,
68-
})).toEqual({
68+
});
69+
expect(structuredInstruction).toEqual({
6970
text: 'Run the research',
7071
postTurnAction: action,
72+
sequence: expect.any(Number),
7173
});
72-
expect(unpackQueuedAgentInstruction('ordinary request')).toEqual({
74+
75+
const ordinaryInstruction = unpackQueuedAgentInstruction('ordinary request');
76+
expect(ordinaryInstruction).toEqual({
7377
text: 'ordinary request',
78+
sequence: expect.any(Number),
7479
});
80+
expect(ordinaryInstruction.sequence).toBeGreaterThan(structuredInstruction.sequence);
7581
});
7682

7783
it('offers once only after a successful completed run with the matching reserved path', async () => {

‎tests/tuistory/built-cli.tuistory.test.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,12 @@ describe('interactive built CLI Tuistory tests', () => {
826826
launchBuiltAutohand(['--path', state.workspaceRoot, '--config', state.configPath], {
827827
autohandHome: state.autohandHome,
828828
cwd: state.workspaceRoot,
829+
env: {
830+
NO_COLOR: undefined,
831+
FORCE_COLOR: '3',
832+
COLORTERM: 'truecolor',
833+
TERM: 'xterm-256color',
834+
},
829835
waitForDataTimeout: 15_000,
830836
})
831837
);
@@ -845,6 +851,8 @@ describe('interactive built CLI Tuistory tests', () => {
845851
expect(helpLine, screen).toContain(branch);
846852
}
847853

854+
expect(session.getRawOutput()).toMatch(/\u001b\[1mautohand\u001b\[22m/u);
855+
848856
await exitInteractive(session);
849857
}, 60_000);
850858

@@ -1226,7 +1234,7 @@ describe('interactive built CLI Tuistory tests', () => {
12261234
await exitInteractive(session);
12271235
});
12281236

1229-
it('renders a compact, high-contrast QR code for /go', async () => {
1237+
it('renders a scan-grade, high-contrast QR code with a full quiet zone for /go', async () => {
12301238
const state = await createTempAutohandHome();
12311239
tempStates.push(state);
12321240
const pairingPreload = await createMockMobilePairingFetchPreload();
@@ -1273,10 +1281,16 @@ describe('interactive built CLI Tuistory tests', () => {
12731281

12741282
expect(instructionsIndex, screen).toBeGreaterThanOrEqual(0);
12751283
expect(linkIndex, screen).toBeGreaterThan(instructionsIndex);
1276-
expect(qrLines.length, screen).toBeGreaterThanOrEqual(20);
1277-
expect(qrLines.length, screen).toBeLessThanOrEqual(28);
1278-
expect(Math.max(...qrLines.map((line) => line.length)), screen).toBeLessThanOrEqual(55);
1279-
expect(session.getRawOutput()).toContain('\u001B[47m\u001B[30m');
1284+
expect(qrLines.length, screen).toBeGreaterThanOrEqual(25);
1285+
expect(qrLines.length, screen).toBeLessThanOrEqual(32);
1286+
expect(Math.max(...qrLines.map((line) => line.length)), screen).toBeGreaterThanOrEqual(52);
1287+
expect(Math.max(...qrLines.map((line) => line.length)), screen).toBeLessThanOrEqual(60);
1288+
// Tuistory trims trailing screen whitespace, so the renderer option test
1289+
// covers the right margin while this proves the visible left quiet zone.
1290+
expect(qrLines.every((line) => line.startsWith(' ')), screen).toBe(true);
1291+
expect(session.getRawOutput()).toMatch(
1292+
/\u001B\[(?:30m\u001B\[47m|47m\u001B\[30m)/u
1293+
);
12801294

12811295
await exitInteractive(session);
12821296
}, 60_000);

‎tests/ui/ink/AgentUI.test.ts‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
handleInkTextBufferInput,
2020
isBareComposerTrigger,
2121
matchesExtensionKeybinding,
22+
renderComposerHelpLineContent,
2223
resolveInkHiddenPastes,
2324
storeInkHiddenPaste,
2425
} from '../../../src/ui/ink/AgentUI.js';
@@ -1014,6 +1015,51 @@ describe('AgentUI paste placeholder resolution', () => {
10141015
});
10151016

10161017
describe('AgentUI layout stability', () => {
1018+
it('renders the Autohand product name in bold in the composer help line', async () => {
1019+
const state = {
1020+
...createInitialUIState(),
1021+
provider: 'openrouter',
1022+
model: 'openai/gpt-4o-mini',
1023+
};
1024+
const { lastFrame } = render(
1025+
React.createElement(
1026+
I18nProvider,
1027+
null,
1028+
React.createElement(
1029+
ThemeProvider,
1030+
null,
1031+
React.createElement(AgentUI, {
1032+
state,
1033+
onInstruction: () => {},
1034+
onEscape: () => {},
1035+
onCtrlC: () => {},
1036+
})
1037+
)
1038+
)
1039+
);
1040+
1041+
await new Promise<void>((resolve) => setTimeout(resolve, 50));
1042+
1043+
const frame = lastFrame() ?? '';
1044+
expect(stripAnsi(frame)).toContain('autohand (OpenRouter, openai/gpt-4o-mini)');
1045+
1046+
const content = renderComposerHelpLineContent(
1047+
'autohand (OpenRouter, openai/gpt-4o-mini) · 100% context left',
1048+
'autohand (OpenRouter, openai/gpt-4o-mini)'
1049+
);
1050+
expect(React.isValidElement(content)).toBe(true);
1051+
const children = React.Children.toArray(
1052+
(content as React.ReactElement<{ children?: React.ReactNode }>).props.children
1053+
);
1054+
const productName = children[0] as React.ReactElement<{
1055+
bold?: boolean;
1056+
children?: React.ReactNode;
1057+
}>;
1058+
expect(productName.props.bold).toBe(true);
1059+
expect(productName.props.children).toBe('autohand');
1060+
expect(children[1]).toBe(' (OpenRouter, openai/gpt-4o-mini) · 100% context left');
1061+
});
1062+
10171063
it('formats token-based context usage consistently with completed turn usage', () => {
10181064
expect(
10191065
getComposerHelpLine(

0 commit comments

Comments
 (0)