~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

Your own profile opens from the launcher's account and a tile's You

Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:workspace/own-profile
harness/e2e/launcher.spec.mjs+47−1
@@ -4,7 +4,8 @@
// query's tile, its params the person's. The world's
// accounts are on no knotless appview, so this holds the tile to its call
// (getCanvas), not its drawing; and it takes the tile off again, leaving
// carol's canvas as the flows after it find it.
// carol's canvas as the flows after it find it. Your own profile across
// your apps opens from the launcher's account, and from a tile's "You".
import { expect, signIn, test, who } from './pages.mjs';
@@ -49,3 +50,48 @@ test('a launcher row of an app opens its query as a tile, as the person', async
);
await context.close();
});
test('your own profile opens from the launcher’s account and from a tile’s You', async ({ browser }) => {
const context = await browser.newContext();
const page = await context.newPage();
await signIn(page, 'carol');
const xrpc = (method, params) =>
page.evaluate(
async ([method, params]) => (await fetch(`/xrpc/place.hud.${method}?${new URLSearchParams(params)}`)).json(),
[method, params]
);
const post = (method, body) =>
page.evaluate(
async ([method, body]) =>
(
await fetch(`/xrpc/place.hud.${method}`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-HUD': '1' },
body: JSON.stringify(body)
})
).json(),
[method, body]
);
const { current } = await xrpc('getWorkspace', {});
/** The canvas's profiles of carol: their keys. */
const profiles = async () =>
(await xrpc('getCanvas', { canvas: current })).tiles
.filter((t) => t.record.tool === 'describe_repo' && (t.record.arguments ?? JSON.parse(t.record.argumentsJson ?? '{}')).actor === who.carol.did)
.map((t) => t.key);
const launcher = page.getByRole('main', { name: 'Columns' }).getByRole('region', { name: 'Open' });
await launcher.getByTitle('Your profile across your apps').click();
await expect(launcher).toHaveCount(0);
await expect.poll(profiles).toHaveLength(1);
await post('removeTile', { canvas: current, tile: (await profiles())[0] });
// A tile of carol's own says "You", which opens her profile beside it.
const added = await post('addTile', { canvas: current, tool: 'list_records', arguments: { actor: who.carol.did, collection: 'app.bsky.actor.profile' }, title: 'Her profile record' });
const records = page.locator(`[data-tile="${added.tile.key}"]`);
await records.getByRole('button', { name: 'You', exact: true }).click();
await expect.poll(profiles).toHaveLength(1);
await expect(page.locator(`[data-tile="${(await profiles())[0]}"]`)).toBeVisible();
for (const tile of [added.tile.key, ...(await profiles())]) await post('removeTile', { canvas: current, tile });
await context.close();
});
harness/look.mjs+4−1
@@ -20,6 +20,7 @@
// --events <name> what the stream then says, from the
// world's events (badges, arrival)
// --click <selector> click it (a step)
// --hover <selector> rest the pointer on it (a step)
// --type <selector>=<text> type into it, emptied (a step)
// --press <key> press it, as Playwright names keys:
// t, Shift+ArrowLeft, Meta+k (a step)
@@ -77,6 +78,7 @@ for (let i = 0; i < argv.length; i++) {
sets.push({ method, path: path.split('.'), value: parsed });
} else if (a === '--events') events = next();
else if (a === '--click') steps.push({ click: next() });
else if (a === '--hover') steps.push({ hover: next() });
else if (a === '--type') {
const [, sel, text] = next().match(/^([^=]+)=(.*)$/s) ?? fail('--type takes <selector>=<text>');
steps.push({ sel, text });
@@ -423,7 +425,8 @@ try {
const it = page.locator(s.sel).first();
await it.fill('');
await it.pressSequentially(s.text);
} else await page.locator(s.click).first().click();
} else if (s.hover) await page.locator(s.hover).first().hover();
else await page.locator(s.click).first().click();
await settle();
}
const wide = await page.evaluate(() => document.documentElement.scrollWidth - document.documentElement.clientWidth);
ios/App/TileView.swift+17−5
@@ -145,7 +145,8 @@ struct TileView: View {
/// opened from ("@dan · Bluesky · from Posts"), every header as tall; and
/// its menu, who added it over its `actions`. In a compact width (a
/// phone), one line: a way back to the tile it was opened from, what it
/// shows, then the handle, the title giving way before the handle.
/// shows, then the handle ("You", an account of yours), the title giving
/// way before it.
/// Content, not a floating bar, so nothing scrolls under it.
struct TileHeader<Actions: View>: View {
let title: String
@@ -210,15 +211,16 @@ struct TileHeader<Actions: View>: View {
}
}
/// Whose, its app, where it was opened from, apart by dots.
/// Whose, its app, where it was opened from, apart by dots; whose
/// ("You" too) opening the account across its apps.
private var about: some View {
let who = mine ? "You" : handle.map { "@\($0)" }
return HStack(spacing: 0) {
if let who, let openWho, !mine {
if let who, let openWho {
Button(action: openWho) { Text(who) }
.buttonStyle(.plain)
.layoutPriority(1)
.accessibilityHint("Opens their profile across their apps")
.accessibilityHint(mine ? "Opens your profile across your apps" : "Opens their profile across their apps")
if let app { Text(" · \(app)").layoutPriority(1) }
} else {
Text([who, app].compactMap { $0 }.joined(separator: " · "))
@@ -253,7 +255,17 @@ struct TileHeader<Actions: View>: View {
Text(title)
.font(.headline)
.lineLimit(1)
if let handle, !mine {
if mine, let openWho {
Button(action: openWho) {
Text("You")
.font(.caption)
.foregroundStyle(.secondary)
.lineLimit(1)
}
.buttonStyle(.plain)
.layoutPriority(1)
.accessibilityHint("Opens your profile across your apps")
} else if let handle, !mine {
ios/App/TileView.swiftlines 258 to 268
review.knotless.dev

On your own describe_repo tile, openWho is nil, so neither branch draws anything. The web shows a plain "You" here (Tile.svelte's {:else if mine}). If the two should match, add a plain "You" Text for mine without openWho.

Button { openWho?() } label: {
Text("@\(handle)")
.font(.caption)
web/workspace/lib/organisms/Launcher.svelte+41−17
@@ -8,17 +8,18 @@
import AppCell from '../molecules/AppCell.svelte';
import LauncherRow from '../molecules/LauncherRow.svelte';
import type { Actor, Canvas } from '../model';
import type { Opening } from '../workspace.svelte';
import { signOut } from '../xrpc';
/**
* A launcher column, in place of the sidebar: your atmosphere. Unsearched,
* the account, then its apps (most collections first, two rows of them,
* opening each app's page), the chosen app's entry points (its
* feeds, the queries its bundled views offer, the collections a view
* draws), then the canvases. A search goes through all of it. A pick
* turns the column into that tile in place
* (`onpick`); one already on the strip says so, and goes to it; a
* canvas opens as its tab (`oncanvas`). The arrows move through the grid
* the account (opening your profile across your apps), then its apps
* (most collections first, two rows of them, opening each app's page),
* the chosen app's entry points (its feeds, the queries its bundled views
* offer, the collections a view draws), then the canvases. A search goes
* through all of it. A pick turns the column into that tile in place
* (`onpick`, its call); one already on the strip says so, and goes to it;
* a canvas opens as its tab (`oncanvas`). The arrows move through the grid
* as a grid and the lists in turn; Escape empties the search, then
* closes an empty launcher; ← and → in an empty search, off the grid,
* move the focus.
@@ -47,7 +48,7 @@
/** Whether a row's call is on the strip already. */
opened: (row: Row) => boolean;
onfocus: () => void;
onpick: (row: Row) => void;
onpick: (call: Opening) => void;
oncanvas: (id: string) => void;
onclose: () => void;
onstep: (step: -1 | 1) => void;
@@ -93,7 +94,7 @@
/** What Enter and the arrows go through, in the order they show. */
const reachable = $derived.by((): Item[] => {
const rows = q ? [...mine, ...views, ...feeds, ...apps] : [...grid, ...feeds, ...entries];
return [...rows.map((row) => ({ key: row.key, pick: () => onpick(row) })), ...places.map((canvas) => ({ key: `canvas:${canvas.id}`, pick: () => oncanvas(canvas.id) }))];
return [...rows.map((row) => ({ key: row.key, pick: () => onpick(row.call) })), ...places.map((canvas) => ({ key: `canvas:${canvas.id}`, pick: () => oncanvas(canvas.id) }))];
});
/** A search's first row, which it picks; none unsearched. */
const first = $derived(q ? (reachable[0]?.key ?? null) : null);
@@ -155,7 +156,7 @@
tag={row.tag}
open={opened(row)}
active={row.key === active}
onpick={() => onpick(row)}
onpick={() => onpick(row.call)}
onhover={() => (active = row.key)}
/>
</li>
@@ -188,11 +189,13 @@
</label>
<div class="account">
<Avatar did={me.did} handle={me.handle} size="md" />
<div class="names">
<strong>{launcher.account.name}</strong>
<span><Handle did={me.did} handle={me.handle} /></span>
</div>
<button type="button" class="me" title="Your profile across your apps" onclick={() => onpick({ tool: 'describe_repo', arguments: { actor: me.did } })}>
<Avatar did={me.did} handle={me.handle} size="md" />
<span class="names">
<strong>{launcher.account.name}</strong>
<span><Handle did={me.did} handle={me.handle} /></span>
</span>
</button>
<button type="button" class="icon-button" title="Connect your AI" aria-label="Connect your AI" onclick={onconnect}><Icon name="connect" /></button>
<button type="button" class="icon-button" title="Sign out" aria-label="Sign out" onclick={() => void signOut()}><Icon name="signOut" /></button>
</div>
@@ -220,7 +223,7 @@
icon={row.icon ?? 'app'}
active={row.key === active}
selected={row.key === selected?.key}
onpick={() => onpick(row)}
onpick={() => onpick(row.call)}
onhover={() => (active = row.key)}
/>
</li>
@@ -403,9 +406,30 @@
border-bottom: var(--border);
}
.names {
/* The account, opening your profile across your apps: a row's look, its hover inside the column as a row's is. */
.me {
display: flex;
flex: 1;
align-items: center;
gap: var(--space-2);
min-width: 0;
margin-block: calc(-1 * var(--space-1));
padding: var(--space-1);
border: 0;
border-radius: var(--radius-md);
background: none;
color: var(--fg);
font: inherit;
text-align: left;
cursor: pointer;
}
.me:hover {
background: var(--hover);
}
.names {
display: flex;
flex-direction: column;
min-width: 0;
line-height: var(--leading-tight);
web/workspace/lib/organisms/Strip.svelte+2−1
@@ -228,6 +228,7 @@
{canvas}
title={titles.get(one.key) ?? ws.title(tile)}
account={account === 'me' ? me.did : account}
{me}
focused={shown && ui.focus === one.key}
arrived={ui.arrived.has(one.key)}
chain={linked.colour.get(one.key)}
@@ -260,7 +261,7 @@
canvases={ws.canvases.filter((found) => found.id !== canvas && found.invitedBy === null)}
{opened}
onfocus={() => ws.focus(canvas, one.key)}
onpick={(row) => void ws.pick(canvas, one.key, row.call)}
onpick={(call) => void ws.pick(canvas, one.key, call)}
oncanvas={(id) => {
ws.closeLauncher(canvas, one.key);
void ws.activate(id);
web/workspace/lib/organisms/Tile.svelte+22−8
@@ -11,7 +11,7 @@
import { getTileContext } from '../context';
import { launcher } from '../launcher.svelte';
import { NowPlaying } from '../nowplaying.svelte';
import type { Tile } from '../model';
import type { Actor, Tile } from '../model';
import TileMark from '../molecules/TileMark.svelte';
import { preview, type Preview } from '../preview';
import { profile } from '../profiles.svelte';
@@ -33,6 +33,7 @@
canvas,
title,
account,
me,
focused,
arrived,
chain,
@@ -57,6 +58,8 @@
title: string;
/** The account whose data it shows, by DID or handle, or null for none (a feed). */
account: string | null;
/** Who is signed in: an account of theirs is "You". */
me: Actor;
focused: boolean;
arrived: boolean;
chain: number | undefined;
@@ -105,12 +108,13 @@
return known?.handle ?? (answered?.did === account ? answered.handle : null) ?? null;
});
/** Whether the account is the person's own: then the header says "You", not their handle. */
const mine = $derived(account !== null && (account === launcher.me.did || (handle !== null && handle === launcher.me.handle)));
const mine = $derived(account !== null && (account === me.did || (handle !== null && handle === me.handle)));
const did = $derived(account?.startsWith('did:') ? account : (known?.did ?? answered?.did ?? null));
/** Open the account's profile across its apps, from its handle in the header; none on that profile itself. */
const openWhole = $derived(
handle && tile.tool !== 'describe_repo' ? () => open({ name: 'describe_repo', args: { actor: did ?? handle } }) : null
);
/** Open the account's profile across its apps, from its handle (or "You") in the header; none on that profile itself. */
const openWhole = $derived.by(() => {
const actor = did ?? handle;
return actor && tile.tool !== 'describe_repo' ? () => open({ name: 'describe_repo', args: { actor } }) : null;
});
const atUri = $derived(atUriOf(tile.tool, tile.arguments, did));
const nsid = $derived(nsidOf(tile.tool, tile.arguments));
/** The app whose data it shows, to open its page from its icon: none for a profile, or an app's page itself. */
@@ -296,7 +300,11 @@
<div class="titles">
<div class="title-row">
<h2 {title}>{title}</h2>
{#if handle && !mine}
{#if mine && openWhole}
<button type="button" class="inline-who whole" title="Your profile across your apps" onclick={openWhole}>You</button>
{:else if mine}
<span class="inline-who">You</span>
{:else if handle}
{#if openWhole}<button type="button" class="inline-who whole" title="@{handle} across their apps" onclick={openWhole}>@{handle}</button>{:else}<span class="inline-who">@{handle}</span>{/if}
{/if}
{#if tile.by === 'agent'}
@@ -305,7 +313,7 @@
{#if author && !showsAuthor}<Avatar did={author} size="sm" prefix="Added by " />{/if}
</div>
<div class="about">
{#if mine}<span class="who">You</span>{:else if handle && openWhole}<button type="button" class="who whole" title="@{handle} across their apps" onclick={openWhole}><Handle did={did ?? handle} {handle} /></button>{:else if handle}<span class="who"><Handle did={did ?? handle} {handle} /></span>{/if}
{#if mine && openWhole}<button type="button" class="who whole" title="Your profile across your apps" onclick={openWhole}>You</button>{:else if mine}<span class="who">You</span>{:else if handle && openWhole}<button type="button" class="who whole" title="@{handle} across their apps" onclick={openWhole}><Handle did={did ?? handle} {handle} /></button>{:else if handle}<span class="who"><Handle did={did ?? handle} {handle} /></span>{/if}
{#if app}<span>{app.name}</span>{/if}
{#if source}
<button type="button" class="crumb" title="Opened from {source.title}: go there" onclick={onsource}>from <span>{source.title}</span></button>
@@ -560,6 +568,12 @@
white-space: nowrap;
}
/* As a button, a finger's target, padded out past its words without moving them. */
.inline-who.whole {
margin: calc(-1 * var(--space-3)) calc(-1 * var(--space-1-5));
padding: var(--space-3) var(--space-1-5);
}
.back {
margin-inline: calc(-1 * var(--space-1)) calc(-1 * var(--space-1-5));
}