chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.6.0 Latest 5 packages
0
0
Apps on HUD: the web shell, Grain's screens, Android's HUDKit, the SDK
.knotless/workflows/release-pull.ymlnew+122−0
| @@ -0,0 +1,122 @@ | ||
# Keeps one pull open that releases HUD's SDK, as knotless's release-pull.yml | ||
# does for its client: asked for at main, when main has change files, it | ||
# runs `knope release` on main's tip and force-pushes the commit to | ||
# `release/next`, opening a pull titled `Release <version>`, or bringing the | ||
# open one up to date. Landing that pull bumps every package's version | ||
# together (knope.toml); release.yml, asked for at main once it has landed, | ||
# publishes them. Nothing is queued here, so when to release stays the | ||
# owner's call. | ||
# | ||
# knotless run rerun knotless://chadtmiller.com/hud --ref refs/heads/main --workflow release-pull | ||
# | ||
# The version is worked out here and given to knope with | ||
# --override-version: a change file's `minor` or `major` bumps 0.x's minor, | ||
# where knope would bump the patch, and a `patch` the patch; from 1.0 on, | ||
# each bumps its own part. A pull already holding main's change files, and | ||
# still merging with main, is left alone. The open pull is found by its | ||
# title, `Release x.y.z` by the owner. Asked for on any other branch, it | ||
# makes the release commit there and prints the pull's body, pushing | ||
# nothing. | ||
# | ||
# RELEASE_PASSWORD is release.yml's app password of the owner's, granted | ||
# to main alone. | ||
| ||
# Its secrets are on ci.knotless.dev alone, the runner that runs only its | ||
# owner's repositories. | ||
runners: [ci.knotless.dev] | ||
on: | ||
asked: {refs: [refs/heads/*]} | ||
image: node:24.22.1 | ||
secrets: [RELEASE_PASSWORD] | ||
env: | ||
REPO: knotless://chadtmiller.com/hud | ||
OWNER: chadtmiller.com | ||
BRANCH: release/next | ||
KNOTLESS_APPVIEW: https://knotless.dev | ||
KNOPE_VERSION: 0.23.2 | ||
KNOPE_SHA256: c64f6281e012fc8e046ebd6f30be76c583e88b9ad55b00c7b1809b030db92eee | ||
steps: | ||
- name: changes | ||
run: | | ||
set -- .changeset/*.md | ||
if [ ! -e "$1" ]; then | ||
echo "no change files at $KNOTLESS_RUN_REF: nothing to release" | ||
touch ~/.done | ||
fi | ||
- name: tools | ||
run: | | ||
[ ! -e ~/.done ] || exit 0 | ||
cd /tmp | ||
curl -fsSLO "https://github.com/knope-dev/knope/releases/download/knope/v$KNOPE_VERSION/knope-x86_64-unknown-linux-musl.tgz" | ||
echo "$KNOPE_SHA256 knope-x86_64-unknown-linux-musl.tgz" | sha256sum -c - | ||
tar -xzf knope-x86_64-unknown-linux-musl.tgz | ||
install knope-x86_64-unknown-linux-musl/knope /usr/local/bin/ | ||
curl -fsSL https://knotless.dev/install.sh | KNOTLESS_INSTALL_DIR=/usr/local/bin sh | ||
- name: release commit | ||
run: | | ||
[ ! -e ~/.done ] || exit 0 | ||
git config --global --add safe.directory "$PWD" | ||
set -- .changeset/*.md | ||
count=$# | ||
bumps=$(sed -n 's/^default: *//p' "$@") | ||
current=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | ||
IFS=. read -r major minor patch <<EOF | ||
$current | ||
EOF | ||
if echo "$bumps" | grep -qx major && [ "$major" != 0 ]; then | ||
version=$((major + 1)).0.0 | ||
elif echo "$bumps" | grep -qxE 'major|minor'; then | ||
version=$major.$((minor + 1)).0 | ||
else | ||
version=$major.$minor.$((patch + 1)) | ||
fi | ||
echo "$version" > ~/.version | ||
knope release --override-version "$version" | ||
git -c user.name=knotless -c user.email=knotless@knotless.invalid commit -aqm "Release $version" | ||
at=$(echo "$KNOTLESS_RUN_SHA" | cut -c1-12) | ||
notes=$(awk -v v="$version" '/^## / { on = ($2 == v); next } on' CHANGELOG.md) | ||
cat > ~/.body <<EOF | ||
Releases HUD $version, from the $count change files on main: its changelog is below. Once this lands, ask for release.yml at main to publish it. | ||
| ||
<details> | ||
<summary>release-pull.yml</summary> | ||
| ||
## What changes | ||
| ||
HUD $version, as \`knope release --override-version $version\` makes it from main at $at: every version knope.toml names from $current to $version (the crates, the web packages, hudkit's), the version's CHANGELOG.md section, and the change files removed. | ||
| ||
$notes | ||
| ||
## Why | ||
| ||
Apps built on HUD get main's changes only from a release. A 0.x minor change bumps the minor here, where knope alone would bump the patch. | ||
| ||
## How it was checked | ||
| ||
The build is left to CI. | ||
| ||
</details> | ||
EOF | ||
cat ~/.body | ||
- name: pull | ||
on: {refs: [refs/heads/main]} | ||
run: | | ||
[ ! -e ~/.done ] || exit 0 | ||
version=$(cat ~/.version) | ||
export KNOTLESS_IDENTIFIER="$OWNER" KNOTLESS_PASSWORD="$RELEASE_PASSWORD" | ||
pull=$(knotless pull list "$REPO" -q "is:pull state:open author:$OWNER Release" | | ||
awk -F '\t' '$4 ~ /^Release [0-9]+\.[0-9]+\.[0-9]+$/ { print $3; exit }') | ||
if [ -n "$pull" ] && git fetch -q "$REPO" "refs/heads/$BRANCH" && | ||
[ "$(git rev-parse "FETCH_HEAD^:.changeset")" = "$(git rev-parse "$KNOTLESS_RUN_SHA:.changeset")" ] && | ||
git merge-tree --write-tree "$KNOTLESS_RUN_SHA" FETCH_HEAD > /dev/null; then | ||
echo "$pull releases main's change files already and merges with main: nothing to push" | ||
exit 0 | ||
fi | ||
git push -q --force "$REPO" "HEAD:refs/heads/$BRANCH" | ||
if [ -z "$pull" ]; then | ||
knotless pull create "$REPO" main "$REPO" "$BRANCH" "Release $version" -m - < ~/.body | ||
else | ||
knotless pull retarget "$REPO" "$pull" --head "$BRANCH" | ||
knotless pull edit "$REPO" "$pull" --title "Release $version" -m - < ~/.body | ||
echo "updated $pull" | ||
fi | ||
.knotless/workflows/release.ymlnew+150−0
| @@ -0,0 +1,150 @@ | ||
# Publishes HUD's SDK at the version Cargo.toml names, the one version of | ||
# every package (knope.toml), to HUD's registries on knotless (docs/sdk.md): | ||
# @hud/renderer, @hud/shared and @hud/shell to its npm registry, HUDKit to | ||
# its Swift package registry as hud.HUDKit, and hudkit to its Maven | ||
# repository as place.hud:hudkit; then tags the commit v<version>, as the | ||
# owner, so a checkout finds the version by name. A version is released | ||
# only with its CHANGELOG.md section, which release-pull.yml writes. | ||
# | ||
# A release is cut by asking for it at main, never by a push: | ||
# | ||
# knotless run rerun knotless://chadtmiller.com/hud --ref refs/heads/main --workflow release | ||
# | ||
# Asked for at any other branch, it builds every package and publishes | ||
# nothing, to try the build. Each publication is skipped where its version | ||
# is out already (a registry refuses a version twice), so a run that failed | ||
# partway is asked for again to finish. Until knotless.dev answers the Swift | ||
# and Maven registries (every answer under /swift/ carries `Content-Version: | ||
# 1`, and a refusal under /maven/ is text/plain where the site's own 404 is | ||
# HTML), those two are built, skipped and said so. | ||
# | ||
# RELEASE_PASSWORD is an app password of the owner's, chadtmiller.com, | ||
# granted to main alone in the runner's secrets. | ||
| ||
# Its secrets are on ci.knotless.dev alone, the runner that runs only its | ||
# owner's repositories. | ||
runners: [ci.knotless.dev] | ||
on: | ||
asked: {refs: [refs/heads/*]} | ||
superseded: finish | ||
# A JDK for Gradle, and the Android SDK and Node installed below. | ||
image: eclipse-temurin:17-jdk-noble | ||
cache: [/opt/node, /opt/android, /root/.gradle, web/node_modules] | ||
secrets: [RELEASE_PASSWORD] | ||
env: | ||
REPO: knotless://chadtmiller.com/hud | ||
OWNER: chadtmiller.com | ||
KNOTLESS_APPVIEW: https://knotless.dev | ||
# HUD's registries: each is the repository's, named by its owner's DID | ||
# and its key. | ||
NPM_REGISTRY: https://knotless.dev/npm/did:plc:bcgltzqazw5tb6k2g3ttenbj/3n2kdckpvmnlo/ | ||
SWIFT_REGISTRY: https://knotless.dev/swift/did:plc:bcgltzqazw5tb6k2g3ttenbj/3n2kdckpvmnlo/ | ||
HUD_MAVEN_URL: https://knotless.dev/maven/did:plc:bcgltzqazw5tb6k2g3ttenbj/3n2kdckpvmnlo/ | ||
ANDROID_HOME: /opt/android | ||
# The Android SDK's command-line tools (23.0), by the SHA-1 Google's | ||
# repository index gives them; Gradle installs the platform and build | ||
# tools hudkit names into ANDROID_HOME once their licences are accepted. | ||
ANDROID_TOOLS: commandlinetools-linux-16111833_latest.zip | ||
ANDROID_TOOLS_SHA1: e025545c62a8e64c7559119566a569fb1dec5f60 | ||
steps: | ||
- name: tools | ||
run: | | ||
apt-get update -qq | ||
apt-get install -y -qq --no-install-recommends curl git unzip xz-utils >/dev/null | ||
git config --global --add safe.directory "$PWD" | ||
if [ ! -x "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" ]; then | ||
cd /tmp | ||
curl -fsSLO "https://dl.google.com/android/repository/$ANDROID_TOOLS" | ||
echo "$ANDROID_TOOLS_SHA1 $ANDROID_TOOLS" | sha1sum -c - | ||
rm -rf "$ANDROID_HOME/cmdline-tools" | ||
mkdir -p "$ANDROID_HOME/cmdline-tools" | ||
unzip -q "$ANDROID_TOOLS" -d "$ANDROID_HOME/cmdline-tools" | ||
mv "$ANDROID_HOME/cmdline-tools/cmdline-tools" "$ANDROID_HOME/cmdline-tools/latest" | ||
rm "$ANDROID_TOOLS" | ||
fi | ||
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --licenses >/dev/null | ||
curl -fsSL https://knotless.dev/install.sh | KNOTLESS_INSTALL_DIR=/usr/local/bin sh | ||
- uses: chadtmiller.com/steps/node@1 | ||
with: {version: 24.22.1} | ||
- uses: chadtmiller.com/steps/npm-ci@1 | ||
name: packages | ||
with: {dir: web} | ||
- name: version | ||
run: | | ||
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) | ||
echo "$version" > ~/.version | ||
echo "HUD $version, at $KNOTLESS_RUN_REF" | ||
[ "$KNOTLESS_RUN_REF" = refs/heads/main ] || echo "not main: building every package, publishing nothing" | ||
grep -q "^## $version\( \|$\)" CHANGELOG.md || { echo "CHANGELOG.md has no section for $version"; exit 1; } | ||
- name: build npm | ||
run: | | ||
mkdir -p ~/npm | ||
cd web | ||
npm run package | ||
for p in renderer shared shell; do npm pack -w "$p" --pack-destination ~/npm; done | ||
- name: build swift | ||
run: | | ||
version=$(cat ~/.version) | ||
# SwiftPM takes a source archive of one directory holding | ||
# Package.swift: HUDKit's, from ios/HUDKit, as it is at this commit. | ||
git archive --format=zip --prefix=HUDKit/ -o ~/HUDKit-"$version".zip "$KNOTLESS_RUN_SHA:ios/HUDKit" | ||
ls -l ~/HUDKit-"$version".zip | ||
- name: build maven | ||
timeout: 30 | ||
run: | | ||
# The AAR, its sources, its POM and module metadata, as they will be published. | ||
cd android && ./gradlew :hudkit:publishToMavenLocal --console=plain --no-daemon | ||
ls ~/.m2/repository/place/hud/hudkit/"$(cat ~/.version)" | ||
- name: publish npm | ||
on: {refs: [refs/heads/main]} | ||
run: | | ||
version=$(cat ~/.version) | ||
# npm's token here is `<handle>:<app password>`. | ||
echo "//${NPM_REGISTRY#https://}:_authToken=$OWNER:$RELEASE_PASSWORD" > ~/.npmrc | ||
for p in renderer shared shell; do | ||
if npm view "@hud/$p@$version" version --registry "$NPM_REGISTRY" 2>/dev/null | grep -qxF "$version"; then | ||
echo "@hud/$p $version is published already" | ||
else | ||
npm publish ~/npm/hud-"$p"-"$version".tgz --registry "$NPM_REGISTRY" | ||
fi | ||
done | ||
rm ~/.npmrc | ||
- name: publish swift | ||
on: {refs: [refs/heads/main]} | ||
run: | | ||
version=$(cat ~/.version) | ||
accept='Accept: application/vnd.swift.registry.v1+json' | ||
if ! curl -sI "${SWIFT_REGISTRY}hud/HUDKit" | grep -qi '^content-version: *1'; then | ||
echo "knotless.dev has no Swift registry yet: hud.HUDKit $version is not published" | ||
elif curl -fsS -o /dev/null -H "$accept" "${SWIFT_REGISTRY}hud/HUDKit/$version"; then | ||
echo "hud.HUDKit $version is published already" | ||
else | ||
curl -fsS -X PUT -u "$OWNER:$RELEASE_PASSWORD" -H "$accept" \ | ||
-F "source-archive=@$HOME/HUDKit-$version.zip;type=application/zip" \ | ||
-F 'metadata={"description": "HUD'\''s renderer in SwiftUI, and the client that calls its tools", "repositoryURLs": ["https://knotless.dev/chadtmiller.com/hud"]};type=application/json' \ | ||
"${SWIFT_REGISTRY}hud/HUDKit/$version" | ||
echo "published hud.HUDKit $version" | ||
fi | ||
- name: publish maven | ||
on: {refs: [refs/heads/main]} | ||
timeout: 30 | ||
run: | | ||
version=$(cat ~/.version) | ||
kind=$(curl -sI "${HUD_MAVEN_URL}place/hud/hudkit/maven-metadata.xml" | tr -d '\r' | sed -n 's/^content-type: *//Ip') | ||
if [ -z "$kind" ] || echo "$kind" | grep -qi 'text/html'; then | ||
echo "knotless.dev has no Maven repository yet: place.hud:hudkit $version is not published" | ||
elif curl -fsI -o /dev/null "${HUD_MAVEN_URL}place/hud/hudkit/$version/hudkit-$version.pom"; then | ||
echo "place.hud:hudkit $version is published already" | ||
else | ||
cd android | ||
HUD_MAVEN_USERNAME="$OWNER" HUD_MAVEN_PASSWORD="$RELEASE_PASSWORD" ./gradlew :hudkit:publish --console=plain --no-daemon | ||
fi | ||
- name: tag | ||
on: {refs: [refs/heads/main]} | ||
run: | | ||
version=$(cat ~/.version) | ||
if git ls-remote --exit-code --tags "https://knotless.dev/chadtmiller.com/hud" "refs/tags/v$version" >/dev/null; then | ||
echo "v$version is tagged already" | ||
else | ||
KNOTLESS_IDENTIFIER="$OWNER" KNOTLESS_PASSWORD="$RELEASE_PASSWORD" knotless tag create "$REPO" "v$version" "$KNOTLESS_RUN_SHA" | ||
fi | ||
.knotless/workflows/test.yml+12−5
| @@ -1,11 +1,13 @@ | ||
# The tests, as `just check` and `just lex` run them: every crate's under | ||
# `just cov`'s gate, failing under 100% of lines or functions, then every | ||
# XRPC answer hud-server's tests received, held to its method's lexicon | ||
# (harness/answers.mjs), as the workspace's types are made from them. | ||
# hud-server embeds the built pages, so they are built first. | ||
# (harness/answers.mjs), as the workspace's types are made from them, and | ||
# the views and app files held to the JSON Schemas HUD publishes | ||
# (harness/schemas.mjs). hud-server embeds the built pages, so they are | ||
# built first. | ||
# | ||
# The build, the toolchain, cargo-llvm-cov, Node, the pages' packages and | ||
# @atproto/lexicon are kept between runs. | ||
# The build, the toolchain, cargo-llvm-cov, Node, the pages' packages, | ||
# @atproto/lexicon and ajv are kept between runs. | ||
image: rust:1.100 | ||
# A pre-flight, as check is: the merge queue takes a pull into a batch only | ||
# once this has passed at its head. | ||
| @@ -14,7 +16,7 @@ runners: [runner.knotless.dev] | ||
on: | ||
push: {refs: [refs/heads/main]} | ||
pull: {base: [refs/heads/main, refs/heads/feature/*]} | ||
cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/tools, /opt/node, /opt/lexicon, web/node_modules] | ||
cache: [target, /usr/local/cargo/registry, /usr/local/rustup, /opt/tools, /opt/node, /opt/lexicon, /opt/ajv, web/node_modules] | ||
env: | ||
# The image's toolchain, over the cached rustup's default (check.yml). | ||
RUSTUP_TOOLCHAIN: "1.100.0" | ||
| @@ -44,3 +46,8 @@ steps: | ||
v=$(node -p "require('./harness/package.json').dependencies['@atproto/lexicon']") | ||
[ -d "/opt/lexicon/$v/node_modules/@atproto/lexicon" ] || npm install --prefix "/opt/lexicon/$v" --no-audit --no-fund "@atproto/lexicon@$v" | ||
NODE_PATH="/opt/lexicon/$v/node_modules" node harness/answers.mjs target/answers | ||
- name: schemas | ||
run: | | ||
v=$(node -p "require('./harness/package.json').dependencies.ajv") | ||
[ -d "/opt/ajv/$v/node_modules/ajv" ] || npm install --prefix "/opt/ajv/$v" --no-audit --no-fund "ajv@$v" | ||
NODE_PATH="/opt/ajv/$v/node_modules" node harness/schemas.mjs | ||
.knotless/workflows/web.yml+11−3
| @@ -1,9 +1,13 @@ | ||
# The workspace's pages, as `just check` and `just lint` check them: | ||
# svelte-check, which fails on any warning, over types made from HUD's | ||
# lexicons; each component using only its own layer and those below | ||
# (harness/layers.mjs); and every text colour at WCAG AA on what it is | ||
# drawn on, in light and dark (harness/contrast.mjs). The packages are kept | ||
# between runs and installed again only when the lockfile changes. | ||
# (harness/layers.mjs); every text colour at WCAG AA on what it is | ||
# drawn on, in light and dark (harness/contrast.mjs); the renderer and | ||
# the shell drawn on a server and hydrated in a browser's document, | ||
# Grain's screens alike both ways (web/renderer/test/ssr.mjs) and a | ||
# frame alike at every width (web/shell/test/ssr.mjs); and the shell's | ||
# unit tests. The packages are kept between runs and installed again only | ||
# when the lockfile changes. | ||
image: node:24.22.1 | ||
# A pre-flight: the merge queue takes a pull into a batch only once this | ||
# has passed at its head. It takes seconds. | ||
| @@ -29,3 +33,7 @@ steps: | ||
run: node harness/contrast.mjs | ||
- name: svelte-check | ||
run: cd web && npm run check | ||
- name: ssr | ||
run: cd web && npm run ssr | ||
- name: unit | ||
run: cd web && npm run unit | ||
android/app/src/main/java/place/hud/app/GalleryScreen.kt+8−1
| @@ -163,8 +163,10 @@ private fun Tile(entry: GalleryEntry, modifier: Modifier) { | ||
ResultView(entry.drawn, entry.context, Modifier.fillMaxSize()) | ||
} else { | ||
CompositionLocalProvider(LocalListBleed provides Space.s3) { | ||
// A bleeding picture, map or tiles first meets the header: no padding over it. | ||
val top = if (entry.drawn.leadsTileWithBleed) 0.dp else Space.s2 | ||
Column( | ||
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = Space.s3, vertical = Space.s2), | ||
Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(start = Space.s3, top = top, end = Space.s3, bottom = Space.s2), | ||
verticalArrangement = Arrangement.spacedBy(Space.s3), | ||
) { | ||
ResultView(entry.drawn, entry.context) | ||
| @@ -248,6 +250,11 @@ private fun inert(id: String, result: ToolResult, drawn: Drawn, answers: Map<Cal | ||
onOpenActor = { Log.i(TAG, "$id: open actor $it") } | ||
onOpenLink = { Log.i(TAG, "$id: open link $it") } | ||
onReplace = { Log.i(TAG, "$id: tab ${it.name}") } | ||
onSheet = { Log.i(TAG, "$id: sheet ${it.name}") } | ||
onPages = { pages, _ -> Log.i(TAG, "$id: pages ${pages.at + 1} of ${pages.calls.size}") } | ||
onEnd = { Log.i(TAG, "$id: slides ran off ${it.name}") } | ||
onHost = { Log.i(TAG, "$id: host ${it.key}") } | ||
onLeave = { Log.i(TAG, "$id: leave") } | ||
onCall = { call, _ -> Log.i(TAG, "$id: open ${call.name}") } | ||
if (result.viewer != null) { | ||
onAction = { action -> | ||
android/gradle/wrapper/gradle-wrapper.properties+1−0
| @@ -1,6 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip | ||
distributionSha256Sum=acd53f1edaf02f1a8ff99879f8a34b302661a057d9b063ae9e35b552f804d20a | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
android/gradle/libs.versions.toml+8−0
| @@ -10,6 +10,10 @@ coroutines = "1.10.2" | ||
okhttp = "5.5.0" | ||
coil = "3.5.0" | ||
media3 = "1.11.1" | ||
maplibreCompose = "0.14.0" | ||
# The OpenGL build of maplibre-compose's MapLibre Native (13.0.2), in place of | ||
# its Vulkan one: see hudkit/build.gradle.kts. | ||
maplibreNative = "13.0.2" | ||
junit = "4.13.2" | ||
robolectric = "4.16" | ||
testCore = "1.7.0" | ||
| @@ -32,8 +36,12 @@ kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx- | ||
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" } | ||
kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" } | ||
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } | ||
mockwebserver = { group = "com.squareup.okhttp3", name = "mockwebserver3", version.ref = "okhttp" } | ||
androidx-browser = { group = "androidx.browser", name = "browser", version = "1.10.0" } | ||
coil-compose = { group = "io.coil-kt.coil3", name = "coil-compose", version.ref = "coil" } | ||
coil-network-okhttp = { group = "io.coil-kt.coil3", name = "coil-network-okhttp", version.ref = "coil" } | ||
maplibre-compose = { group = "org.maplibre.compose", name = "maplibre-compose", version.ref = "maplibreCompose" } | ||
maplibre-native-opengl = { group = "org.maplibre.gl", name = "android-sdk-opengl", version.ref = "maplibreNative" } | ||
androidx-exifinterface = { group = "androidx.exifinterface", name = "exifinterface", version = "1.4.2" } | ||
junit = { group = "junit", name = "junit", version.ref = "junit" } | ||
robolectric = { group = "org.robolectric", name = "robolectric", version.ref = "robolectric" } | ||
android/hudkit/src/main/assets/basemap/dark.jsonnew+10929−0
A large diff, not shown.
android/hudkit/src/main/assets/basemap/light.jsonnew+10929−0
A large diff, not shown.
android/hudkit/src/main/java/place/hud/kit/data/Client.ktnew+178−0
| @@ -0,0 +1,178 @@ | ||
package place.hud.kit.data | ||
| ||
import kotlinx.coroutines.suspendCancellableCoroutine | ||
import kotlinx.serialization.json.JsonElement | ||
import kotlinx.serialization.json.JsonObject | ||
import okhttp3.Callback | ||
import okhttp3.MediaType.Companion.toMediaType | ||
import okhttp3.OkHttpClient | ||
import okhttp3.Request | ||
import okhttp3.RequestBody | ||
import okhttp3.RequestBody.Companion.toRequestBody | ||
import okhttp3.Response | ||
import okio.BufferedSink | ||
import java.io.IOException | ||
import java.util.concurrent.TimeUnit | ||
import kotlin.coroutines.resume | ||
import kotlin.coroutines.resumeWithException | ||
| ||
/** What went wrong calling HUD. */ | ||
sealed class HudError(message: String) : Exception(message) { | ||
/** The tool needs an account, and the call had none (HTTP 401). */ | ||
data object SignIn : HudError("Sign in to do this.") | ||
| ||
/** The server refused the request, in its words. */ | ||
class Server(message: String) : HudError(message) | ||
| ||
/** The tool answered with an error, in its words. */ | ||
class Tool(message: String) : HudError(message) | ||
} | ||
| ||
/** | ||
* The one HTTP client HUDKit calls with, and the app may too: one pool of | ||
* connections. Its timeouts are URLSession's, a minute without a byte. | ||
*/ | ||
object Http { | ||
val client: OkHttpClient = OkHttpClient.Builder() | ||
.connectTimeout(60, TimeUnit.SECONDS) | ||
.readTimeout(60, TimeUnit.SECONDS) | ||
.writeTimeout(60, TimeUnit.SECONDS) | ||
.build() | ||
} | ||
| ||
/** | ||
* HUD's tools, called over its MCP endpoint (`POST /mcp`) statelessly, as | ||
* the modern protocol era allows: each request names its version, method | ||
* and tool in headers and `_meta`, so there is no session to open. With a | ||
* token, or a signed-in session's, calls are the account's; without, as no | ||
* one: public data only. A session's token refused (HTTP 401) is renewed | ||
* once and the call made again. Safe to call from the main thread: the | ||
* requests go on OkHttp's own. | ||
*/ | ||
class HudClient(val base: String, val session: AccountSession? = null, val token: String? = null) { | ||
| ||
/** Call a tool: its result, failures included (`isError`), or a thrown error when the call could not be made at all. */ | ||
suspend fun call(call: Call): ToolResult { | ||
val body = json( | ||
"jsonrpc" to "2.0", | ||
"id" to 1, | ||
"method" to "tools/call", | ||
"params" to json( | ||
"name" to call.name, | ||
"arguments" to call.args, | ||
"_meta" to json( | ||
"io.modelcontextprotocol/protocolVersion" to VERSION, | ||
"io.modelcontextprotocol/clientCapabilities" to EmptyObject, | ||
), | ||
), | ||
).toString().toRequestBody(JSON_TYPE) | ||
var token = this.token | ||
if (session != null) token = session.token() | ||
var answer = Http.client.fetch(mcpRequest(call.name, body, token)) | ||
if (answer.status == 401 && session != null && token != null) { | ||
val renewed = session.refused(token) ?: throw HudError.SignIn | ||
answer = Http.client.fetch(mcpRequest(call.name, body, renewed)) | ||
} | ||
if (answer.status == 401) throw HudError.SignIn | ||
val found = HudJson.parseToJsonElement(answer.body.decodeToString()) | ||
found["error"]?.let { throw HudError.Server(it["message"].string ?: "The server refused the call.") } | ||
val result = found["result"] ?: throw HudError.Server("The server answered no result.") | ||
return ToolResult(result) | ||
} | ||
| ||
private fun mcpRequest(name: String, body: RequestBody, token: String?): Request = | ||
Request.Builder() | ||
.url(url("mcp")) | ||
.post(body) | ||
.header("Accept", "application/json, text/event-stream") | ||
.header("MCP-Protocol-Version", VERSION) | ||
.header("Mcp-Method", "tools/call") | ||
.header("Mcp-Name", name) | ||
.apply { if (token != null) header("Authorization", "Bearer $token") } | ||
.build() | ||
| ||
/** | ||
* Upload an image's bytes (`place.hud.uploadBlob`) as the account's blob, | ||
* for a record it writes next, telling `progress` how much has gone (0 to | ||
* 1, on OkHttp's thread as it goes, then 1 where it was called): the | ||
* blob ref its PDS answered. The account's token, renewed once when it | ||
* is refused; refused again, the session is over ([HudError.SignIn]). | ||
*/ | ||
suspend fun uploadBlob(bytes: ByteArray, type: String = "image/jpeg", progress: (Float) -> Unit = {}): JsonElement { | ||
val body = Told(bytes.toRequestBody(type.toMediaType()), progress) | ||
val token = (if (session != null) session.token() else this.token) ?: throw HudError.SignIn | ||
var answer = Http.client.fetch(blobRequest(body, token)) | ||
if (answer.status == 401 && session != null) { | ||
val renewed = session.refused(token) ?: throw HudError.SignIn | ||
answer = Http.client.fetch(blobRequest(body, renewed)) | ||
} | ||
if (answer.status == 401) throw HudError.SignIn | ||
val found = answer.json | ||
if (answer.status != 200) { | ||
throw HudError.Server(found.str("message") ?: found.str("error") ?: "HUD answered ${answer.status}.") | ||
} | ||
val blob = found["blob"] | ||
if (blob !is JsonObject) throw HudError.Server("HUD answered no blob.") | ||
progress(1f) | ||
return blob | ||
} | ||
| ||
private fun blobRequest(body: RequestBody, token: String): Request = | ||
Request.Builder() | ||
.url(url("xrpc/place.hud.uploadBlob")) | ||
.post(body) | ||
.header("Authorization", "Bearer $token") | ||
.build() | ||
| ||
private fun url(path: String): String = base.trimEnd('/') + "/" + path | ||
| ||
companion object { | ||
const val VERSION = "2026-07-28" | ||
private val JSON_TYPE = "application/json".toMediaType() | ||
} | ||
} | ||
| ||
/** An HTTP answer: its status and its body's bytes. */ | ||
internal class Fetched(val status: Int, val body: ByteArray) { | ||
/** Its body as JSON; null where it is none. */ | ||
val json: JsonElement? get() = runCatching { HudJson.parseToJsonElement(body.decodeToString()) }.getOrNull() | ||
} | ||
| ||
/** Send a request on OkHttp's threads, cancelled with the coroutine waiting for it: what came back, whatever its status. */ | ||
internal suspend fun OkHttpClient.fetch(request: Request): Fetched = suspendCancellableCoroutine { waiting -> | ||
val call = newCall(request) | ||
waiting.invokeOnCancellation { call.cancel() } | ||
call.enqueue(object : Callback { | ||
override fun onFailure(call: okhttp3.Call, e: IOException) { | ||
waiting.resumeWithException(e) | ||
} | ||
| ||
override fun onResponse(call: okhttp3.Call, response: Response) { | ||
val read = runCatching { response.use { Fetched(it.code, it.body.bytes()) } } | ||
read.onSuccess { waiting.resume(it) }.onFailure { waiting.resumeWithException(it) } | ||
} | ||
}) | ||
} | ||
| ||
/** A body that tells how much of it has gone, as it goes (0 to 1). */ | ||
private class Told(private val body: RequestBody, private val tell: (Float) -> Unit) : RequestBody() { | ||
override fun contentType() = body.contentType() | ||
override fun contentLength() = body.contentLength() | ||
| ||
override fun writeTo(sink: BufferedSink) { | ||
val total = contentLength() | ||
val buffer = okio.Buffer() | ||
body.writeTo(buffer) | ||
var sent = 0L | ||
while (!buffer.exhausted()) { | ||
val read = buffer.read(sink.buffer, CHUNK) | ||
sink.emit() | ||
sent += read | ||
if (total > 0) tell(sent.toFloat() / total) | ||
} | ||
} | ||
| ||
private companion object { | ||
const val CHUNK = 64 * 1024L | ||
} | ||
} | ||
android/hudkit/src/main/java/place/hud/kit/data/Compose.kt+31−3
| @@ -16,6 +16,7 @@ import java.time.LocalDateTime | ||
import java.time.ZoneId | ||
import java.time.ZoneOffset | ||
import java.time.format.DateTimeFormatter | ||
import kotlin.math.abs | ||
import kotlin.math.max | ||
import kotlin.math.min | ||
import kotlin.math.roundToInt | ||
| @@ -260,12 +261,33 @@ internal object ComposeExif { | ||
) | ||
} | ||
| ||
/** | ||
* Where a photo was taken, from the GPS `ExifInterface` reads of the | ||
* original, in degrees, south and west below zero: for a place field to be | ||
* filled from, never sent. None without both, or at 0, 0, where a camera | ||
* with no fix writes. | ||
*/ | ||
internal data class PhotoPoint(val lat: Double, val lon: Double) { | ||
companion object { | ||
/** The point of degrees already signed by their hemispheres, where it is one. */ | ||
fun of(lat: Double?, lon: Double?): PhotoPoint? { | ||
if (lat == null || lon == null || !lat.isFinite() || !lon.isFinite()) return null | ||
if (abs(lat) > 90 || abs(lon) > 180 || (lat == 0.0 && lon == 0.0)) return null | ||
return PhotoPoint(lat, lon) | ||
} | ||
| ||
/** The point a photo's EXIF gives (`latLong` signs it by its refs). */ | ||
fun of(exif: ExifInterface): PhotoPoint? = exif.latLong?.let { of(it[0], it[1]) } | ||
} | ||
} | ||
| ||
/** | ||
* A photo made ready to upload: a JPEG of at most `maxSide` pixels a side and | ||
* `maxBytes`, upright, without the original's metadata (a bitmap encoded | ||
* afresh carries none); its size; and the original's EXIF, when asked. | ||
* afresh carries none); its size; the original's EXIF, when asked; and where | ||
* it was taken. | ||
*/ | ||
internal class PreparedPhoto(val jpeg: ByteArray, val width: Int, val height: Int, val exif: JsonObject?) { | ||
internal class PreparedPhoto(val jpeg: ByteArray, val width: Int, val height: Int, val exif: JsonObject?, val point: PhotoPoint? = null) { | ||
class Failure(message: String) : Exception(message) { | ||
companion object { | ||
val notAnImage get() = Failure("This isn't an image HUD can read.") | ||
| @@ -296,7 +318,13 @@ internal class PreparedPhoto(val jpeg: ByteArray, val width: Int, val height: In | ||
val out = ByteArrayOutputStream() | ||
if (!image.compress(Bitmap.CompressFormat.JPEG, quality, out)) throw Failure.notAnImage | ||
if (out.size() <= maxBytes) { | ||
return PreparedPhoto(out.toByteArray(), image.width, image.height, if (exif && read != null) ComposeExif.grain(ComposeExif.tags(read)) else null) | ||
return PreparedPhoto( | ||
out.toByteArray(), | ||
image.width, | ||
image.height, | ||
if (exif && read != null) ComposeExif.grain(ComposeExif.tags(read)) else null, | ||
read?.let(PhotoPoint::of), | ||
) | ||
} | ||
} | ||
} finally { | ||
android/hudkit/src/main/java/place/hud/kit/data/Interactions.ktnew+112−0
| @@ -0,0 +1,112 @@ | ||
package place.hud.kit.data | ||
| ||
import android.util.Log | ||
import kotlinx.coroutines.CancellationException | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Job | ||
import kotlinx.coroutines.delay | ||
import kotlinx.coroutines.launch | ||
import kotlinx.serialization.json.JsonElement | ||
| ||
/** | ||
* What HUD's apps tell a feed generator of what is done with its feed, as | ||
* web/shared/src/interactions.ts: the posts seen, the post opened, "more like | ||
* this" and "less like this". Only for a feed a trusted view draws, when | ||
* signed in. Seen and opened posts queue and go in batches through | ||
* `send_interactions` (`send`: how many went, or why none did), at most one | ||
* send every 10 s, and at once when the app moves on (`flush`); a "more/less | ||
* like this" goes at once (`now`). A failure drops the batch; a feed that | ||
* takes no interactions (`sent: 0` with a reason) is not told any more. Both | ||
* are logged (tag "interactions") with the feed, how many and why, never the | ||
* posts. Used from the main thread alone, its sends made in `scope`, as | ||
* iOS's is on its main actor. | ||
*/ | ||
class Interactions internal constructor( | ||
private val scope: CoroutineScope, | ||
private val send: suspend (feed: String, interactions: List<JsonElement>) -> Pair<Int, String?>, | ||
/** A monotonic clock, in ms; tests give their scheduler's. */ | ||
private val now: () -> Long, | ||
) { | ||
constructor(scope: CoroutineScope, send: suspend (feed: String, interactions: List<JsonElement>) -> Pair<Int, String?>) : | ||
this(scope, send, { System.nanoTime() / 1_000_000 }) | ||
| ||
private val queue = LinkedHashMap<String, MutableList<JsonElement>>() | ||
private val stopped = mutableSetOf<String>() | ||
private var last: Long? = null | ||
private var timer: Job? = null | ||
| ||
/** Queue one, to go with the next send: now, if the last was 10 s ago or more; else when it will have been. */ | ||
fun add(feed: String, interaction: JsonElement) { | ||
if (feed in stopped) return | ||
queue.getOrPut(feed) { mutableListOf() }.add(interaction) | ||
if (timer != null) return | ||
val wait = last?.let { it + EVERY_MS - now() } ?: 0L | ||
timer = scope.launch { | ||
if (wait > 0) delay(wait) | ||
// No longer waiting: `flush` cancels a waiting timer, and this one, | ||
// cancelled, would have its own send cancelled before it went. | ||
timer = null | ||
flush() | ||
} | ||
} | ||
| ||
/** Send everything queued, now. */ | ||
suspend fun flush() { | ||
timer?.cancel() | ||
timer = null | ||
if (queue.isEmpty()) return | ||
last = now() | ||
val queued = queue.toMap() | ||
queue.clear() | ||
for ((feed, interactions) in queued) { | ||
for (batch in interactions.chunked(BATCH)) deliver(feed, batch) | ||
} | ||
} | ||
| ||
/** | ||
* Send one now, apart from the queue, as for "more like this": a failure, | ||
* or a feed that takes none, throws, for the button to say. | ||
*/ | ||
suspend fun now(feed: String, interaction: JsonElement) { | ||
if (feed in stopped) throw HudError.Tool("This feed doesn't take feedback.") | ||
val (sent, reason) = try { | ||
send(feed, listOf(interaction)) | ||
} catch (e: CancellationException) { | ||
throw e | ||
} catch (e: Exception) { | ||
Log.e(TAG, "send_interactions for $feed failed: ${e.message}") | ||
throw e | ||
} | ||
if (sent == 0 && reason != null) { | ||
stop(feed, reason) | ||
throw HudError.Tool(reason) | ||
} | ||
} | ||
| ||
private suspend fun deliver(feed: String, interactions: List<JsonElement>) { | ||
if (feed in stopped) return | ||
try { | ||
val (sent, reason) = send(feed, interactions) | ||
if (sent == 0 && reason != null) stop(feed, reason) | ||
} catch (e: CancellationException) { | ||
throw e | ||
} catch (e: Exception) { | ||
Log.e(TAG, "send_interactions for $feed failed; ${interactions.size} dropped: ${e.message}") | ||
} | ||
} | ||
| ||
private fun stop(feed: String, reason: String) { | ||
Log.i(TAG, "send_interactions for $feed stopped: $reason") | ||
stopped += feed | ||
queue.remove(feed) | ||
} | ||
| ||
companion object { | ||
const val SEEN = "app.bsky.feed.defs#interactionSeen" | ||
const val CLICKTHROUGH = "app.bsky.feed.defs#clickthroughItem" | ||
| ||
private const val BATCH = 100 | ||
private const val EVERY_MS = 10_000L | ||
private const val TAG = "interactions" | ||
} | ||
} | ||
android/hudkit/src/main/java/place/hud/kit/data/Json.kt+31−6
android/hudkit/src/main/java/place/hud/kit/data/LastTree.ktnew+155−0
android/hudkit/src/main/java/place/hud/kit/data/Push.ktnew+211−0
android/hudkit/src/main/java/place/hud/kit/data/Result.kt+54−4
android/hudkit/src/main/java/place/hud/kit/data/Routes.ktnew+289−0
android/hudkit/src/main/java/place/hud/kit/data/SchemeChoice.ktnew+17−0
android/hudkit/src/main/java/place/hud/kit/data/SignIn.ktnew+653−0
653 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/data/SignInPlan.ktnew+343−0
android/hudkit/src/main/java/place/hud/kit/data/Skeleton.ktnew+235−0
android/hudkit/src/main/java/place/hud/kit/data/TabFirst.ktnew+43−0
android/hudkit/src/main/java/place/hud/kit/data/WebSignIn.ktnew+158−0
android/hudkit/src/main/java/place/hud/kit/parts/Beside.ktnew+49−0
android/hudkit/src/main/java/place/hud/kit/parts/ComposeFields.kt+470−89
559 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/parts/ComposeForm.kt+146−7
android/hudkit/src/main/java/place/hud/kit/parts/ComposeSheet.kt+60−23
android/hudkit/src/main/java/place/hud/kit/parts/HeaderCard.kt+14−9
android/hudkit/src/main/java/place/hud/kit/parts/ListLayout.kt+158−20
android/hudkit/src/main/java/place/hud/kit/parts/PhotoBadges.ktnew+169−0
android/hudkit/src/main/java/place/hud/kit/parts/ProfileCard.kt+17−13
android/hudkit/src/main/java/place/hud/kit/parts/RowLayout.kt+15−11
android/hudkit/src/main/java/place/hud/kit/parts/SplitLayout.ktnew+63−0
android/hudkit/src/main/java/place/hud/kit/parts/TextBody.kt+53−3
android/hudkit/src/main/java/place/hud/kit/support/Adaptive.ktnew+56−0
android/hudkit/src/main/java/place/hud/kit/support/Controls.kt+25−11
android/hudkit/src/main/java/place/hud/kit/support/Format.kt+6−4
android/hudkit/src/main/java/place/hud/kit/support/Glyphs.kt+15−1
android/hudkit/src/main/java/place/hud/kit/support/Picture.kt+22−6
android/hudkit/src/main/java/place/hud/kit/support/Space.kt+39−5
android/hudkit/src/main/java/place/hud/kit/support/Surface.kt+40−7
android/hudkit/src/main/java/place/hud/kit/tree/Accounts.ktnew+104−0
android/hudkit/src/main/java/place/hud/kit/tree/Acting.kt+473−146
619 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/tree/Composing.kt+188−56
android/hudkit/src/main/java/place/hud/kit/tree/MapView.ktnew+428−0
428 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/tree/Marks.kt+41−7
android/hudkit/src/main/java/place/hud/kit/tree/Media.kt+485−59
544 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/tree/Pictures.ktnew+833−0
833 lines changed: not loaded until asked for.
android/hudkit/src/main/java/place/hud/kit/tree/Structure.kt+233−57
android/hudkit/src/main/java/place/hud/kit/tree/TreeView.kt+210−61
android/hudkit/src/main/java/place/hud/kit/tree/Words.kt+13−44
android/hudkit/src/main/java/place/hud/kit/view/SkeletonView.ktnew+357−0
android/hudkit/src/main/java/place/hud/kit/view/ViewContext.kt+109−8
android/hudkit/src/main/res/xml/hudkit_camera_paths.xmlnew+5−0
android/hudkit/src/main/AndroidManifest.xmlnew+60−0
android/hudkit/src/test/java/place/hud/kit/AccountsTest.ktnew+56−0
android/hudkit/src/test/java/place/hud/kit/ClientTest.ktnew+164−0
android/hudkit/src/test/java/place/hud/kit/ComposeTest.kt+285−4
android/hudkit/src/test/java/place/hud/kit/ContextTest.ktnew+122−0
android/hudkit/src/test/java/place/hud/kit/InteractionsTest.ktnew+127−0
android/hudkit/src/test/java/place/hud/kit/LastTreeTest.ktnew+192−0
android/hudkit/src/test/java/place/hud/kit/LayoutTest.ktnew+233−0
android/hudkit/src/test/java/place/hud/kit/OpenedFormTest.ktnew+40−0
android/hudkit/src/test/java/place/hud/kit/PagesTest.ktnew+35−0
android/hudkit/src/test/java/place/hud/kit/PlanTest.ktnew+251−0
android/hudkit/src/test/java/place/hud/kit/ResultsTest.kt+2−0
android/hudkit/src/test/java/place/hud/kit/RoutesTest.ktnew+293−0
android/hudkit/src/test/java/place/hud/kit/SignInPlanTest.ktnew+177−0
android/hudkit/src/test/java/place/hud/kit/SignInTest.ktnew+325−0
android/hudkit/src/test/java/place/hud/kit/SkeletonTest.ktnew+203−0
android/hudkit/src/test/java/place/hud/kit/SlidesTest.ktnew+95−0
android/hudkit/src/test/java/place/hud/kit/TabFirstTest.ktnew+123−0
android/hudkit/build.gradle.kts+61−1
android/gradle.properties+2−0
crates/hud/src/main.rs+166−7
crates/hud/tests/cli.rs+267−3
crates/hud-core/src/canvas/canonical.rs+4−1
crates/hud-core/src/canvas/mod.rs+4−4
crates/hud-core/src/canvas/space.rs+10−3
crates/hud-core/src/canvas/tools.rs+4−1
crates/hud-core/src/oauth/tests/spaces.rs+1−1
crates/hud-core/src/oauth/client.rs+64−11
crates/hud-core/src/oauth/issuer.rs+148−28
crates/hud-core/src/oauth/mod.rs+92−19
crates/hud-core/src/oauth/tests.rs+258−34
crates/hud-core/src/testdata/grain/apps/pages/child-safety.mdnew+51−0
crates/hud-core/src/testdata/grain/apps/pages/community-guidelines.mdnew+39−0
crates/hud-core/src/testdata/grain/apps/pages/copyright.mdnew+21−0
crates/hud-core/src/testdata/grain/apps/pages/privacy.mdnew+41−0
crates/hud-core/src/testdata/grain/apps/pages/terms.mdnew+41−0
crates/hud-core/src/testdata/grain/apps/views/grain-app.jsonnew+846−0
846 lines changed: not loaded until asked for.
crates/hud-core/src/testdata/grain/apps/views/grain-blocks.jsonnew+114−0
crates/hud-core/src/testdata/grain/apps/views/grain-cameras.jsonnew+72−0
crates/hud-core/src/testdata/grain/apps/views/grain-comments.jsonnew+391−0
crates/hud-core/src/testdata/grain/apps/views/grain-explore.jsonnew+272−0
crates/hud-core/src/testdata/grain/apps/views/grain-feed.jsonnew+1647−0
1647 lines changed: not loaded until asked for.
crates/hud-core/src/testdata/grain/apps/views/grain-followers.jsonnew+102−0
crates/hud-core/src/testdata/grain/apps/views/grain-following.jsonnew+102−0
crates/hud-core/src/testdata/grain/apps/views/grain-gallery-view.jsonnew+1007−0
1007 lines changed: not loaded until asked for.
crates/hud-core/src/testdata/grain/apps/views/grain-known-followers.jsonnew+102−0
crates/hud-core/src/testdata/grain/apps/views/grain-mutes.jsonnew+118−0
crates/hud-core/src/testdata/grain/apps/views/grain-notifications.jsonnew+284−0
crates/hud-core/src/testdata/grain/apps/views/grain-search-people.jsonnew+153−0
crates/hud-core/src/testdata/grain/apps/views/grain-search.jsonnew+104−0
crates/hud-core/src/testdata/grain/apps/views/grain-settings.jsonnew+2525−0
A large diff, not shown.
crates/hud-core/src/testdata/grain/apps/views/grain-stories.jsonnew+319−0
crates/hud-core/src/testdata/grain/apps/views/grain-story-archive.jsonnew+212−0
crates/hud-core/src/testdata/grain/apps/grain.social.jsonnew+458−0
458 lines changed: not loaded until asked for.
crates/hud-core/src/testdata/grain/listNotifications.answer.jsonnew+200−0
crates/hud-core/src/testdata/grain/social.grain.authFull.jsonnew+113−0
crates/hud-core/src/ui/check.rs+2−0
crates/hud-core/src/ui/clamp.rsnew+535−0
535 lines changed: not loaded until asked for.
crates/hud-core/src/ui/document.rs+65−4
crates/hud-core/src/ui/head.rsnew+328−0
crates/hud-core/src/ui/map.rsnew+395−0
crates/hud-core/src/ui/marks.rs+38−6
crates/hud-core/src/ui/media.rs+769−11
780 lines changed: not loaded until asked for.
crates/hud-core/src/ui/mod.rs+3585−220
A large diff, not shown.
crates/hud-core/src/cache.rs+278−6
crates/hud-core/src/catalog.rs+715−53
768 lines changed: not loaded until asked for.
crates/hud-core/src/compose.rs+652−89
741 lines changed: not loaded until asked for.
crates/hud-core/src/config.rs+40−2
crates/hud-core/src/feeds.rs+3−0
crates/hud-core/src/identity.rs+35−14
crates/hud-core/src/join.rs+88−7
crates/hud-core/src/lexicon.rs+4−3
crates/hud-core/src/lib.rs+30−13
crates/hud-core/src/net.rs+51−1
crates/hud-core/src/operator.rsnew+2564−0
A large diff, not shown.
crates/hud-core/src/pds.rs+41−0
crates/hud-core/src/places.rs+136−19
crates/hud-core/src/procedures.rs+101−31
crates/hud-core/src/schema.rsnew+552−0
552 lines changed: not loaded until asked for.
crates/hud-core/src/scope.rs+500−38
538 lines changed: not loaded until asked for.
crates/hud-core/src/tools.rs+736−102
838 lines changed: not loaded until asked for.
crates/hud-core/src/view.rs+2674−341
A large diff, not shown.
crates/hud-core/src/writes.rs+1268−61
1329 lines changed: not loaded until asked for.
crates/hud-core/src/xrpc.rs+219−18
crates/hud-core/Cargo.toml+2−0
crates/hud-server/src/web/tests.rsnew+390−0
crates/hud-server/src/xrpc/tests.rs+70−23
crates/hud-server/src/blob.rs+5−2
crates/hud-server/src/lib.rs+77−13
crates/hud-server/src/mcp.rs+120−14
crates/hud-server/src/oauth.rs+46−28
crates/hud-server/src/playground.rs+6−3
crates/hud-server/src/policies.rs+5−2
crates/hud-server/src/telemetry.rs+12−2
crates/hud-server/src/web.rsnew+142−0
crates/hud-server/src/workspace.rs+25−12
crates/hud-server/src/xrpc.rs+18−0
crates/hud-server/Cargo.toml+6−0
docs/_style.md+2−1
docs/app-pages.md+9−5
docs/internals.md+31−3
docs/memory.md+7−3
docs/observability.md+2−2
docs/overview.md+5−4
docs/running.md+9−2
docs/sdk.mdnew+142−0
docs/sign-in.md+47−14
docs/tools.md+10−8
docs/views.md+1419−36
1455 lines changed: not loaded until asked for.
docs/workspace-api.md+2−0
docs/workspace.md+1−1
harness/e2e/pages.mjs+7−1
harness/e2e/permsets.spec.mjsnew+93−0
harness/e2e/setup.mjs+3−0
harness/e2e/world.mjs+6−1
harness/gallery/common.mjs+10−7
harness/gallery/data.mjs+7−4
harness/gallery/entries.mjs+7−6
harness/ssr/data.mjsnew+140−0
harness/answers.mjs+5−1
harness/apps.mjsnew+26−0
harness/gallery.mjs+4−4
harness/lexicons.mjs+17−5
harness/look.mjs+15−10
harness/package-lock.json+54−0
harness/package.json+1−0
harness/pds.mjs+56−2
harness/schemas.mjsnew+84−0
harness/scroll.mjs+2−0
ios/App/GalleryScreen.swift+3−1
ios/App/HUDApp.swift+2−0
ios/App/StepScreen.swift+3−1
ios/HUDKit/Sources/HUDKit/Data/Compose.swift+26−3
ios/HUDKit/Sources/HUDKit/Data/Interactions.swift+1−1
ios/HUDKit/Sources/HUDKit/Data/JSON.swift+27−5
ios/HUDKit/Sources/HUDKit/Data/LastTree.swiftnew+172−0
ios/HUDKit/Sources/HUDKit/Data/Push.swiftnew+294−0
ios/HUDKit/Sources/HUDKit/Data/Result.swift+27−4
ios/HUDKit/Sources/HUDKit/Data/Routes.swiftnew+295−0
ios/HUDKit/Sources/HUDKit/Data/SchemeChoice.swiftnew+16−0
ios/HUDKit/Sources/HUDKit/Data/SignIn.swift+17−51
ios/HUDKit/Sources/HUDKit/Data/SignInPlan.swiftnew+215−0
ios/HUDKit/Sources/HUDKit/Data/Skeleton.swiftnew+250−0
ios/HUDKit/Sources/HUDKit/Data/TabFirst.swiftnew+45−0
ios/HUDKit/Sources/HUDKit/Embed/EmbedCard.swift+3−3
ios/HUDKit/Sources/HUDKit/Embed/EmbedExternal.swift+3−3
ios/HUDKit/Sources/HUDKit/Embed/EmbedVideo.swift+1−1
ios/HUDKit/Sources/HUDKit/Embed/QuoteCard.swift+6−6
ios/HUDKit/Sources/HUDKit/Parts/ActionButton.swift+400−97
497 lines changed: not loaded until asked for.
ios/HUDKit/Sources/HUDKit/Parts/CameraPicker.swiftnew+42−0
ios/HUDKit/Sources/HUDKit/Parts/ComposeFields.swift+382−82
464 lines changed: not loaded until asked for.
ios/HUDKit/Sources/HUDKit/Parts/ComposeForm.swift+109−3
ios/HUDKit/Sources/HUDKit/Parts/ComposeSheet.swift+64−29
ios/HUDKit/Sources/HUDKit/Parts/DoubleTap.swiftnew+109−0
ios/HUDKit/Sources/HUDKit/Parts/FeedContextView.swift+4−4
ios/HUDKit/Sources/HUDKit/Parts/ImageBox.swift+110−25
ios/HUDKit/Sources/HUDKit/Parts/Lightbox.swift+2−2
ios/HUDKit/Sources/HUDKit/Parts/LinkLabel.swift+27−5
ios/HUDKit/Sources/HUDKit/Parts/ListLayout.swift+138−8
ios/HUDKit/Sources/HUDKit/Parts/PhotoBadges.swiftnew+113−0
ios/HUDKit/Sources/HUDKit/Parts/ProfileCard.swift+44−22
ios/HUDKit/Sources/HUDKit/Parts/RowLayout.swift+15−10
ios/HUDKit/Sources/HUDKit/Parts/TextBody.swift+60−12
ios/HUDKit/Sources/HUDKit/Support/Adaptive.swiftnew+53−0
ios/HUDKit/Sources/HUDKit/Support/Controls.swift+10−3
ios/HUDKit/Sources/HUDKit/Support/Format.swift+27−8
ios/HUDKit/Sources/HUDKit/Support/Picture.swift+92−16
ios/HUDKit/Sources/HUDKit/Support/Space.swift+2−1
ios/HUDKit/Sources/HUDKit/Support/Typefaces.swiftnew+189−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedAccounts.swiftnew+118−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedBar.swiftnew+134−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedBlocks.swift+26−39
ios/HUDKit/Sources/HUDKit/Tree/ResolvedChoice.swiftnew+128−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedCompose.swift+200−23
ios/HUDKit/Sources/HUDKit/Tree/ResolvedDiff.swift+4−4
ios/HUDKit/Sources/HUDKit/Tree/ResolvedFaces.swiftnew+194−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedFields.swift+15−15
ios/HUDKit/Sources/HUDKit/Tree/ResolvedList.swift+161−45
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMap.swiftnew+304−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMarks.swift+43−8
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMedia.swift+429−45
474 lines changed: not loaded until asked for.
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMenu.swiftnew+166−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedMessages.swift+7−7
ios/HUDKit/Sources/HUDKit/Tree/ResolvedPanes.swiftnew+325−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedSearch.swiftnew+69−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedSlides.swiftnew+477−0
477 lines changed: not loaded until asked for.
ios/HUDKit/Sources/HUDKit/Tree/ResolvedSplit.swiftnew+107−0
ios/HUDKit/Sources/HUDKit/Tree/ResolvedTabs.swift+82−19
ios/HUDKit/Sources/HUDKit/Tree/ResolvedToggle.swiftnew+85−0
ios/HUDKit/Sources/HUDKit/Tree/SkeletonView.swiftnew+329−0
ios/HUDKit/Sources/HUDKit/Tree/TreeView.swift+329−43
ios/HUDKit/Sources/HUDKit/View/Context.swift+223−12
ios/HUDKit/Sources/HUDKit/View/ResultView.swift+2−2
ios/HUDKit/Sources/HUDKit/Workspace/Theme.swift+3−0
ios/HUDKit/Tests/HUDKitTests/ChoiceTests.swiftnew+29−0
ios/HUDKit/Tests/HUDKitTests/ComposeTests.swift+236−4
ios/HUDKit/Tests/HUDKitTests/HUDKitTests.swift+636−1
637 lines changed: not loaded until asked for.
ios/HUDKit/Tests/HUDKitTests/LastTreeTests.swiftnew+189−0
ios/HUDKit/Tests/HUDKitTests/LayoutTests.swiftnew+101−0
ios/HUDKit/Tests/HUDKitTests/LookTests.swiftnew+147−0
ios/HUDKit/Tests/HUDKitTests/MapTests.swiftnew+57−0
ios/HUDKit/Tests/HUDKitTests/NotificationTests.swiftnew+74−0
ios/HUDKit/Tests/HUDKitTests/PhotoBadgesTests.swiftnew+24−0
ios/HUDKit/Tests/HUDKitTests/PicturesTests.swiftnew+86−0
ios/HUDKit/Tests/HUDKitTests/PinnedFeedsTests.swiftnew+48−0
ios/HUDKit/Tests/HUDKitTests/PlanTests.swiftnew+118−0
ios/HUDKit/Tests/HUDKitTests/PushTests.swiftnew+235−0
ios/HUDKit/Tests/HUDKitTests/SchemeChoiceTests.swiftnew+29−0
ios/HUDKit/Tests/HUDKitTests/SignInPlanTests.swiftnew+125−0
ios/HUDKit/Tests/HUDKitTests/SkeletonTests.swiftnew+159−0
ios/HUDKit/Tests/HUDKitTests/TabFirstTests.swiftnew+79−0
ios/project.yml+2−0
lexicons/com.atproto.moderation.createReport.jsonnew+103−0
lexicons/social.grain.actor.setPreference.jsonnew+45−0
lexicons/social.grain.gallery.getDeletionPlan.jsonnew+72−0
lexicons/social.grain.graph.muteActor.jsonnew+32−0
lexicons/social.grain.graph.unmuteActor.jsonnew+32−0
lexicons/social.grain.notification.registerPush.jsonnew+53−0
lexicons/social.grain.notification.unregisterPush.jsonnew+53−0
lexicons/social.grain.notification.updateSeen.jsonnew+22−0
lexicons/social.grain.server.getAccountDeletionPlan.jsonnew+55−0
lexicons/social.grain.story.markViewed.jsonnew+38−0
lexicons/social.grain.unspecced.deleteGallery.jsonnew+32−0
schemas/json/app.jsonnew+821−0
821 lines changed: not loaded until asked for.
schemas/json/view.jsonnew+3951−0
A large diff, not shown.
schemas/place.hud.frame.jsonnew+103−0
schemas/place.hud.page.jsonnew+17−0
schemas/place.hud.signIn.jsonnew+45−0
schemas/place.hud.tabFirst.jsonnew+26−0
schemas/place.hud.ui.json+312−33
schemas/place.hud.view.json+31−2
scripts/lexicons.mjs+12−6
views/grain-app.jsondeleted+0−152
views/grain-feed.jsondeleted+0−114
views/grain-gallery-view.jsondeleted+0−178
views/grain-notifications.jsondeleted+0−72
web/renderer/src/document/DocumentView.svelte+8−1
web/renderer/src/document/LinkCard.svelte+15−8
web/renderer/src/embed/EmbedCard.svelte+13−6
web/renderer/src/embed/QuoteView.svelte+8−5
web/renderer/src/tree/compose/fields.ts+9−6
web/renderer/src/tree/compose/LineField.svelte+7−5
web/renderer/src/tree/compose/lookup.svelte.ts+39−1
web/renderer/src/tree/compose/photos.ts+39−11
web/renderer/src/tree/compose/PhotosField.svelte+192−17
web/renderer/src/tree/compose/PlaceField.svelte+133−12
web/renderer/src/tree/compose/text.test.tsnew+42−0
web/renderer/src/tree/compose/text.ts+30−1
web/renderer/src/tree/compose/TextField.svelte+21−18
web/renderer/src/tree/Accounts.sveltenew+179−0
web/renderer/src/tree/Action.svelte+203−44
web/renderer/src/tree/ActionButton.svelte+75−2
web/renderer/src/tree/Bar.sveltenew+79−0
web/renderer/src/tree/bar.tsnew+19−0
web/renderer/src/tree/Barred.sveltenew+11−0
web/renderer/src/tree/Blocks.svelte+7−2
web/renderer/src/tree/Choice.sveltenew+170−0
web/renderer/src/tree/Compose.svelte+161−36
web/renderer/src/tree/Composer.svelte+13−7
web/renderer/src/tree/ContentWarning.svelte+8−3
web/renderer/src/tree/context.ts+76−23
web/renderer/src/tree/Covers.svelte+300−8
web/renderer/src/tree/DoubleTaps.sveltenew+13−0
web/renderer/src/tree/Embed.svelte+2−2
web/renderer/src/tree/Faces.sveltenew+274−0
web/renderer/src/tree/FeedContext.svelte+1−4
web/renderer/src/tree/Field.svelte+2−2
web/renderer/src/tree/Gallery.svelte+29−4
web/renderer/src/tree/Icon.svelte+61−5
web/renderer/src/tree/Image.svelte+146−6
web/renderer/src/tree/Link.svelte+175−17
web/renderer/src/tree/List.svelte+370−18
web/renderer/src/tree/Map.sveltenew+205−0
web/renderer/src/tree/Menu.sveltenew+130−0
web/renderer/src/tree/Messages.svelte+6−5
web/renderer/src/tree/Node.svelte+40−3
web/renderer/src/tree/opened.tsnew+36−0
web/renderer/src/tree/PaneBody.sveltenew+14−0
web/renderer/src/tree/Panes.sveltenew+419−0
419 lines changed: not loaded until asked for.
web/renderer/src/tree/Player.svelte+1−1
web/renderer/src/tree/Profile.svelte+1−1
web/renderer/src/tree/RichText.svelte+14−35
web/renderer/src/tree/Row.svelte+31−2
web/renderer/src/tree/Search.sveltenew+79−0
web/renderer/src/tree/Shape.sveltenew+295−0
web/renderer/src/tree/Skeleton.sveltenew+49−0
web/renderer/src/tree/skeleton.tsnew+205−0
web/renderer/src/tree/Slides.sveltenew+464−0
464 lines changed: not loaded until asked for.
web/renderer/src/tree/Split.sveltenew+64−0
web/renderer/src/tree/Stack.svelte+17−3
web/renderer/src/tree/Tabs.svelte+63−10
web/renderer/src/tree/Text.svelte+56−10
web/renderer/src/tree/Time.svelte+10−3
web/renderer/src/tree/Toggle.sveltenew+133−0
web/renderer/src/tree/Tree.svelte+152−5
web/renderer/src/tree/types.ts+201−30
web/renderer/src/view/BadgeView.svelte+4−0
web/renderer/src/view/clock.svelte.tsnew+20−0
web/renderer/src/view/FeedContextView.svelte+12−7
web/renderer/src/view/ProfileView.svelte+18−5
web/renderer/src/view/remember.svelte.ts+6−2
web/renderer/src/view/taps.tsnew+73−0
web/renderer/src/view/ThreadItem.svelte+3−2
web/renderer/src/view/window.ts+24−19
web/renderer/src/AltBadge.sveltenew+57−0
web/renderer/src/Bursts.sveltenew+55−0
web/renderer/src/ClampedText.svelte+2−1
web/renderer/src/CoverCard.svelte+45−15
web/renderer/src/Covers.svelte+38−12
web/renderer/src/CoverTile.svelte+46−15
web/renderer/src/double-tap.svelte.tsnew+35−0
web/renderer/src/FacetText.svelte+2−1
web/renderer/src/FieldLeaf.svelte+10−7
web/renderer/src/format.test.tsnew+26−0
web/renderer/src/format.ts+32−19
web/renderer/src/Gallery.svelte+333−23
web/renderer/src/Glyph.svelte+4−1
web/renderer/src/hero.tsnew+30−0
web/renderer/src/icons.ts+35−2
web/renderer/src/index.ts+7−0
web/renderer/src/InfoBadge.sveltenew+70−0
web/renderer/src/LinkButton.svelte+16−3
web/renderer/src/open.tsnew+39−0
web/renderer/src/PickMark.sveltenew+46−0
web/renderer/src/Picture.svelte+66−5
web/renderer/src/Player.svelte+4−3
web/renderer/src/preload.tsnew+25−0
web/renderer/src/RichRuns.svelte+8−5
web/renderer/src/richtext.ts+3−1
web/renderer/src/slot.tsnew+73−0
web/renderer/src/Stat.svelte+2−1
web/renderer/src/theme.css+6−0
web/renderer/test/trees/explore.jsonnew+556−0
556 lines changed: not loaded until asked for.
web/renderer/test/trees/feed.jsonnew+1023−0
1023 lines changed: not loaded until asked for.
web/renderer/test/trees/gallery.jsonnew+1014−0
1014 lines changed: not loaded until asked for.
web/renderer/test/trees/map.jsonnew+224−0
web/renderer/test/trees/notifications.jsonnew+635−0
635 lines changed: not loaded until asked for.
web/renderer/test/trees/profile.jsonnew+907−0
907 lines changed: not loaded until asked for.
web/renderer/test/trees/stories.jsonnew+396−0
web/renderer/test/trees/story-archive.jsonnew+370−0
web/renderer/test/client.tsnew+7−0
web/renderer/test/server.tsnew+6−0
web/renderer/test/ssr.mjsnew+638−0
638 lines changed: not loaded until asked for.
web/renderer/package.json+29−9
web/shell/src/accounts.test.tsnew+101−0
web/shell/src/accounts.tsnew+78−0
web/shell/src/app.tsnew+164−0
web/shell/src/back.test.tsnew+39−0
web/shell/src/back.tsnew+36−0
web/shell/src/client.tsnew+105−0
web/shell/src/frame.test.tsnew+55−0
web/shell/src/frame.tsnew+161−0
web/shell/src/Head.sveltenew+56−0
web/shell/src/head.tsnew+76−0
web/shell/src/index.tsnew+19−0
web/shell/src/oauth.tsnew+274−0
web/shell/src/Pager.sveltenew+599−0
599 lines changed: not loaded until asked for.
web/shell/src/prefetch.tsnew+129−0
web/shell/src/recent.test.tsnew+103−0
web/shell/src/recent.tsnew+106−0
web/shell/src/routes.test.tsnew+51−0
web/shell/src/routes.tsnew+261−0
web/shell/src/screen.tsnew+49−0
web/shell/src/seal.tsnew+70−0
web/shell/src/SearchFlyout.sveltenew+314−0
web/shell/src/server.tsnew+214−0
web/shell/src/session.tsnew+450−0
450 lines changed: not loaded until asked for.
web/shell/src/Sheet.sveltenew+258−0
web/shell/src/shell.cssnew+71−0
web/shell/src/Shell.sveltenew+1015−0
1015 lines changed: not loaded until asked for.
web/shell/src/SignIn.sveltenew+393−0
web/shell/src/Stack.sveltenew+957−0
957 lines changed: not loaded until asked for.
web/shell/src/theme.tsnew+99−0
web/shell/src/typeahead.test.tsnew+87−0
web/shell/src/typeahead.tsnew+81−0
web/shell/test/client.tsnew+8−0
web/shell/test/history.svelte.tsnew+47−0
web/shell/test/server.tsnew+10−0
web/shell/test/ssr.mjsnew+1099−0
1099 lines changed: not loaded until asked for.