Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed71b02b01 | ||
|
|
a90dc85466 | ||
|
|
67a60143cb | ||
|
|
99ac20de35 | ||
|
|
8d4f324717 | ||
|
|
c9ee5348bf | ||
|
|
ee2a7840a2 | ||
|
|
52dd399565 | ||
|
|
86a0421163 | ||
|
|
0e191f946d | ||
|
|
065912f2bf | ||
|
|
075138433e | ||
|
|
92e65bbfc2 | ||
|
|
7ccd4ac4c9 | ||
|
|
5739e17750 | ||
|
|
037f4e91c8 | ||
|
|
685c3c5a24 | ||
|
|
6dc18abc4d | ||
|
|
ee43a87cec | ||
|
|
ce961b81d9 | ||
|
|
c7b392b26f | ||
|
|
0a04efbbcf | ||
|
|
11977dad56 | ||
|
|
c8fea9c061 | ||
|
|
b0a8909dc7 | ||
|
|
57c236e7da | ||
|
|
8156a821eb | ||
|
|
b015acb063 | ||
|
|
e6368dada8 | ||
|
|
e55662e0e1 | ||
|
|
051844bc14 | ||
|
|
1e5ce986be | ||
|
|
06b24631e3 | ||
|
|
2d2e54ba79 | ||
|
|
ee59149b41 | ||
|
|
23a6231b20 | ||
|
|
a4fac4550a | ||
|
|
88ab48cfc0 | ||
|
|
7c03f8554f | ||
|
|
367e5d271c | ||
|
|
47a395ab76 | ||
|
|
e7cbed3c8f | ||
|
|
2f7bd843bc | ||
|
|
d1527d47e4 | ||
|
|
bc0853360a | ||
|
|
b72ab5aef2 | ||
|
|
40fcb80a7d | ||
|
|
ff64548085 | ||
|
|
35362b8895 | ||
|
|
ff7ca89b90 | ||
|
|
042f02b852 |
@@ -4,6 +4,7 @@ function classifyCiPaths(paths) {
|
||||
const forceAll = paths.some((path) => [
|
||||
'.github/workflows/ci-required.yml',
|
||||
'.github/workflows/release-backmerge.yml',
|
||||
'.github/workflows/approve-release-train.yml',
|
||||
'.github/scripts/classify-ci-paths.cjs',
|
||||
'.github/scripts/classify-ci-paths.test.cjs',
|
||||
'scripts/plan_release_backmerge.py',
|
||||
@@ -18,10 +19,12 @@ function classifyCiPaths(paths) {
|
||||
'scripts/check-android-locales.py', 'scripts/android-locale-harness.py',
|
||||
'scripts/check-android-collection-apis.py', 'scripts/check-android-native-compat.py',
|
||||
'scripts/check-android-release-notes.py',
|
||||
'scripts/android_release_artifacts.py',
|
||||
'scripts/android-lane.ps1', 'scripts/android-prepush.py', 'scripts/dev.bat', 'scripts/dev.sh',
|
||||
'scripts/tests/android_prepush_test.py',
|
||||
'scripts/tests/check_android_native_compat_test.py',
|
||||
'scripts/tests/check_android_release_notes_test.py',
|
||||
'scripts/tests/android_release_artifacts_test.py',
|
||||
'.github/workflows/android-on-demand.yml', '.github/workflows/ci-android.yml',
|
||||
'.github/workflows/play-preflight-android.yml',
|
||||
'.github/workflows/approve-release-android.yml',
|
||||
@@ -29,12 +32,16 @@ function classifyCiPaths(paths) {
|
||||
]),
|
||||
desktop: forceAll || under(['desktop/']) || exact([
|
||||
'.github/workflows/ci-desktop.yml',
|
||||
'.github/workflows/approve-release-extensions.yml',
|
||||
'.github/workflows/release-cli.yml',
|
||||
]),
|
||||
plugin: forceAll || paths.some((path) => /^plugin\/[^/]+\.py$/.test(path)) ||
|
||||
under(['plugin/relay/', 'plugin/tools/', 'plugin/tests/', 'relay_server/', 'hermes_relay_bootstrap/']) || exact([
|
||||
'plugin/plugin.yaml', 'pyproject.toml', 'scripts/check-plugin-version-sync.py',
|
||||
'scripts/check-server-version-sync.py', 'scripts/bump-plugin-version.sh',
|
||||
'scripts/bump-server-version.sh', '.github/workflows/ci-plugin.yml',
|
||||
'.github/workflows/approve-release-extensions.yml',
|
||||
'.github/workflows/release-plugin.yml',
|
||||
]),
|
||||
dashboard: forceAll || under(['plugin/dashboard/']) || exact([
|
||||
'.github/workflows/ci-dashboard.yml',
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { join } = require('node:path');
|
||||
const { classifyCiPaths } = require('./classify-ci-paths.cjs');
|
||||
|
||||
const none = {
|
||||
@@ -17,6 +19,8 @@ assert.deepEqual(classifyCiPaths(['desktop/src/cli.ts']), { ...none, desktop: tr
|
||||
assert.deepEqual(classifyCiPaths(['relay-core/src/main/kotlin/Wire.kt']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/check-android-release-notes.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/check-android-native-compat.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/android_release_artifacts.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/tests/android_release_artifacts_test.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/tests/check_android_native_compat_test.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/android-lane.ps1']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/android-prepush.py']), { ...none, android: true });
|
||||
@@ -24,6 +28,13 @@ assert.deepEqual(classifyCiPaths(['scripts/dev.bat']), { ...none, android: true
|
||||
assert.deepEqual(classifyCiPaths(['scripts/dev.sh']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['scripts/tests/android_prepush_test.py']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['.github/workflows/android-on-demand.yml']), { ...none, android: true });
|
||||
assert.deepEqual(classifyCiPaths(['.github/workflows/approve-release-extensions.yml']), {
|
||||
...none,
|
||||
desktop: true,
|
||||
plugin: true,
|
||||
});
|
||||
assert.deepEqual(classifyCiPaths(['.github/workflows/release-cli.yml']), { ...none, desktop: true });
|
||||
assert.deepEqual(classifyCiPaths(['.github/workflows/release-plugin.yml']), { ...none, plugin: true });
|
||||
assert.deepEqual(classifyCiPaths(['plugin/relay/server.py']), { ...none, plugin: true });
|
||||
assert.deepEqual(classifyCiPaths(['plugin/dashboard/src/App.tsx']), { ...none, dashboard: true });
|
||||
assert.deepEqual(classifyCiPaths(['user-docs/index.md']), { ...none, docs: true });
|
||||
@@ -47,5 +58,73 @@ assert.deepEqual(classifyCiPaths(['.github/workflows/release-backmerge.yml']), {
|
||||
contract: true,
|
||||
docs: true,
|
||||
});
|
||||
assert.deepEqual(classifyCiPaths(['.github/workflows/approve-release-train.yml']), {
|
||||
android: true,
|
||||
desktop: true,
|
||||
plugin: true,
|
||||
dashboard: true,
|
||||
contract: true,
|
||||
docs: true,
|
||||
});
|
||||
|
||||
const repoRoot = join(__dirname, '..', '..');
|
||||
const approvalWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'approve-release-extensions.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const cliReleaseWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'release-cli.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const pluginReleaseWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'release-plugin.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const desktopCiWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'ci-desktop.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const androidPreflightWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'play-preflight-android.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const androidApprovalWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'approve-release-android.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const androidReleaseWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'release-android.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const requiredChecksWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'ci-required.yml'),
|
||||
'utf8',
|
||||
);
|
||||
const releaseTrainWorkflow = readFileSync(
|
||||
join(repoRoot, '.github', 'workflows', 'approve-release-train.yml'),
|
||||
'utf8',
|
||||
);
|
||||
|
||||
assert.match(approvalWorkflow, /permissions:\r?\n contents: read/);
|
||||
assert.match(
|
||||
approvalWorkflow,
|
||||
/approve:[\s\S]*?permissions:\r?\n actions: write\r?\n contents: write/,
|
||||
);
|
||||
assert.match(
|
||||
approvalWorkflow,
|
||||
/ref: \$\{\{ contains\(inputs\.version, '-'\) && 'dev' \|\| 'main' \}\}/,
|
||||
);
|
||||
assert.match(cliReleaseWorkflow, /workflow_dispatch:[\s\S]*?Approved CLI\+UI version/);
|
||||
assert.match(cliReleaseWorkflow, /name: Restore exact-source tray build cache[\s\S]*?actions\/cache@v5/);
|
||||
assert.match(desktopCiWorkflow, /name: Restore exact-source tray build cache[\s\S]*?actions\/cache@v5/);
|
||||
assert.match(pluginReleaseWorkflow, /workflow_dispatch:[\s\S]*?Approved Plugin version/);
|
||||
assert.match(androidPreflightWorkflow, /Package immutable preflight artifacts/);
|
||||
assert.match(androidApprovalWorkflow, /Android public approval accepts stable SemVer only/);
|
||||
assert.match(androidReleaseWorkflow, /Download exact stable preflight artifacts/);
|
||||
assert.match(androidReleaseWorkflow, /artifact-ids: \$\{\{ needs\.validate\.outputs\.preflight_artifact_id \}\}/);
|
||||
assert.match(requiredChecksWorkflow, /name: Reuse exact-tree required checks/);
|
||||
assert.match(requiredChecksWorkflow, /name: required-checks-\$\{\{ needs\.changes\.outputs\.tree \}\}/);
|
||||
assert.match(releaseTrainWorkflow, /name: Hermes-Relay Coordinated Release Approval/);
|
||||
assert.match(releaseTrainWorkflow, /Coordinated Android approval is stable-only/);
|
||||
|
||||
console.log('CI path classification tests passed.');
|
||||
|
||||
@@ -40,6 +40,10 @@ jobs:
|
||||
echo "::error::Hermes-Relay Android Release Approval must run from main, not $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! "$REQUESTED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::error::Android public approval accepts stable SemVer only: $REQUESTED_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
TOML_VERSION=$(grep -oP 'appVersionName\s*=\s*"\K[^"]+' gradle/libs.versions.toml)
|
||||
if [ "$REQUESTED_VERSION" != "$TOML_VERSION" ]; then
|
||||
echo "::error::Requested version $REQUESTED_VERSION does not match appVersionName $TOML_VERSION"
|
||||
@@ -56,13 +60,21 @@ jobs:
|
||||
RELEASE_TREE: ${{ steps.metadata.outputs.tree }}
|
||||
run: |
|
||||
ARTIFACT_NAME="play-preflight-${VERSION}-${RELEASE_TREE}"
|
||||
COUNT=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/artifacts?name=${ARTIFACT_NAME}" \
|
||||
--jq '[.artifacts[] | select(.expired == false)] | length')
|
||||
if [ "$COUNT" -lt 1 ]; then
|
||||
ARTIFACT=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/artifacts?name=${ARTIFACT_NAME}" \
|
||||
--jq '[.artifacts[] | select(.expired == false)] | sort_by(.created_at) | last')
|
||||
RUN_ID=$(jq -r '.workflow_run.id // empty' <<<"$ARTIFACT")
|
||||
if [ -z "$RUN_ID" ]; then
|
||||
echo "::error::No successful Play preflight found for version $VERSION with tree $RELEASE_TREE"
|
||||
exit 1
|
||||
fi
|
||||
echo "Verified Play preflight proof: $ARTIFACT_NAME"
|
||||
RUN=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}")
|
||||
CONCLUSION=$(jq -r '.conclusion' <<<"$RUN")
|
||||
WORKFLOW_PATH=$(jq -r '.path' <<<"$RUN")
|
||||
if [ "$WORKFLOW_PATH" != ".github/workflows/play-preflight-android.yml" ] || [ "$CONCLUSION" != "success" ]; then
|
||||
echo "::error::Preflight artifact came from ${WORKFLOW_PATH} with conclusion ${CONCLUSION}"
|
||||
exit 1
|
||||
fi
|
||||
echo "Verified immutable Play preflight artifacts: $ARTIFACT_NAME (run $RUN_ID)"
|
||||
|
||||
- name: Ensure release tag does not already exist
|
||||
env:
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
name: Hermes-Relay Plugin and CLI+UI Release Approval
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
surface:
|
||||
description: "Release surface"
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- plugin
|
||||
- desktop
|
||||
version:
|
||||
description: "Approved version (for example 1.11.2 or 0.4.0-beta.7)"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: approve-${{ inputs.surface }}-release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate release source and metadata
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
source_branch: ${{ steps.metadata.outputs.source_branch }}
|
||||
source_sha: ${{ steps.metadata.outputs.source_sha }}
|
||||
tag: ${{ steps.metadata.outputs.tag }}
|
||||
workflow: ${{ steps.metadata.outputs.workflow }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ contains(inputs.version, '-') && 'dev' || 'main' }}
|
||||
|
||||
- name: Validate approval request
|
||||
id: metadata
|
||||
env:
|
||||
REQUESTED_SURFACE: ${{ inputs.surface }}
|
||||
REQUESTED_VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [[ ! "$REQUESTED_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
|
||||
echo "::error::Version must be SemVer with an optional prerelease suffix: $REQUESTED_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$REQUESTED_VERSION" == *-* ]]; then
|
||||
source_branch="dev"
|
||||
else
|
||||
source_branch="main"
|
||||
fi
|
||||
if [ "$GITHUB_REF" != "refs/heads/main" ]; then
|
||||
echo "::error::Release approval must run from the trusted main workflow definition, not $GITHUB_REF"
|
||||
exit 1
|
||||
fi
|
||||
git fetch origin "$source_branch" --no-tags
|
||||
source_sha="$(git rev-parse HEAD)"
|
||||
expected_sha="$(git rev-parse FETCH_HEAD)"
|
||||
if [ "$source_sha" != "$expected_sha" ]; then
|
||||
echo "::error::Checked out $source_sha, but origin/$source_branch is $expected_sha"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$REQUESTED_SURFACE" in
|
||||
plugin)
|
||||
tag="server-v${REQUESTED_VERSION}"
|
||||
workflow="release-plugin.yml"
|
||||
python3 scripts/check-plugin-version-sync.py --expect "$REQUESTED_VERSION"
|
||||
if ! grep -Eq "^## \[Plugin ${REQUESTED_VERSION}\]" CHANGELOG.md; then
|
||||
echo "::error::CHANGELOG.md has no Plugin release heading for $REQUESTED_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
desktop)
|
||||
tag="desktop-v${REQUESTED_VERSION}"
|
||||
workflow="release-cli.yml"
|
||||
node desktop/scripts/cli-version-sync.mjs --expect "$REQUESTED_VERSION"
|
||||
if ! grep -Fq "## [$REQUESTED_VERSION]" CHANGELOG.md; then
|
||||
echo "::error::CHANGELOG.md has no CLI+UI release heading for $REQUESTED_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "::error::Unsupported release surface: $REQUESTED_SURFACE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
echo "workflow=$workflow" >> "$GITHUB_OUTPUT"
|
||||
echo "source_branch=$source_branch" >> "$GITHUB_OUTPUT"
|
||||
echo "source_sha=$source_sha" >> "$GITHUB_OUTPUT"
|
||||
|
||||
approve:
|
||||
name: Create release tag and start publication
|
||||
needs: validate
|
||||
permissions:
|
||||
actions: write
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Verify release source has not moved
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
SOURCE_BRANCH: ${{ needs.validate.outputs.source_branch }}
|
||||
SOURCE_SHA: ${{ needs.validate.outputs.source_sha }}
|
||||
run: |
|
||||
current_sha=$(gh api "/repos/${GITHUB_REPOSITORY}/git/ref/heads/${SOURCE_BRANCH}" --jq .object.sha)
|
||||
if [ "$current_sha" != "$SOURCE_SHA" ]; then
|
||||
echo "::error::$SOURCE_BRANCH moved from $SOURCE_SHA to $current_sha; run approval again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Ensure release tag does not already exist
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ needs.validate.outputs.tag }}
|
||||
run: |
|
||||
if gh api "/repos/${GITHUB_REPOSITORY}/git/ref/tags/${RELEASE_TAG}" >/dev/null 2>&1; then
|
||||
echo "::error::Tag $RELEASE_TAG already exists"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create approved release tag
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_TAG: ${{ needs.validate.outputs.tag }}
|
||||
RELEASE_SHA: ${{ needs.validate.outputs.source_sha }}
|
||||
run: |
|
||||
gh api --method POST "/repos/${GITHUB_REPOSITORY}/git/refs" \
|
||||
-f ref="refs/tags/${RELEASE_TAG}" \
|
||||
-f sha="$RELEASE_SHA"
|
||||
|
||||
- name: Start the immutable tag release workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
RELEASE_WORKFLOW: ${{ needs.validate.outputs.workflow }}
|
||||
RELEASE_VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
# A tag created by GITHUB_TOKEN does not recursively start workflows.
|
||||
# Dispatch the trusted definition from main; release jobs check out
|
||||
# and validate the immutable tag created above.
|
||||
gh workflow run "$RELEASE_WORKFLOW" \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--ref main \
|
||||
-f version="$RELEASE_VERSION"
|
||||
|
||||
- name: Approval summary
|
||||
run: |
|
||||
echo "## Release approved" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Created \`${{ needs.validate.outputs.tag }}\` from \`${{ needs.validate.outputs.source_branch }}\` at \`${{ needs.validate.outputs.source_sha }}\`." >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "Dispatched \`${{ needs.validate.outputs.workflow }}\` to validate and publish that immutable tag." >> "$GITHUB_STEP_SUMMARY"
|
||||
@@ -0,0 +1,120 @@
|
||||
name: Hermes-Relay Coordinated Release Approval
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
android:
|
||||
description: "Approve Hermes-Relay Android"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
android_version:
|
||||
description: "Android version when selected"
|
||||
required: false
|
||||
type: string
|
||||
plugin:
|
||||
description: "Approve Hermes-Relay Plugin"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
plugin_version:
|
||||
description: "Plugin version when selected"
|
||||
required: false
|
||||
type: string
|
||||
desktop:
|
||||
description: "Approve Hermes-Relay CLI+UI"
|
||||
required: true
|
||||
default: false
|
||||
type: boolean
|
||||
desktop_version:
|
||||
description: "CLI+UI version when selected"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
actions: write
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: approve-coordinated-release
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
name: Validate selected release surfaces
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Require versions for every selected surface
|
||||
env:
|
||||
ANDROID: ${{ inputs.android }}
|
||||
ANDROID_VERSION: ${{ inputs.android_version }}
|
||||
PLUGIN: ${{ inputs.plugin }}
|
||||
PLUGIN_VERSION: ${{ inputs.plugin_version }}
|
||||
DESKTOP: ${{ inputs.desktop }}
|
||||
DESKTOP_VERSION: ${{ inputs.desktop_version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ "$ANDROID" != "true" ] && [ "$PLUGIN" != "true" ] && [ "$DESKTOP" != "true" ]; then
|
||||
echo "::error::Select at least one release surface"
|
||||
exit 1
|
||||
fi
|
||||
for pair in \
|
||||
"$ANDROID:$ANDROID_VERSION:Android" \
|
||||
"$PLUGIN:$PLUGIN_VERSION:Plugin" \
|
||||
"$DESKTOP:$DESKTOP_VERSION:CLI+UI"; do
|
||||
IFS=: read -r selected version label <<<"$pair"
|
||||
if [ "$selected" = "true" ] && [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
|
||||
echo "::error::$label requires a valid SemVer version"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if [ "$ANDROID" = "true" ] && [[ "$ANDROID_VERSION" == *-* ]]; then
|
||||
echo "::error::Coordinated Android approval is stable-only; use a dev candidate tag for prereleases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
android:
|
||||
name: Approve Hermes-Relay Android
|
||||
needs: validate
|
||||
if: inputs.android
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Dispatch Android approval
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.android_version }}
|
||||
run: gh workflow run approve-release-android.yml --repo "$GITHUB_REPOSITORY" --ref main -f version="$VERSION"
|
||||
|
||||
plugin:
|
||||
name: Approve Hermes-Relay Plugin
|
||||
needs: validate
|
||||
if: inputs.plugin
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Dispatch Plugin approval
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.plugin_version }}
|
||||
run: |
|
||||
gh workflow run approve-release-extensions.yml \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--ref main \
|
||||
-f surface=plugin \
|
||||
-f version="$VERSION"
|
||||
|
||||
desktop:
|
||||
name: Approve Hermes-Relay CLI+UI
|
||||
needs: validate
|
||||
if: inputs.desktop
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Dispatch CLI+UI approval
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ inputs.desktop_version }}
|
||||
run: |
|
||||
gh workflow run approve-release-extensions.yml \
|
||||
--repo "$GITHUB_REPOSITORY" \
|
||||
--ref main \
|
||||
-f surface=desktop \
|
||||
-f version="$VERSION"
|
||||
@@ -107,6 +107,18 @@ jobs:
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Restore exact-source tray build cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
desktop/tray/target
|
||||
key: ${{ runner.os }}-tray-rust-${{ hashFiles('desktop/tray/Cargo.lock') }}-${{ hashFiles('desktop/tray/Cargo.toml', 'desktop/tray/build.rs', 'desktop/tray/src/**/*.rs') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-tray-rust-${{ hashFiles('desktop/tray/Cargo.lock') }}-
|
||||
|
||||
- name: Install deps
|
||||
run: npm ci && npm --prefix tray ci
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ on:
|
||||
- all-final
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
@@ -52,6 +53,8 @@ jobs:
|
||||
dashboard: ${{ steps.filter.outputs.dashboard }}
|
||||
contract: ${{ steps.filter.outputs.contract }}
|
||||
docs: ${{ steps.filter.outputs.docs }}
|
||||
release_pr: ${{ steps.release.outputs.release_pr }}
|
||||
tree: ${{ steps.tree.outputs.tree }}
|
||||
steps:
|
||||
- name: Checkout pull request merge
|
||||
if: github.event_name == 'pull_request'
|
||||
@@ -69,6 +72,26 @@ jobs:
|
||||
- name: Test path classifier
|
||||
run: node .github/scripts/classify-ci-paths.test.cjs
|
||||
|
||||
- name: Record checked tree
|
||||
id: tree
|
||||
run: echo "tree=$(git rev-parse 'HEAD^{tree}')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Detect canonical release promotion
|
||||
id: release
|
||||
env:
|
||||
BASE_REF: ${{ github.base_ref }}
|
||||
HEAD_REF: ${{ github.head_ref }}
|
||||
HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
run: |
|
||||
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] && \
|
||||
[ "$BASE_REF" = "main" ] && \
|
||||
[ "$HEAD_REF" = "dev" ] && \
|
||||
[ "$HEAD_REPOSITORY" = "$GITHUB_REPOSITORY" ]; then
|
||||
echo "release_pr=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "release_pr=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Classify changed files
|
||||
id: filter
|
||||
uses: actions/github-script@v8
|
||||
@@ -123,43 +146,117 @@ jobs:
|
||||
core.notice(`Changed paths: ${paths.join(', ')}`);
|
||||
core.notice(`Selected checks: ${Object.entries(outputs).filter(([, value]) => value).map(([key]) => key).join(', ') || 'none'}`);
|
||||
|
||||
android:
|
||||
release-proof:
|
||||
name: Reuse exact-tree required checks
|
||||
needs: changes
|
||||
if: needs.changes.outputs.android == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
if: needs.changes.outputs.release_pr == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
reuse: ${{ steps.proof.outputs.reuse }}
|
||||
artifact_id: ${{ steps.proof.outputs.artifact_id }}
|
||||
run_id: ${{ steps.proof.outputs.run_id }}
|
||||
tree: ${{ steps.proof.outputs.tree }}
|
||||
steps:
|
||||
- name: Checkout simulated release merge
|
||||
uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Locate exact-tree proof
|
||||
id: proof
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
DEV_SHA: ${{ github.event.pull_request.head.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
merge_tree=$(git rev-parse 'HEAD^{tree}')
|
||||
dev_tree=$(git rev-parse "${DEV_SHA}^{tree}")
|
||||
echo "reuse=false" >> "$GITHUB_OUTPUT"
|
||||
echo "tree=$dev_tree" >> "$GITHUB_OUTPUT"
|
||||
if [ "$merge_tree" != "$dev_tree" ]; then
|
||||
echo "Release merge changes the dev tree ($dev_tree -> $merge_tree); running full CI."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
artifact_name="required-checks-${dev_tree}"
|
||||
artifact=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/artifacts?name=${artifact_name}" \
|
||||
--jq '[.artifacts[] | select(.expired == false)] | sort_by(.created_at) | last')
|
||||
artifact_id=$(jq -r '.id // empty' <<<"$artifact")
|
||||
run_id=$(jq -r '.workflow_run.id // empty' <<<"$artifact")
|
||||
if [ -z "$artifact_id" ] || [ -z "$run_id" ]; then
|
||||
echo "No reusable proof exists for tree $dev_tree; running full CI."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${run_id}")
|
||||
conclusion=$(jq -r '.conclusion' <<<"$run")
|
||||
workflow_path=$(jq -r '.path' <<<"$run")
|
||||
if [ "$workflow_path" != ".github/workflows/ci-required.yml" ] || [ "$conclusion" != "success" ]; then
|
||||
echo "::error::Required-check proof came from ${workflow_path} with conclusion ${conclusion}"
|
||||
exit 1
|
||||
fi
|
||||
echo "artifact_id=$artifact_id" >> "$GITHUB_OUTPUT"
|
||||
echo "run_id=$run_id" >> "$GITHUB_OUTPUT"
|
||||
echo "reuse=true" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Download exact-tree proof
|
||||
if: steps.proof.outputs.reuse == 'true'
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
artifact-ids: ${{ steps.proof.outputs.artifact_id }}
|
||||
github-token: ${{ github.token }}
|
||||
repository: ${{ github.repository }}
|
||||
run-id: ${{ steps.proof.outputs.run_id }}
|
||||
path: required-check-proof
|
||||
|
||||
- name: Verify exact-tree proof
|
||||
if: steps.proof.outputs.reuse == 'true'
|
||||
env:
|
||||
EXPECTED_TREE: ${{ steps.proof.outputs.tree }}
|
||||
run: |
|
||||
jq -e \
|
||||
--arg repository "$GITHUB_REPOSITORY" \
|
||||
--arg tree "$EXPECTED_TREE" \
|
||||
'.schemaVersion == 1 and .repository == $repository and .tree == $tree' \
|
||||
required-check-proof/required-checks.json
|
||||
|
||||
android:
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.android == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
uses: ./.github/workflows/ci-android.yml
|
||||
|
||||
android_on_demand:
|
||||
needs: changes
|
||||
if: github.event_name == 'workflow_dispatch' && inputs.android_preset != 'auto'
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.release-proof.outputs.reuse != 'true' && github.event_name == 'workflow_dispatch' && inputs.android_preset != 'auto' }}
|
||||
uses: ./.github/workflows/android-on-demand.yml
|
||||
with:
|
||||
head_sha: ${{ inputs.head_sha }}
|
||||
preset: ${{ inputs.android_preset }}
|
||||
|
||||
desktop:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.desktop == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.desktop == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
uses: ./.github/workflows/ci-desktop.yml
|
||||
|
||||
plugin:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.plugin == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.plugin == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
uses: ./.github/workflows/ci-plugin.yml
|
||||
|
||||
dashboard:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.dashboard == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.dashboard == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
uses: ./.github/workflows/ci-dashboard.yml
|
||||
|
||||
contract:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.contract == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.contract == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
uses: ./.github/workflows/ci-contract.yml
|
||||
|
||||
docs:
|
||||
name: Build public docs
|
||||
needs: changes
|
||||
if: needs.changes.outputs.docs == 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto')
|
||||
needs: [changes, release-proof]
|
||||
if: ${{ always() && needs.changes.result == 'success' && needs.changes.outputs.docs == 'true' && needs.release-proof.outputs.reuse != 'true' && (github.event_name != 'workflow_dispatch' || inputs.android_preset == 'auto') }}
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
@@ -181,10 +278,12 @@ jobs:
|
||||
guard:
|
||||
name: Required checks
|
||||
if: always()
|
||||
needs: [changes, android, android_on_demand, desktop, plugin, dashboard, contract, docs]
|
||||
needs: [changes, release-proof, android, android_on_demand, desktop, plugin, dashboard, contract, docs]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CHANGES_RESULT: ${{ needs.changes.result }}
|
||||
RELEASE_PROOF_RESULT: ${{ needs.release-proof.result }}
|
||||
REUSED_REQUIRED_CHECKS: ${{ needs.release-proof.outputs.reuse }}
|
||||
ANDROID_RESULT: ${{ needs.android.result }}
|
||||
ANDROID_ON_DEMAND_RESULT: ${{ needs.android_on_demand.result }}
|
||||
DESKTOP_RESULT: ${{ needs.desktop.result }}
|
||||
@@ -197,7 +296,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
failed=0
|
||||
for check in CHANGES ANDROID ANDROID_ON_DEMAND DESKTOP PLUGIN DASHBOARD CONTRACT DOCS; do
|
||||
for check in CHANGES RELEASE_PROOF ANDROID ANDROID_ON_DEMAND DESKTOP PLUGIN DASHBOARD CONTRACT DOCS; do
|
||||
result_var="${check}_RESULT"
|
||||
result="${!result_var}"
|
||||
echo "$check: $result"
|
||||
@@ -207,3 +306,26 @@ jobs:
|
||||
esac
|
||||
done
|
||||
exit "$failed"
|
||||
|
||||
- name: Write exact-tree proof
|
||||
if: ${{ needs.release-proof.outputs.reuse != 'true' }}
|
||||
env:
|
||||
CHECKED_TREE: ${{ needs.changes.outputs.tree }}
|
||||
run: |
|
||||
mkdir -p required-check-proof
|
||||
jq -n \
|
||||
--arg repository "$GITHUB_REPOSITORY" \
|
||||
--arg tree "$CHECKED_TREE" \
|
||||
--arg commit "$GITHUB_SHA" \
|
||||
--arg run_id "$GITHUB_RUN_ID" \
|
||||
'{schemaVersion: 1, repository: $repository, tree: $tree, commit: $commit, runId: $run_id}' \
|
||||
> required-check-proof/required-checks.json
|
||||
|
||||
- name: Upload exact-tree proof
|
||||
if: ${{ needs.release-proof.outputs.reuse != 'true' }}
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: required-checks-${{ needs.changes.outputs.tree }}
|
||||
path: required-check-proof/required-checks.json
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
#
|
||||
# Run manually from the final dev or untagged main tree before creating
|
||||
# android-v*. The job
|
||||
# builds the same signed release artifacts, scans final DEX, and uploads the
|
||||
# Google Play bundle as a production DRAFT. A successful upload is the automated
|
||||
# Play gate while no public GitHub Release or sideload APK exists. Console-only
|
||||
# pre-review and pre-launch reports are informational and do not block release.
|
||||
# builds the signed release artifacts once, scans the final packages, and uploads
|
||||
# the Google Play bundle as a production DRAFT. The exact signed APK/AAB,
|
||||
# mappings, manifest, and checksums remain private Actions artifacts until
|
||||
# approval publishes those same bytes. Console-only pre-review and pre-launch
|
||||
# reports are informational and do not block release.
|
||||
|
||||
name: Hermes-Relay Android Play Preflight
|
||||
|
||||
@@ -98,7 +99,12 @@ jobs:
|
||||
HERMES_KEYSTORE_PASSWORD: ${{ secrets.HERMES_KEYSTORE_PASSWORD }}
|
||||
HERMES_KEY_ALIAS: ${{ secrets.HERMES_KEY_ALIAS }}
|
||||
HERMES_KEY_PASSWORD: ${{ secrets.HERMES_KEY_PASSWORD }}
|
||||
run: ./gradlew bundleRelease assembleRelease --console=plain
|
||||
run: |
|
||||
./gradlew \
|
||||
:app:bundleGooglePlayRelease \
|
||||
:app:assembleGooglePlayRelease \
|
||||
:app:assembleSideloadRelease \
|
||||
--console=plain
|
||||
|
||||
- name: Scan final release DEX
|
||||
run: |
|
||||
@@ -106,6 +112,12 @@ jobs:
|
||||
--apk app/build/outputs/apk/googlePlay/release/*.apk \
|
||||
--apk app/build/outputs/apk/sideload/release/*.apk
|
||||
|
||||
- name: Verify packaged native compatibility
|
||||
run: |
|
||||
python3 scripts/check-android-native-compat.py \
|
||||
app/build/outputs/apk/googlePlay/release/*.apk \
|
||||
app/build/outputs/apk/sideload/release/*.apk
|
||||
|
||||
- name: Upload private production draft to Play
|
||||
env:
|
||||
PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
|
||||
@@ -121,27 +133,27 @@ jobs:
|
||||
--resolution-strategy=ignore \
|
||||
--release-name="Hermes-Relay Android v${{ steps.metadata.outputs.version }}"
|
||||
|
||||
- name: Record successful preflight for the exact commit
|
||||
- name: Package immutable preflight artifacts
|
||||
run: |
|
||||
mkdir -p app/build/reports
|
||||
cat > app/build/reports/play-preflight.json <<EOF
|
||||
{
|
||||
"version": "${{ steps.metadata.outputs.version }}",
|
||||
"versionCode": "${{ steps.metadata.outputs.version_code }}",
|
||||
"commit": "$GITHUB_SHA",
|
||||
"tree": "${{ steps.metadata.outputs.tree }}",
|
||||
"track": "production",
|
||||
"status": "draft"
|
||||
}
|
||||
EOF
|
||||
python3 scripts/android_release_artifacts.py package \
|
||||
--version "${{ steps.metadata.outputs.version }}" \
|
||||
--version-code "${{ steps.metadata.outputs.version_code }}" \
|
||||
--commit "$GITHUB_SHA" \
|
||||
--tree "${{ steps.metadata.outputs.tree }}" \
|
||||
--sideload-apk app/build/outputs/apk/sideload/release/*.apk \
|
||||
--google-play-aab app/build/outputs/bundle/googlePlayRelease/*.aab \
|
||||
--sideload-mapping app/build/outputs/mapping/sideloadRelease/mapping.txt \
|
||||
--google-play-mapping app/build/outputs/mapping/googlePlayRelease/mapping.txt \
|
||||
--output app/build/preflight-artifacts
|
||||
|
||||
- name: Upload preflight proof
|
||||
- name: Upload immutable preflight artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: play-preflight-${{ steps.metadata.outputs.version }}-${{ steps.metadata.outputs.tree }}
|
||||
path: app/build/reports/play-preflight.json
|
||||
path: app/build/preflight-artifacts/*
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
compression-level: 0
|
||||
|
||||
- name: Preflight summary
|
||||
run: |
|
||||
@@ -152,4 +164,4 @@ jobs:
|
||||
echo "- Release tree: \`${{ steps.metadata.outputs.tree }}\`" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "- Play track/status: **Production draft**" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "The signed build, DEX scan, and Play draft upload passed. Ensure this exact release tree is on main, then run **Hermes-Relay Android Release Approval** from main. Console-only reports are informational and non-blocking." >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "The signed build, package scans, and Play draft upload passed. Approval will publish these exact private artifacts if the unchanged tree reaches main. Console-only reports are informational and non-blocking." >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -36,6 +36,9 @@ jobs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
version_code: ${{ steps.version.outputs.version_code }}
|
||||
prerelease: ${{ steps.version.outputs.prerelease }}
|
||||
release_tree: ${{ steps.version.outputs.release_tree }}
|
||||
preflight_artifact_id: ${{ steps.preflight.outputs.artifact_id }}
|
||||
preflight_run_id: ${{ steps.preflight.outputs.run_id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
@@ -66,6 +69,7 @@ jobs:
|
||||
echo "version=$REF_VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "version_code=$VERSION_CODE" >> "$GITHUB_OUTPUT"
|
||||
echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
|
||||
echo "release_tree=$(git rev-parse 'HEAD^{tree}')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Verify version sync
|
||||
run: |
|
||||
@@ -110,25 +114,38 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Require successful Play preflight for this exact release tree
|
||||
id: preflight
|
||||
if: ${{ !contains(steps.version.outputs.version, '-') }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
RELEASE_TREE=$(git rev-parse 'HEAD^{tree}')
|
||||
RELEASE_TREE="${{ steps.version.outputs.release_tree }}"
|
||||
ARTIFACT_NAME="play-preflight-${VERSION}-${RELEASE_TREE}"
|
||||
COUNT=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/artifacts?name=${ARTIFACT_NAME}" \
|
||||
--jq '[.artifacts[] | select(.expired == false)] | length')
|
||||
if [ "$COUNT" -lt 1 ]; then
|
||||
ARTIFACT=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/artifacts?name=${ARTIFACT_NAME}" \
|
||||
--jq '[.artifacts[] | select(.expired == false)] | sort_by(.created_at) | last')
|
||||
ARTIFACT_ID=$(jq -r '.id // empty' <<<"$ARTIFACT")
|
||||
RUN_ID=$(jq -r '.workflow_run.id // empty' <<<"$ARTIFACT")
|
||||
if [ -z "$ARTIFACT_ID" ] || [ -z "$RUN_ID" ]; then
|
||||
echo "::error::No successful Play preflight found for version $VERSION with tree $RELEASE_TREE"
|
||||
echo "Run Hermes-Relay Android Play Preflight from the final dev tree, merge that unchanged tree to main, then approve the release."
|
||||
exit 1
|
||||
fi
|
||||
echo "Play preflight proof found: $ARTIFACT_NAME"
|
||||
RUN=$(gh api "/repos/${GITHUB_REPOSITORY}/actions/runs/${RUN_ID}")
|
||||
CONCLUSION=$(jq -r '.conclusion' <<<"$RUN")
|
||||
WORKFLOW_PATH=$(jq -r '.path' <<<"$RUN")
|
||||
if [ "$WORKFLOW_PATH" != ".github/workflows/play-preflight-android.yml" ] || [ "$CONCLUSION" != "success" ]; then
|
||||
echo "::error::Preflight artifact came from ${WORKFLOW_PATH} with conclusion ${CONCLUSION}"
|
||||
exit 1
|
||||
fi
|
||||
echo "artifact_id=$ARTIFACT_ID" >> "$GITHUB_OUTPUT"
|
||||
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
|
||||
echo "Play preflight artifacts verified: $ARTIFACT_NAME (run $RUN_ID, artifact $ARTIFACT_ID)"
|
||||
|
||||
ci:
|
||||
name: CI Checks
|
||||
name: CI Checks (prerelease only)
|
||||
needs: validate
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
@@ -168,6 +185,7 @@ jobs:
|
||||
release:
|
||||
name: Build & Publish Release
|
||||
needs: [validate, ci]
|
||||
if: ${{ always() && needs.validate.result == 'success' && (needs.ci.result == 'success' || needs.ci.result == 'skipped') }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
@@ -186,31 +204,33 @@ jobs:
|
||||
with:
|
||||
cache-read-only: false
|
||||
|
||||
- name: Decode release keystore
|
||||
- name: Download exact stable preflight artifacts
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
uses: actions/download-artifact@v8
|
||||
with:
|
||||
artifact-ids: ${{ needs.validate.outputs.preflight_artifact_id }}
|
||||
github-token: ${{ github.token }}
|
||||
repository: ${{ github.repository }}
|
||||
run-id: ${{ needs.validate.outputs.preflight_run_id }}
|
||||
path: app/build/preflight-artifacts
|
||||
|
||||
- name: Verify exact stable preflight artifacts
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
run: |
|
||||
python3 scripts/android_release_artifacts.py verify \
|
||||
--version "${{ needs.validate.outputs.version }}" \
|
||||
--version-code "${{ needs.validate.outputs.version_code }}" \
|
||||
--tree "${{ needs.validate.outputs.release_tree }}" \
|
||||
--directory app/build/preflight-artifacts
|
||||
|
||||
- name: Decode release keystore for candidate build
|
||||
env:
|
||||
HERMES_KEYSTORE_BASE64: ${{ secrets.HERMES_KEYSTORE_BASE64 }}
|
||||
if: env.HERMES_KEYSTORE_BASE64 != ''
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' && env.HERMES_KEYSTORE_BASE64 != '' }}
|
||||
run: |
|
||||
echo "$HERMES_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.keystore"
|
||||
echo "HERMES_KEYSTORE_PATH=$RUNNER_TEMP/release.keystore" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build stable release artifacts (APK + AAB)
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
env:
|
||||
HERMES_KEYSTORE_PASSWORD: ${{ secrets.HERMES_KEYSTORE_PASSWORD }}
|
||||
HERMES_KEY_ALIAS: ${{ secrets.HERMES_KEY_ALIAS }}
|
||||
HERMES_KEY_PASSWORD: ${{ secrets.HERMES_KEY_PASSWORD }}
|
||||
# `assembleRelease` and `bundleRelease` are flavor-wide task aliases
|
||||
# (added by `flavorDimensions += "track"` in app/build.gradle.kts), so
|
||||
# this one line builds ALL four artifacts at once. Filenames come from
|
||||
# `archivesName` (set in app/build.gradle.kts) which injects the app
|
||||
# version, so `<version>` below is `libs.versions.appVersionName`:
|
||||
# app/build/outputs/apk/googlePlay/release/hermes-relay-<version>-googlePlay-release.apk
|
||||
# app/build/outputs/apk/sideload/release/hermes-relay-<version>-sideload-release.apk
|
||||
# app/build/outputs/bundle/googlePlayRelease/hermes-relay-<version>-googlePlay-release.aab
|
||||
# app/build/outputs/bundle/sideloadRelease/hermes-relay-<version>-sideload-release.aab
|
||||
run: ./gradlew bundleRelease assembleRelease
|
||||
|
||||
- name: Build side-by-side release candidate APK
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
env:
|
||||
@@ -234,10 +254,10 @@ jobs:
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: android-r8-mappings-${{ needs.validate.outputs.version }}-${{ github.sha }}
|
||||
name: android-r8-mappings-${{ needs.validate.outputs.version }}-${{ needs.validate.outputs.release_tree }}
|
||||
path: |
|
||||
app/build/outputs/mapping/googlePlayRelease/mapping.txt
|
||||
app/build/outputs/mapping/sideloadRelease/mapping.txt
|
||||
app/build/preflight-artifacts/mapping-googlePlayRelease.txt
|
||||
app/build/preflight-artifacts/mapping-sideloadRelease.txt
|
||||
if-no-files-found: error
|
||||
retention-days: 90
|
||||
|
||||
@@ -254,8 +274,7 @@ jobs:
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
run: |
|
||||
python3 scripts/check-android-collection-apis.py \
|
||||
--apk app/build/outputs/apk/googlePlay/release/*.apk \
|
||||
--apk app/build/outputs/apk/sideload/release/*.apk
|
||||
--apk app/build/preflight-artifacts/*-sideload-release.apk
|
||||
|
||||
- name: Scan candidate DEX for unsupported collection APIs
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
@@ -267,8 +286,7 @@ jobs:
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
run: |
|
||||
python3 scripts/check-android-native-compat.py \
|
||||
app/build/outputs/apk/googlePlay/release/*.apk \
|
||||
app/build/outputs/apk/sideload/release/*.apk
|
||||
app/build/preflight-artifacts/*-sideload-release.apk
|
||||
|
||||
- name: Verify candidate packaged ONNX Runtime compatibility
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
@@ -278,23 +296,10 @@ jobs:
|
||||
|
||||
- name: List produced artifacts (debug aid)
|
||||
run: |
|
||||
echo "=== APK outputs ==="
|
||||
echo "=== Reused stable artifacts ==="
|
||||
find app/build/preflight-artifacts -maxdepth 1 -type f -print 2>/dev/null || true
|
||||
echo "=== Candidate APK outputs ==="
|
||||
find app/build/outputs/apk -name '*.apk' -print 2>/dev/null || true
|
||||
echo "=== AAB outputs ==="
|
||||
find app/build/outputs/bundle -name '*.aab' -print 2>/dev/null || true
|
||||
|
||||
- name: Generate stable checksums
|
||||
if: ${{ needs.validate.outputs.prerelease != 'true' }}
|
||||
# Flavor dimension adds an extra path segment to the AGP output layout.
|
||||
# APKs live under `apk/<flavor>/release/`, AABs under `bundle/<flavor>Release/`
|
||||
# (note the concatenated camelCase — AGP path quirk, documented but
|
||||
# different between APK and AAB). Checksums cover EXACTLY the files
|
||||
# attached to the GitHub Release (see the 2-asset policy on the
|
||||
# release step below) so SHA256SUMS.txt matches the assets 1:1.
|
||||
run: |
|
||||
cd app/build/outputs
|
||||
sha256sum apk/sideload/release/*.apk bundle/googlePlayRelease/*.aab > SHA256SUMS.txt
|
||||
cat SHA256SUMS.txt
|
||||
|
||||
- name: Generate candidate checksums
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
@@ -340,9 +345,9 @@ jobs:
|
||||
# Deliberate 2-asset policy (#144): attach ONLY the installable
|
||||
# sideload APK and Play AAB, plus checksums covering those files.
|
||||
files: |
|
||||
app/build/outputs/apk/sideload/release/*.apk
|
||||
app/build/outputs/bundle/googlePlayRelease/*.aab
|
||||
app/build/outputs/SHA256SUMS.txt
|
||||
app/build/preflight-artifacts/*-sideload-release.apk
|
||||
app/build/preflight-artifacts/*-googlePlay-release.aab
|
||||
app/build/preflight-artifacts/SHA256SUMS.txt
|
||||
|
||||
- name: Create candidate GitHub prerelease
|
||||
if: ${{ needs.validate.outputs.prerelease == 'true' }}
|
||||
@@ -364,18 +369,17 @@ jobs:
|
||||
run: |
|
||||
echo "## Hermes-Relay Android v${{ needs.validate.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "" >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$PRERELEASE" = "true" ] && [ -n "$HERMES_KEYSTORE_BASE64" ]; then
|
||||
echo "✅ **Release-signed HR Candidate app** — separate package ID; never uploaded to Play" >> "$GITHUB_STEP_SUMMARY"
|
||||
elif [ "$PRERELEASE" = "true" ]; then
|
||||
echo "⚠️ **Debug-signed HR Candidate app** — separate package ID; never uploaded to Play" >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ "$PRERELEASE" != "true" ]; then
|
||||
echo "✅ **Published the exact signed Play-preflight artifacts**" >> "$GITHUB_STEP_SUMMARY"
|
||||
elif [ -n "$HERMES_KEYSTORE_BASE64" ]; then
|
||||
echo "✅ **Signed with release keystore** — suitable for Play Store upload" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "✅ **Release-signed HR Candidate app** — separate package ID; never uploaded to Play" >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "⚠️ **Debug-signed** (no \`HERMES_KEYSTORE_BASE64\` secret) — NOT suitable for Play Store. Add the secret in repo settings to enable release signing." >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "⚠️ **Debug-signed HR Candidate app** — separate package ID; never uploaded to Play" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
echo "" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo "### Artifacts" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo '```' >> "$GITHUB_STEP_SUMMARY"
|
||||
find app/build/preflight-artifacts -maxdepth 1 -type f -exec ls -la {} + >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
|
||||
find app/build/outputs/apk -name '*.apk' -exec ls -la {} + >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
|
||||
find app/build/outputs/bundle -name '*.aab' -exec ls -la {} + >> "$GITHUB_STEP_SUMMARY" 2>/dev/null || true
|
||||
echo '```' >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
@@ -3,6 +3,12 @@ name: Hermes-Relay CLI+UI Release
|
||||
on:
|
||||
push:
|
||||
tags: ['desktop-v*']
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Approved CLI+UI version"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -20,6 +26,7 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('desktop-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v7
|
||||
@@ -34,10 +41,16 @@ jobs:
|
||||
- name: Extract and validate tag version
|
||||
id: version
|
||||
shell: bash
|
||||
env:
|
||||
DISPATCHED_VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="${GITHUB_REF_NAME#desktop-v}"
|
||||
if [[ -z "$version" || "$version" == "$GITHUB_REF_NAME" ]]; then
|
||||
if [ -n "$DISPATCHED_VERSION" ]; then
|
||||
version="$DISPATCHED_VERSION"
|
||||
else
|
||||
version="${GITHUB_REF_NAME#desktop-v}"
|
||||
fi
|
||||
if [ -z "$version" ] || { [ -z "$DISPATCHED_VERSION" ] && [ "$version" = "$GITHUB_REF_NAME" ]; }; then
|
||||
echo "Expected a desktop-v* tag, got $GITHUB_REF_NAME" >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -51,11 +64,12 @@ jobs:
|
||||
- name: Verify tag belongs to the correct integration branch
|
||||
shell: bash
|
||||
working-directory: .
|
||||
env:
|
||||
TAG_VERSION: ${{ steps.version.outputs.version }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="${GITHUB_REF_NAME#desktop-v}"
|
||||
tag_commit="$(git rev-parse "${GITHUB_REF_NAME}^{commit}")"
|
||||
if [[ "$version" == *-* ]]; then
|
||||
tag_commit="$(git rev-parse HEAD)"
|
||||
if [[ "$TAG_VERSION" == *-* ]]; then
|
||||
git fetch origin dev --no-tags
|
||||
if ! git merge-base --is-ancestor "$tag_commit" origin/dev; then
|
||||
echo "CLI+UI prereleases must be tagged from dev; $tag_commit is not in origin/dev" >&2
|
||||
@@ -78,6 +92,8 @@ jobs:
|
||||
working-directory: desktop
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('desktop-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Setup Node.js (for npm ci + tsc)
|
||||
uses: actions/setup-node@v7
|
||||
@@ -271,6 +287,8 @@ jobs:
|
||||
working-directory: desktop
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('desktop-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v7
|
||||
@@ -289,6 +307,18 @@ jobs:
|
||||
- name: Setup Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Restore exact-source tray build cache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: |
|
||||
~/.cargo/registry/index
|
||||
~/.cargo/registry/cache
|
||||
~/.cargo/git/db
|
||||
desktop/tray/target
|
||||
key: ${{ runner.os }}-tray-rust-${{ hashFiles('desktop/tray/Cargo.lock') }}-${{ hashFiles('desktop/tray/Cargo.toml', 'desktop/tray/build.rs', 'desktop/tray/src/**/*.rs') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-tray-rust-${{ hashFiles('desktop/tray/Cargo.lock') }}-
|
||||
|
||||
- name: Install deps
|
||||
run: npm ci && npm --prefix tray ci
|
||||
|
||||
@@ -411,6 +441,11 @@ jobs:
|
||||
if ($versionOutput -ne "hermes-relay $env:EXPECTED_DESKTOP_VERSION") {
|
||||
throw "installed CLI version mismatch: expected $env:EXPECTED_DESKTOP_VERSION, got '$versionOutput'"
|
||||
}
|
||||
$tray = Join-Path $installDir 'hermes-relay-tray.exe'
|
||||
$trayVersion = (Get-Item -LiteralPath $tray).VersionInfo.ProductVersion
|
||||
if ($trayVersion -ne $env:EXPECTED_DESKTOP_VERSION) {
|
||||
throw "installed UI version mismatch: expected $env:EXPECTED_DESKTOP_VERSION, got '$trayVersion'"
|
||||
}
|
||||
$helpOutput = (& $cli --help | Out-String)
|
||||
if ($LASTEXITCODE -ne 0 -or $helpOutput -notmatch 'Usage:') {
|
||||
throw 'installed CLI --help smoke failed'
|
||||
@@ -451,7 +486,7 @@ jobs:
|
||||
throw "installer lifecycle changed the pre-existing tray startup preference"
|
||||
}
|
||||
|
||||
Write-Host "packaged installer lifecycle smoke OK version=$versionOutput install=$installDir"
|
||||
Write-Host "packaged installer lifecycle smoke OK cli=$versionOutput ui=$trayVersion install=$installDir"
|
||||
} finally {
|
||||
Get-Process -Name 'hermes-relay-tray' -ErrorAction SilentlyContinue |
|
||||
Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
@@ -483,6 +518,7 @@ jobs:
|
||||
name: Publish GitHub Release
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- validate-release
|
||||
- build-cli-binaries
|
||||
- smoke-windows-cli-release-asset
|
||||
- smoke-macos-cli-release-asset
|
||||
@@ -492,10 +528,8 @@ jobs:
|
||||
# Needed so CLI_RELEASE_NOTES.md is available to render into the release body
|
||||
# (the other publish-release steps only consume downloaded build artifacts).
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: Extract CLI+UI version
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#desktop-v}" >> "$GITHUB_OUTPUT"
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('desktop-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- uses: actions/download-artifact@v8
|
||||
with:
|
||||
@@ -515,8 +549,8 @@ jobs:
|
||||
# (desktop-v0.3.0) so install/pin commands stay accurate without manual edits.
|
||||
- name: Render release notes
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
VERSION: ${{ needs.validate-release.outputs.version }}
|
||||
TAG: desktop-v${{ needs.validate-release.outputs.version }}
|
||||
run: |
|
||||
sed -e "s/__VERSION__/${VERSION}/g" -e "s/__TAG__/${TAG}/g" \
|
||||
CLI_RELEASE_NOTES.md > cli_release_notes_rendered.md
|
||||
@@ -525,10 +559,10 @@ jobs:
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v3
|
||||
with:
|
||||
name: Hermes-Relay CLI+UI v${{ steps.version.outputs.version }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Hermes-Relay CLI+UI v${{ needs.validate-release.outputs.version }}
|
||||
tag_name: desktop-v${{ needs.validate-release.outputs.version }}
|
||||
draft: false
|
||||
prerelease: ${{ contains(steps.version.outputs.version, 'alpha') || contains(steps.version.outputs.version, 'beta') || contains(steps.version.outputs.version, 'rc') }}
|
||||
prerelease: ${{ contains(needs.validate-release.outputs.version, '-') }}
|
||||
fail_on_unmatched_files: true
|
||||
body_path: cli_release_notes_rendered.md
|
||||
files: |
|
||||
|
||||
@@ -4,6 +4,12 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "server-v*"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Approved Plugin version"
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -19,10 +25,19 @@ jobs:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('server-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF#refs/tags/server-v}" >> "$GITHUB_OUTPUT"
|
||||
env:
|
||||
DISPATCHED_VERSION: ${{ inputs.version }}
|
||||
run: |
|
||||
if [ -n "$DISPATCHED_VERSION" ]; then
|
||||
version="$DISPATCHED_VERSION"
|
||||
else
|
||||
version="${GITHUB_REF#refs/tags/server-v}"
|
||||
fi
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Verify Plugin version sync and changelog
|
||||
run: |
|
||||
@@ -61,6 +76,8 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('server-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v7
|
||||
@@ -99,6 +116,8 @@ jobs:
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
ref: ${{ github.event_name == 'workflow_dispatch' && format('server-v{0}', inputs.version) || github.ref }}
|
||||
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v7
|
||||
|
||||
@@ -8,20 +8,43 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
||||
|
||||
### Changed
|
||||
|
||||
- **Android Chat and Voice use tablet space intentionally.** Expanded layouts keep introductions, transcripts, composer controls, and status chrome on readable centered rails, while landscape Voice Focus separates identity controls from conversation activity without changing phone or portrait interaction behavior.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Android streams Standard Hermes attachments into its on-disk media cache.** Automatic Dashboard downloads no longer preallocate and duplicate the full response body on the OkHttp dispatcher, while declared and observed size limits remain enforced. (#531)
|
||||
- **Android fresh Gateway chats wait for their upstream runtime before sending.** Android now consumes the lazy `session.create` readiness edge instead of racing the first prompt into compute-host ownership rejection. Genuine ownership refusals keep the exact holder-aware error and retryable local prompt instead of falling into unfinished-message history recovery.
|
||||
- **Windows desktop updates keep the installed CLI and UI on one release.** `hermes-relay update` now detects a colocated management UI, reports both installed versions, and uses the verified bundle installer to replace and restart the affected surfaces together. Explicit CLI-only installations retain the standalone binary updater.
|
||||
|
||||
## [Android 1.15.0] - 2026-08-31
|
||||
|
||||
### Changed
|
||||
|
||||
- **Android prefers current upstream Hermes for standard media, Git, usage, and notices.** Authenticated Dashboard file delivery, current-session `/api/git/*`, Gateway `usage.bars`, and keyed agent notices work without the optional Hermes-Relay Plugin; Relay remains additive for older-host media compatibility, sensitivity metadata, repository discovery and guarded mutations, multi-provider usage, and true Relay tools.
|
||||
- **Android Settings separates standard Hermes from Relay tools.** Media now sits with Chat and Voice under Hermes, while proactive Threads, Terminal, Notification Companion, Relay sessions, and Device Control remain clearly grouped behind the optional plugin.
|
||||
- **Android Supervised Mode uses app-specific parent access.** Parents choose a six-digit PIN or password, receive a shareable six-word recovery phrase, and can remove the credential without losing their supervised profile, capability, appearance, visibility, session, or relock settings. Android device credentials and biometrics no longer grant parent access.
|
||||
- **Android What's New now provides a readable, complete release record.** One overall title and summary lead into selected highlights, every remaining user-visible addition, improvement, and fix, and relevant compatibility boundaries. Toast counts and previews are derived from that same inventory, so View all no longer promises details the expanded dialog and history cannot show.
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Standard Hermes attachments no longer demand Relay pairing.** Host-local images, audio, video, and files download through the authenticated Dashboard, stay loaded across history reconciliation, and fall back to one neutral compatibility card on older hosts instead of flashing `Relay URL not configured` or retrying indefinitely.
|
||||
- **Removing optional Relay does not strand Standard voice or leak preferences across connections.** Runtime fallback keeps Dashboard voice usable, preserves configured choices through temporary outages, and normalizes only connection-scoped named-profile settings after explicit Relay removal.
|
||||
- **Passively observed Desktop/TUI turns now show live activity in the Android session drawer.** A uniquely matched selected session projects Working or Waiting without Android resuming, activating, or interrupting the external runtime; ambiguous cross-profile matches remain neutral. (Related: #365)
|
||||
- **Hermes-Relay Plugin installs through the native Hermes command again.** The manifest remains fully described for current hosts while avoiding the installer/runtime schema mismatch in affected Hermes releases.
|
||||
- **Android Chat keeps one transport owner through sign-out and outages.** Dashboard/Gateway conversations now preserve their transcript, draft, profile, and session for sign-in or retry instead of silently sending the next turn to a reachable Direct API database. Legacy API-only connections and explicitly selected Direct API chats remain supported.
|
||||
- **Android keeps completed chat text visible when Dashboard sign-in expires.** Generic and reason-coded history `401` responses settle the local turn, preserve its transcript, and surface the existing sign-in recovery without reading another profile's API history.
|
||||
- **Android keeps long-running context compaction alive.** A client-visible compaction status extends and refreshes the Gateway turn watchdog instead of interrupting healthy compression after the ordinary idle window. (Supersedes #484.)
|
||||
- **Android Bot Chats render loaded history immediately.** Route-owned chat screens observe their own handler state from first composition, including fast history loads that settle before another frame. (Supersedes #453.)
|
||||
- **Android Chat settles an owned Gateway turn when its terminal frame is lost.** An exact idle `session.active_list` snapshot now completes the matching local stream, reconciles durable history, and drains its queued follow-up without interrupting or claiming Desktop/TUI work.
|
||||
- **Supervised Gateway setup stays parent-owned.** Add Gateway is single-flight and checks live parent authority before allocating a draft, relock/back cancels the exact pending setup, and the locked Chat footer no longer attempts protected navigation.
|
||||
- **Generated images stay visible and use their intended Chat animation.** Completed image media survives a marker-lagging history refresh, and both the built-in `image_generate` tool and profile tools ending in `_create_image` use the image-generation presentation.
|
||||
|
||||
## [Plugin 1.11.1] - 2026-08-31
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Hermes-Relay Plugin installs through the native Hermes command again.** The manifest remains fully described for current hosts while avoiding the installer/runtime schema mismatch in affected Hermes releases.
|
||||
- **Relay prompt context advertises only real callable phone tools.** Phone-control and cross-platform delivery guidance now follows the exact selected session/profile tool catalog instead of implying unavailable `android_*` or `send_message` capabilities.
|
||||
|
||||
## [Android 1.14.0] - 2026-08-30
|
||||
|
||||
### Added
|
||||
@@ -70,7 +93,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
|
||||
- **Dense pairing QRs scan reliably.** Dashboard, CLI, and TUI render integer-sized modules with a full quiet zone.
|
||||
- **Remote-access migration keeps existing listeners safe.** Recommended setup avoids taking over `:443`, explicit legacy cleanup remains available, and default disable actions remove only the listeners they own.
|
||||
|
||||
## [0.4.0-beta.6] - 2026-08-30
|
||||
## [0.4.0-beta.6] - 2026-08-31
|
||||
|
||||
### Changed
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Hermes-Relay CLI+UI v__VERSION__
|
||||
|
||||
**Release Date:** 2026-08-30
|
||||
**Release Date:** 2026-08-31
|
||||
|
||||
This beta preserves complete multi-route pairing while preventing Desktop from dialing Dashboard-ingress Relay routes before Dashboard WebSocket ticket support is available. (Related: #399)
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ Use the narrowest command that proves the change:
|
||||
5. `scripts/dev.bat prepush` only when full local verification is explicitly
|
||||
wanted or cloud execution is unavailable.
|
||||
|
||||
Android release preparation uses `python scripts/android-prepush.py
|
||||
--release-prep` while version notes are changing. It keeps local feedback to
|
||||
metadata and release-presentation tests; the exact pushed commit still goes
|
||||
through required CI and Play preflight before publication.
|
||||
|
||||
`install-fast` is intentionally phone-specific. Use `install` for a universal
|
||||
sideload debug APK or when the target ABI is not arm64. Release builds remain
|
||||
universal and are unaffected unless `-Phermes.devAbi` is explicitly supplied.
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
# Hermes-Relay — Dev Log
|
||||
|
||||
## 2026-09-01 — Exact-tree release artifact promotion
|
||||
|
||||
Android Play preflight now packages the signed sideload APK, Play AAB, R8
|
||||
mappings, manifest, and public checksums as one immutable tree-keyed artifact.
|
||||
Stable approval revalidates and publishes those exact bytes instead of
|
||||
recompiling the release after Play accepted the draft. Final DEX and native
|
||||
compatibility checks still run against the promoted package.
|
||||
|
||||
Required CI records a separate short-lived proof keyed to the complete Git
|
||||
tree. Canonical `dev` to `main` promotion reuses that proof only when the
|
||||
simulated merge tree is byte-identical; missing evidence or any tree change
|
||||
falls back to the full path-aware matrix. Local Android release iteration now
|
||||
uses a metadata-and-presentation lane, and a coordinated approval workflow can
|
||||
start independent Android, Plugin, and CLI+UI release jobs concurrently.
|
||||
The Windows tray lane also carries an exact-source Cargo/target cache from
|
||||
trusted branch CI into the tag installer build, with lockfile-scoped incremental
|
||||
fallback when tray sources change.
|
||||
|
||||
## 2026-09-01 — Unified Windows desktop update contract
|
||||
|
||||
The desktop updater now treats a detected Windows management UI as an installed
|
||||
bundle rather than updating only the CLI executable. Update checks compare the
|
||||
embedded CLI version with the tray executable's product version, expose the
|
||||
selected `cli` or `cli_ui` target in JSON, and route drift repair through the
|
||||
checksum-verified NSIS installer. Windows installations without the tray keep
|
||||
the standalone cooperative CLI swap.
|
||||
|
||||
Bundle updates wait for the invoking CLI to exit, stop installer-owned CLI,
|
||||
daemon, and tray processes, then restore only the daemon and tray processes that
|
||||
were running before the update. Focused tests cover bundle detection, installer
|
||||
selection, drift reporting, headless preservation, and stopped-tray behavior.
|
||||
|
||||
## 2026-08-31 — Android Gateway compaction watchdog lease
|
||||
|
||||
Gateway turns now recognize the upstream `status.update` payload kind
|
||||
|
||||
@@ -1,29 +1,15 @@
|
||||
# Hermes-Relay Plugin v__VERSION__
|
||||
|
||||
**Release Date:** August 30, 2026
|
||||
**Release Date:** August 31, 2026
|
||||
|
||||
## Summary
|
||||
|
||||
This release lets one authenticated Hermes Dashboard origin carry Gateway plus optional Relay extensions, adds a bounded Git workspace, and reorganizes the Dashboard plugin around operator tasks. Standard chat, session history, profiles, Manage, and standard voice remain upstream-owned and do not require this plugin.
|
||||
|
||||
## Added
|
||||
|
||||
- **Dashboard same-origin Relay ingress.** Fixed allowlisted HTTP and WebSocket routes proxy to the local Relay while Dashboard admission and Relay session authentication remain independent. (Related: #399)
|
||||
- **Bounded Git workspace.** Configured roots, path containment, line totals, diffs, branches, staging, commits, remotes, grants, and explicit confirmations protect repository operations.
|
||||
|
||||
## Changed
|
||||
|
||||
- **Task-oriented Dashboard UI.** Overview, Devices, Activity, Remote Access, Git, and Settings now have dedicated surfaces with QR-first pairing, responsive device cards, and honest media diagnostics. (#486)
|
||||
- **One explicit route topology.** Dashboard, CLI, and TUI pairing advertise Dashboard, Relay, and optional API surfaces with stable priorities across Tailscale, public HTTPS, and LAN.
|
||||
- **Dedicated Tailscale listener.** Recommended setup uses tailnet HTTPS `:10443` to local Dashboard `:9119`, avoiding ownership of a reverse proxy's `:443`. Existing `:443`, `:9119`, and direct `:8767` routes remain migration compatibility.
|
||||
This patch restores native installation compatibility on affected Hermes versions and makes Relay prompt context advertise only capabilities the selected session can actually call. Standard Chat, Manage, standard voice, and ordinary inbound files remain upstream-owned.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Public and roaming invites no longer synthesize closed direct Relay `:8767` or wrong Dashboard `:9119` routes.
|
||||
- Ambiguous, credential-bearing, or plaintext public candidates fail closed before an invite is exposed.
|
||||
- Dense pairing QRs use integer-sized modules and a full quiet zone.
|
||||
- Inactive optional API routes are omitted; protected Dashboard-ingress `401/403` responses display as authentication-required while direct Relay and API failures remain failures.
|
||||
- Default Tailscale disable actions remove only owned listeners, and explicit migration cleanup accepts only the bounded supported ports.
|
||||
- **Native installer compatibility.** The plugin keeps its complete current manifest while avoiding the installer/runtime schema mismatch that caused `manifest_version 2` installs to fail after an apparent Hermes update.
|
||||
- **Capability-gated phone context.** Phone-control and cross-platform delivery guidance now follows the selected session/profile tool catalog instead of implying unavailable `android_*` or `send_message` callables.
|
||||
|
||||
## Install / update
|
||||
|
||||
@@ -35,7 +21,7 @@ This release lets one authenticated Hermes Dashboard origin carry Gateway plus o
|
||||
# or, if already installed:
|
||||
hermes-relay-update
|
||||
|
||||
Restart or reload the Hermes Dashboard and Relay after updating so the new manifest, routes, and committed Dashboard bundle are active.
|
||||
Restart or reload the Hermes Dashboard and Relay after updating so the new manifest and prompt context are active.
|
||||
|
||||
## Verify
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="assets/play-store-feature-1024x500.png" alt="Hermes-Relay — your Hermes agent, in your pocket" width="800">
|
||||
<img src="assets/readme-hero-v2.jpg" alt="Hermes-Relay — Your Hermes agent. Wherever you are. Android, Voice, Desktop." width="1000">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
@@ -38,10 +38,10 @@ Hermes-Relay puts your [Hermes agent](https://github.com/NousResearch/hermes-age
|
||||
- **📱 Android app** — streaming chat, hands-free voice, native plugin pages, and the full Hermes dashboard (models, keys, skills, profiles), rebuilt native. Add a floating Petdex companion or optionally make Hermes your Android assistant; sideload builds can also let the agent read and act on your screen.
|
||||
- **⌨️ Hermes-Relay CLI** *(beta)* — a single binary that gives the agent **hands on any machine you pair**: files, terminal, search, screenshots — consent-gated.
|
||||
|
||||
A vanilla [hermes-agent](https://github.com/NousResearch/hermes-agent) install is enough for the upstream standard path: chat, management, voice, Petdex, and ordinary installed-plugin pages. The Hermes-Relay plugin is optional for that base but encouraged for the complete current experience: Terminal/TUI, notifications, media, desktop tools, enhanced voice, Relay sessions, page drafts, and optional Device Control. Hermes-Relay prefers compatible upstream surfaces as they become available instead of keeping duplicate extension paths. **Connect Hermes first, then grant Hermes-Relay separately; the same one-time invite contract pairs Android or the Desktop CLI.**
|
||||
A vanilla [hermes-agent](https://github.com/NousResearch/hermes-agent) install is enough for the upstream standard path: chat, management, voice, inbound files, Petdex, and ordinary installed-plugin pages. The Hermes-Relay plugin is optional for that base but encouraged for the complete current experience: Terminal/TUI, notifications, desktop tools, enhanced voice, Relay sessions, page drafts, optional Device Control, and media compatibility or metadata. Hermes-Relay prefers compatible upstream surfaces as they become available instead of keeping duplicate extension paths. **Connect Hermes first, then grant Hermes-Relay separately; the same one-time invite contract pairs Android or the Desktop CLI.**
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/diagrams/architecture-homepage.png" alt="How Hermes-Relay connects — upstream Hermes owns Chat, Manage, and standard Voice; the encouraged Relay extension fills current gaps for Terminal, notifications, media, enhanced voice, sessions, desktop tools, and optional Device Control." width="900">
|
||||
<img src="assets/readme-connection-map-v2.png" alt="How Hermes-Relay connects — Dashboard and Gateway own the standard Android path for Chat, Manage, Voice, and inbound files; the optional Relay plugin separately adds Android enhancements plus CLI and UI tools; sideload adds Device Control." width="1000">
|
||||
</p>
|
||||
|
||||
## Quick Start (Android)
|
||||
@@ -50,7 +50,7 @@ Install → connect → talk, in about two minutes.
|
||||
|
||||
### 1 · Install the app
|
||||
|
||||
- **Google Play** *(easiest — auto-updates)* — [**install from Google Play**](https://play.google.com/store/apps/details?id=com.axiomlabs.hermesrelay). Chat, voice, sessions, and Manage work with standard Hermes; pairing the Hermes-Relay plugin adds Terminal/TUI, media, notifications, and Relay sessions.
|
||||
- **Google Play** *(easiest — auto-updates)* — [**install from Google Play**](https://play.google.com/store/apps/details?id=com.axiomlabs.hermesrelay). Chat, voice, sessions, Manage, and inbound files work with standard Hermes; pairing the Hermes-Relay plugin adds Terminal/TUI, notifications, Relay sessions, and media enhancements.
|
||||
- **APK** *(full phone-control feature set)* — download the file ending in **`-sideload-release.apk`** from the newest `android-v*` release on [GitHub Releases](https://github.com/Codename-11/hermes-relay/releases) and open it (allow your browser to install unknown apps the first time). Integrity verification, signing fingerprint, and per-build details are in the [Sideload guide](https://hermes-relay.dev/docs/guide/getting-started.html#sideload-apk).
|
||||
|
||||
Sideload builds check GitHub for updates and show a one-tap banner when you're behind; Play builds update through the Store. See [Release tracks](https://hermes-relay.dev/docs/guide/release-tracks) for the capability matrix.
|
||||
@@ -58,7 +58,7 @@ Sideload builds check GitHub for updates and show a one-tap banner when you're b
|
||||
### 2 · Have the Hermes Dashboard running
|
||||
|
||||
The normal Android connection uses the upstream Hermes Dashboard/Gateway for
|
||||
chat, sign-in, sessions, Manage, and voice. Installing Hermes and choosing a
|
||||
chat, sign-in, sessions, Manage, voice, and inbound files. Installing Hermes and choosing a
|
||||
provider is vanilla Hermes setup:
|
||||
|
||||
```bash
|
||||
@@ -77,16 +77,15 @@ the [remote-access guide](https://hermes-relay.dev/docs/guide/remote-access/).
|
||||
|
||||
### 3 · Connect and talk
|
||||
|
||||
For a plugin-enabled host, open the Web Dashboard's **Relay** page, click
|
||||
**Connect mobile app**, and scan that tokenless QR from Android **Connect → Scan
|
||||
Hermes setup QR**. It contains only the Dashboard address and configures the
|
||||
upstream Chat, sessions, Manage, sign-in, and standard voice connection.
|
||||
|
||||
Without the Dashboard plugin, use **Find Hermes on LAN** or enter the Dashboard
|
||||
address manually (conventionally `http://<host>:9119`). Sign in through the
|
||||
Use **Find Hermes on LAN** or enter the Dashboard address manually
|
||||
(conventionally `http://<host>:9119`). Sign in through the
|
||||
Dashboard's configured provider when prompted. The app probes the available
|
||||
upstream capabilities and finishes with a connection summary.
|
||||
|
||||
If the Relay Dashboard page is already installed, **Connect mobile app** offers
|
||||
the same standard connection as a tokenless QR. It contains only the Dashboard
|
||||
address and does not install, enable, or pair Relay.
|
||||
|
||||
The separate API server can be discovered automatically or added later under
|
||||
**Advanced** as a chat fallback or for a headless compatibility setup. Its API
|
||||
key is requested only when that optional endpoint is configured. Existing
|
||||
@@ -109,9 +108,9 @@ the whole Vanilla Hermes setup.
|
||||
|
||||
### 4 · Recommended: pair Relay for the complete experience
|
||||
|
||||
Install Relay for Terminal/TUI, notifications, media handoff, desktop tools,
|
||||
enhanced voice, Relay sessions, approval-gated page drafts, and optional Device
|
||||
Control:
|
||||
Install Relay for Terminal/TUI, notifications, desktop tools, enhanced voice,
|
||||
Relay sessions, approval-gated page drafts, optional Device Control, and media
|
||||
compatibility or sensitivity metadata:
|
||||
|
||||
```bash
|
||||
hermes plugins install Codename-11/hermes-relay/plugin --enable
|
||||
@@ -161,7 +160,7 @@ manual fallbacks when QR or clipboard transfer is unavailable.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/screenshots/supplemental/15_git_workspace.png" alt="Native Git workspace showing repository changes, an inline diff, and staging controls" width="260"><br>
|
||||
<sub><b>Native Git workspace</b> — optional Hermes-Relay plugin</sub>
|
||||
<sub><b>Native Git workspace</b> — upstream session context with optional Relay discovery and operations</sub>
|
||||
</p>
|
||||
|
||||
### Simplified Chinese
|
||||
@@ -215,7 +214,7 @@ hermes-relay update # self-update via GitHub Releases
|
||||
|
||||
It pairs against the **same relay and credential store** as the Android app — pair once from either, both work. Tagged on the `desktop-v*` [release track](https://github.com/Codename-11/hermes-relay/releases?q=desktop), with historical releases still visible under `cli-v*`.
|
||||
|
||||
On Windows, the default installer adds the optional compact **Hermes-Relay CLI UI** tray popup for host selection and pairing, connection and daemon state, per-host Ask/Trusted/Full Access, local grant dialogs, authorized-client revocation, activity, settings, and emergency stop. It is a management surface only—chat, TUI, plugins, voice, and agent sessions remain CLI/upstream concerns.
|
||||
On Windows, the default installer adds the optional compact **Hermes-Relay CLI UI** tray popup for host selection and pairing, connection and daemon state, per-host Ask/Trusted/Full Access, local grant dialogs, authorized-client revocation, activity, settings, and emergency stop. `hermes-relay update` detects this bundle and updates the CLI and UI together; explicit CLI-only installations stay headless and continue using the standalone binary updater. The UI is a management surface only—chat, TUI, plugins, voice, and agent sessions remain CLI/upstream concerns.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
@@ -239,17 +238,17 @@ remote tool surface. See the [desktop tools guide](https://hermes-relay.dev/docs
|
||||
## How It Works
|
||||
|
||||
```
|
||||
Phone (HTTP/WSS) --> Hermes Dashboard (:9119) [chat gateway, manage, vanilla voice]
|
||||
Phone (HTTP/WSS) --> Hermes Dashboard (:9119) [chat gateway, manage, vanilla voice, inbound files]
|
||||
Phone (HTTP/SSE) --> Hermes API Server (:8642) [Direct API chat, sessions, runs]
|
||||
Phone (WSS/HTTP) --> Relay (:8767) [terminal, bridge, media, relay voice, sessions]
|
||||
Phone (WSS/HTTP) --> Relay (:8767) [terminal, bridge, media enhancements, relay voice, sessions]
|
||||
CLI (WSS) --> Relay (:8767) [machine tools, tui, terminal]
|
||||
```
|
||||
|
||||
Standard connections keep Chat on the Hermes Dashboard/Gateway. Explicit API-only
|
||||
connections use the upstream Direct API SSE path with an API key. Manage and Vanilla Hermes
|
||||
voice ride the Hermes dashboard with its own one-time sign-in, so a vanilla
|
||||
install needs no plugin for either. The optional relay on `:8767` adds the power
|
||||
surfaces: terminal, bridge phone control, media handoff, machine tools, and
|
||||
install needs no plugin for those surfaces or ordinary inbound files. The optional relay on `:8767` adds
|
||||
terminal, bridge phone control, media compatibility/metadata, machine tools, and
|
||||
relay-side voice, which is preferred automatically when paired. One QR can
|
||||
configure API, dashboard, and relay routes without merging their auth models.
|
||||
|
||||
|
||||
@@ -628,6 +628,21 @@ and the release notes and learn only what the software does.
|
||||
|
||||
### 3. Build and verify locally
|
||||
|
||||
During release-note/version iteration, use the narrow release-prep lane:
|
||||
|
||||
```powershell
|
||||
python scripts/android-prepush.py --release-prep
|
||||
```
|
||||
|
||||
It runs release metadata checks plus the rendered Changelog/What's New tests in
|
||||
the serialized Android lane. Once the exact commit is pushed, current-head CI
|
||||
and Play preflight own lint, focused shards, both-flavor assemblies, signing,
|
||||
and final package scans. Do not repeat the complete local release build unless
|
||||
cloud execution is unavailable or explicit local artifact/device proof is
|
||||
needed.
|
||||
|
||||
For that explicit full local proof:
|
||||
|
||||
```bat
|
||||
scripts\dev.bat bundle
|
||||
keytool -printcert -jarfile app\build\outputs\bundle\googlePlayRelease\hermes-relay-*-googlePlay-release.aab
|
||||
@@ -661,14 +676,17 @@ The preflight workflow:
|
||||
3. builds and release-signs the same APK/AAB variants used by the public release;
|
||||
4. scans the final minified APK DEX for unsupported collection calls;
|
||||
5. uploads the Google Play AAB as a private **Production draft**; and
|
||||
6. records a 30-day preflight proof keyed to the version and Git tree hash.
|
||||
6. retains the exact signed sideload APK, Play AAB, R8 mappings, manifest, and
|
||||
checksums as one immutable 30-day artifact keyed to version and Git tree.
|
||||
|
||||
No sideload APK or GitHub Release is published by preflight. A successful signed
|
||||
build, final DEX scan, and Production-draft upload is the automated Play release
|
||||
gate. Play Console pre-review and pre-launch reports are informational and
|
||||
non-blocking because their detailed results are not exposed through the release
|
||||
automation API. If the release source changes after preflight, rerun it—the
|
||||
approval workflow matches the complete Git tree, not just the version number.
|
||||
build, final package scans, and Production-draft upload is the automated Play
|
||||
release gate. The private artifact is immutable and hash-verified again before
|
||||
publication; the stable release workflow does not rebuild those bytes. Play
|
||||
Console pre-review and pre-launch reports are informational and non-blocking
|
||||
because their detailed results are not exposed through the release automation
|
||||
API. If the release source changes after preflight, rerun it—the approval
|
||||
workflow matches the complete Git tree, not just the version number.
|
||||
|
||||
GitHub exposes manual workflows only after their workflow file exists on the
|
||||
default branch. For the first release that introduces this process, merge the
|
||||
@@ -709,12 +727,13 @@ from `main`; every release job explicitly checks out and verifies the immutable
|
||||
an existing tag or changing its artifact tree. Manual stable tags are still
|
||||
guarded by the same preflight proof in the tag workflow.
|
||||
|
||||
The tag-triggered `.github/workflows/release-android.yml` rebuilds and scans the
|
||||
artifacts, changes the existing Play Production draft to `completed` (submitting
|
||||
it for review), and only after Play accepts that operation creates the public
|
||||
GitHub Release with the sideload APK. A missing preflight, changed release tree,
|
||||
missing Play credential, or Play submission failure prevents public GitHub
|
||||
publication.
|
||||
The tag-triggered `.github/workflows/release-android.yml` downloads the exact
|
||||
private preflight artifact by ID, verifies its source workflow, manifest, tree,
|
||||
version, sizes, and hashes, reruns the package scanners, then changes the
|
||||
existing Play Production draft to `completed` (submitting it for review). Only
|
||||
after Play accepts that operation does it publish those same APK/AAB bytes on
|
||||
GitHub. A missing preflight, changed release tree, artifact mismatch, missing
|
||||
Play credential, or Play submission failure prevents public publication.
|
||||
|
||||
Plugin/Python version files are intentionally not part of an Android app
|
||||
release unless the plugin package itself is also being released.
|
||||
@@ -743,14 +762,19 @@ git commit -m "release(server): server-v0.6.2"
|
||||
git push origin dev
|
||||
|
||||
# Open the release PR (dev -> main) and merge with --no-ff.
|
||||
# After merge, tag from the new main tip:
|
||||
git checkout main
|
||||
git pull --ff-only origin main
|
||||
git tag server-v0.6.2
|
||||
git push origin server-v0.6.2
|
||||
# Then run "Hermes-Relay Plugin and CLI+UI Release Approval" from main,
|
||||
# select plugin, and enter 0.6.2. The workflow selects and validates main
|
||||
# before it creates server-v0.6.2 and starts the immutable-tag release workflow.
|
||||
```
|
||||
|
||||
Pushing `server-v*` triggers `.github/workflows/release-plugin.yml`, which
|
||||
For a Plugin prerelease, keep the release-prepared commit on `dev` and run the
|
||||
same trusted approval workflow from `main`; the version suffix makes it select
|
||||
and validate the exact `origin/dev` tip before creating the tag. Stable versions
|
||||
select `origin/main` instead.
|
||||
Direct `server-v*` tag pushes remain a recovery path and are guarded by the same
|
||||
branch-containment and metadata checks.
|
||||
|
||||
The approval workflow dispatches `.github/workflows/release-plugin.yml`, which
|
||||
validates all plugin-owned version metadata with
|
||||
`scripts/check-plugin-version-sync.py`. Run
|
||||
`python scripts/check-version-tracks.py` locally before tagging when a change
|
||||
@@ -781,20 +805,25 @@ git add desktop/package.json desktop/package-lock.json desktop/src/version.ts `
|
||||
git commit -m "release(desktop): desktop-v0.4.0-alpha.2"
|
||||
git push origin dev
|
||||
|
||||
# Open the release PR (dev -> main) and merge with --no-ff.
|
||||
# After merge, tag from main:
|
||||
git switch main
|
||||
git pull --ff-only origin main
|
||||
cd desktop
|
||||
npm run check:version-sync -- --expect 0.4.0-alpha.2
|
||||
cd ..
|
||||
git tag desktop-v0.4.0-alpha.2
|
||||
git push origin desktop-v0.4.0-alpha.2
|
||||
# This is a prerelease: run "Hermes-Relay Plugin and CLI+UI Release Approval"
|
||||
# from main, select desktop, and enter 0.4.0-alpha.2. The workflow validates dev
|
||||
# before it creates the tag and starts the immutable-tag release workflow.
|
||||
```
|
||||
|
||||
The tag workflow rejects version drift and tags whose commit is not in
|
||||
`origin/main`, reruns CLI tests, builds all four standalone binaries, tests and
|
||||
packages the Windows tray, generates checksums, and publishes the GitHub Release.
|
||||
For a stable CLI+UI version, first merge the release PR from `dev` to `main`,
|
||||
then run the approval workflow from `main`. The version determines the source:
|
||||
prereleases select the exact `origin/dev` tip and stable releases select the
|
||||
exact `origin/main` tip before creating any tag. Direct `desktop-v*` tag pushes
|
||||
remain a recovery path.
|
||||
|
||||
The release workflow rejects version drift and requires prerelease tags to be
|
||||
contained in `origin/dev` and stable tags to be contained in `origin/main`. It
|
||||
reruns CLI tests, builds all four standalone binaries, tests and packages the
|
||||
Windows tray, generates checksums, and publishes the GitHub Release.
|
||||
Trusted desktop CI and the release installer job share a Cargo/target cache
|
||||
keyed by the lockfile and exact tray sources. A `main` push for the release tree
|
||||
warms the exact cache before the immutable tag build; a miss safely performs the
|
||||
ordinary Rust/Tauri build.
|
||||
|
||||
### 6. Play review and publishing behavior
|
||||
|
||||
@@ -903,28 +932,40 @@ Android, Plugin, dashboard, and desktop now have separate CI/release lanes.
|
||||
This keeps a dashboard CSS fix from running the full server suite, and keeps
|
||||
plugin changes from forcing an Android app `versionCode` bump.
|
||||
|
||||
Every successful `Required checks` run records a short-lived proof keyed to the
|
||||
checked Git tree. For the canonical `dev` → `main` release PR, CI first proves
|
||||
the simulated merge tree is identical to the `dev` tree. If an unexpired proof
|
||||
from a successful Required-checks run exists, the PR verifies and reuses it;
|
||||
otherwise it automatically falls back to the normal path-aware matrix. Content
|
||||
changes can never reuse an older proof because they change the tree hash.
|
||||
|
||||
On every push of a tag matching `android-v*`, `.github/workflows/release-android.yml`:
|
||||
|
||||
1. Verifies a stable tag resolves to a commit contained in `main`, or a
|
||||
prerelease tag resolves to a commit contained in `dev`, and that the tag matches `appVersionName` in
|
||||
`gradle/libs.versions.toml` (mismatches fail the workflow).
|
||||
2. Runs the Android debug build and the stable sideload pairing/connection
|
||||
regression slice with explicit timeouts.
|
||||
3. Decodes `HERMES_KEYSTORE_BASE64` into `$RUNNER_TEMP/release.keystore`
|
||||
and exports `HERMES_KEYSTORE_PATH` (skipped if the secret is unset).
|
||||
4. For stable releases, builds all four flavored release artifacts
|
||||
(`./gradlew bundleRelease assembleRelease`); only the sideload APK and
|
||||
googlePlay AAB are attached. For prereleases, builds only the side-by-side
|
||||
`sideloadCandidate` APK.
|
||||
5. Generates `SHA256SUMS.txt` covering the two attached files.
|
||||
6. For stable releases only, promotes the exact preflighted Production draft to
|
||||
2. For stable releases, verifies and downloads the exact immutable Play
|
||||
preflight artifact; prereleases run the focused CI slice and build the
|
||||
side-by-side `sideloadCandidate` APK.
|
||||
3. Revalidates stable artifact hashes, DEX collection compatibility, packaged
|
||||
native compatibility, and retained R8 mappings without recompiling.
|
||||
4. Generates candidate checksums when applicable; stable checksums come from
|
||||
the verified preflight artifact and cover the two public files.
|
||||
5. For stable releases only, promotes the exact preflighted Production draft to
|
||||
`completed`; prereleases never upload to Play.
|
||||
7. Creates a GitHub Release named `Hermes-Relay Android v<version>` with `RELEASE_NOTES.md` as
|
||||
6. Creates a GitHub Release named `Hermes-Relay Android v<version>` with `RELEASE_NOTES.md` as
|
||||
the body. Attaches the APK, AAB, and `SHA256SUMS.txt`. Tags any version
|
||||
containing a dash (e.g. `android-v0.2.0-beta.1`) as a prerelease automatically.
|
||||
8. Prints a `$GITHUB_STEP_SUMMARY` with the release and Play result.
|
||||
7. Prints a `$GITHUB_STEP_SUMMARY` with the release and Play result.
|
||||
|
||||
On every push of a tag matching `server-v*`,
|
||||
For an approved multi-surface train, run **Hermes-Relay Coordinated Release
|
||||
Approval** from `main`, select the affected surfaces, and enter their prepared
|
||||
versions. It dispatches Android, Plugin, and CLI+UI approval jobs concurrently;
|
||||
each surface keeps its independent source, validation, tag, artifact, and
|
||||
publication workflow.
|
||||
|
||||
On every direct push of a tag matching `server-v*`, or after an approved
|
||||
dispatch from `.github/workflows/approve-release-extensions.yml`,
|
||||
`.github/workflows/release-plugin.yml`:
|
||||
|
||||
1. Verifies a stable tag commit is contained in `main`, or a prerelease tag is
|
||||
@@ -937,7 +978,8 @@ On every push of a tag matching `server-v*`,
|
||||
5. Creates a GitHub Release named `Hermes-Relay Plugin v<version>` with the wheel,
|
||||
sdist, and checksum file attached.
|
||||
|
||||
On every push of a tag matching `desktop-v*`,
|
||||
On every direct push of a tag matching `desktop-v*`, or after an approved
|
||||
dispatch from `.github/workflows/approve-release-extensions.yml`,
|
||||
`.github/workflows/release-cli.yml` builds and publishes the CLI binaries and
|
||||
Windows tray installer. Its GitHub Release body comes from `CLI_RELEASE_NOTES.md`
|
||||
(rewritten per release — the CLI counterpart of `RELEASE_NOTES.md`); the workflow
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Hermes-Relay Android v1.14.0
|
||||
# Hermes-Relay Android v1.15.0
|
||||
|
||||
**Release Date:** August 30, 2026
|
||||
**Release Date:** August 31, 2026
|
||||
|
||||
## Download
|
||||
|
||||
> Installing on your phone? Download `hermes-relay-1.14.0-sideload-release.apk` and tap it for the full feature set, or install the conservative build from [Google Play](https://play.google.com/store/apps/details?id=com.axiomlabs.hermesrelay).
|
||||
> Installing on your phone? Download `hermes-relay-1.15.0-sideload-release.apk` and tap it for the full feature set, or install the conservative build from [Google Play](https://play.google.com/store/apps/details?id=com.axiomlabs.hermesrelay).
|
||||
|
||||
The `.aab` file is a Play Console upload bundle and cannot be installed by tapping it on a phone.
|
||||
|
||||
@@ -12,33 +12,32 @@ Verify the download against `SHA256SUMS.txt`. See the [sideload guide](https://h
|
||||
|
||||
## Summary
|
||||
|
||||
This release makes saved Hermes connections reliable across LAN, Tailscale, and public HTTPS while keeping Dashboard authentication bound to its exact trusted origin. It also adds delegated-agent previews and an optional native Git workspace, and improves Voice, Assistant, Threads, profile drafts, and Clarify interactions.
|
||||
|
||||
## Added
|
||||
|
||||
- **Delegated-agent previews.** Follow bounded lifecycle, progress, tool previews, and available read-only child history without leaving the parent chat. Partial history and reconnect gaps remain explicit. (#447)
|
||||
- **Native Git workspace.** Review repository state, diffs, branches, staging, commits, and remotes from Chat or Settings. Git operations require Hermes-Relay Plugin v1.11.0 and retain confirmation and grant boundaries.
|
||||
This release makes the everyday Android experience work through current upstream Hermes without treating the optional Hermes-Relay Plugin as a prerequisite. It also strengthens parent access, cross-client activity, transport ownership, recovery, and release visibility.
|
||||
|
||||
## Changed
|
||||
|
||||
- **Route-aware connections.** Dashboard, Relay, and optional API health are evaluated independently across LAN, Tailscale, and public HTTPS. Same-origin Relay ingress stays on the Dashboard origin that owns authentication, while direct compatibility routes keep separate credentials. (Related: #399)
|
||||
- **Voice Focus controls.** Stop and immediate spoken steering remain accessible while Hermes is Thinking, Transcribing, or Speaking, including TalkBack, Switch Access, keyboard, and sideload overlay surfaces.
|
||||
- **Upstream-first standard surfaces.** Chat attachments, inbound host files, current-session Git reads, Nous usage bars, and keyed Hermes notices use authenticated Dashboard/Gateway contracts first. Relay remains an additive compatibility and enhancement layer.
|
||||
- **Clear Settings ownership.** Media sits with Chat and Voice under Hermes. Proactive Threads, Terminal, Notification Companion, Relay sessions, enhanced voice, and Device Control stay grouped under Relay tools.
|
||||
- **App-specific supervised parent access.** Parents choose a PIN or password and receive a six-word recovery phrase; Android device credentials and biometrics no longer grant parent authority.
|
||||
- **Complete What's New history.** Release highlights, the remaining improvements and fixes, compatibility notes, toast counts, and history now come from one structured inventory.
|
||||
|
||||
## Fixed
|
||||
|
||||
- Wake-word detection packages one compatible ONNX Runtime for sherpa and Java JNI on every supported ABI. (#444)
|
||||
- Continuous voice waits for barge-in microphone teardown before listening again. (#464)
|
||||
- Fresh chats retain their selected profile without reopening a previous session or carrying a proactive Thread route across profiles. (#436)
|
||||
- Provisional Threads can be removed locally and reconcile with promoted sessions without deleting server history. (#461)
|
||||
- Clarify cards expose a reachable Other answer, keyboard Send, and authoritative expiry behavior. (#446)
|
||||
- Passive Android browsing no longer claims or interrupts a turn owned by another client. (Related: #365)
|
||||
- Assistant sessions show retryable no-speech feedback, recover their active state after recreation, and redact conversation details behind the keyguard. (Related: #424)
|
||||
- Protected Relay ingress `401/403` responses are recognized as authentication boundaries rather than outages; malformed, different-origin, and direct unauthorized routes still fail closed.
|
||||
- Host-local images, audio, video, and files download through the authenticated Dashboard and remain loaded across history reconciliation instead of flashing `Relay URL not configured` or returning to Loading.
|
||||
- Standard voice remains usable after explicit Relay removal, while temporary Relay outages preserve configured choices and default-profile preferences stay isolated across connections.
|
||||
- Android can display uniquely matched Desktop/TUI Working and Waiting activity without resuming, activating, or interrupting the external turn.
|
||||
- Dashboard/Gateway chats preserve their transcript, draft, profile, and session through sign-out or outages instead of silently changing to Direct API.
|
||||
- Completed text survives Dashboard-history authentication expiry and returns the existing sign-in recovery path.
|
||||
- Long-running context compaction refreshes the turn watchdog instead of being interrupted as idle.
|
||||
- Bot Chat history renders immediately after its route-owned handler binds.
|
||||
- An exact idle live-session snapshot settles an Android-owned turn whose terminal frame was lost, reconciles history, and drains its queued follow-up.
|
||||
- Supervised Add Gateway remains parent-owned across relock, back navigation, and pending setup cancellation.
|
||||
- Completed generated images stay visible during marker persistence lag and retain the intended image-generation presentation.
|
||||
|
||||
## Install / Verify
|
||||
|
||||
- App version: **1.14.0** (versionCode **52**).
|
||||
- Standard Chat, sessions, profiles, Manage, and standard voice continue to work against unmodified upstream Hermes without the optional Relay plugin.
|
||||
- Install Hermes-Relay Plugin v1.11.0 for same-origin Relay extensions, Git workspace actions, Bridge, media, proactive features, and enhanced voice.
|
||||
- App version: **1.15.0** (versionCode **53**).
|
||||
- Standard Chat, sessions, profiles, Manage, standard voice, outbound attachments, and ordinary inbound files work against current unmodified upstream Hermes without the optional Hermes-Relay Plugin.
|
||||
- Install Hermes-Relay Plugin v1.11.1 for Terminal, proactive Threads/offline delivery, Notification Companion, Relay sessions, provider-native/realtime voice, compatibility media metadata, Secure Link, and phone/device control.
|
||||
- Explicit Direct API/API-only connections remain supported and are never used as a silent failover for a Dashboard-owned chat.
|
||||
- Granular Device Control and the system Voice Focus overlay remain sideload-only; the Google Play build does not declare their restricted permissions.
|
||||
- Existing connections, drafts, sessions, profile ownership, and legacy direct Relay routes remain data-preserving compatibility paths.
|
||||
|
||||
@@ -45,6 +45,32 @@ compatibility route.
|
||||
|
||||
---
|
||||
|
||||
## Upstream an Android Gateway platform hint
|
||||
|
||||
Android currently identifies its standard Gateway sessions with the legacy
|
||||
`webui` source because upstream has no stable Android/mobile session platform.
|
||||
Current upstream deliberately removed the unused `webui` prompt hint and only
|
||||
ships renderer-verified `desktop` and `tui` guidance. Do not relabel Android as
|
||||
Desktop: that would also advertise Desktop-only inline widgets and directives.
|
||||
Propose an upstream Android/mobile platform hint, or a bounded authenticated
|
||||
client-surface context contract, that accurately describes mobile Markdown,
|
||||
standard upstream media/file delivery, and concise-response expectations. Once
|
||||
that contract is available in the supported Hermes baseline, adopt it and add
|
||||
Gateway conformance coverage proving the exact prompt bytes and session source.
|
||||
|
||||
---
|
||||
|
||||
## Scope sensitive-media prompt guidance to capable clients
|
||||
|
||||
The Relay plugin's sensitive-media prompt section currently describes the
|
||||
Android `||||` and alt-text conventions profile-wide. Before
|
||||
expanding that behavior, make the section depend on an authoritative client
|
||||
capability or replace it with a portable convention verified against every
|
||||
renderer that receives the profile prompt. Do not make Desktop/TUI sessions
|
||||
emit Android-only spoiler syntax merely because the Relay plugin is installed.
|
||||
|
||||
---
|
||||
|
||||
## Certify Android session activity across lifecycle and profile boundaries
|
||||
|
||||
The contract fixture now covers every upstream live status, complete-snapshot
|
||||
@@ -53,8 +79,11 @@ and older Gateways without `session.active_list`. Before calling the status
|
||||
model device-certified:
|
||||
|
||||
- Exercise working, quiet tool-heavy work, each pending-input surface, normal
|
||||
completion, Stop, reconnect, app restart, and process recreation against
|
||||
current vanilla upstream.
|
||||
completion, a lost terminal followed by an exact active-list Idle row, Stop,
|
||||
reconnect, app restart, and process recreation against current vanilla
|
||||
upstream. Confirm the lost-terminal path preserves the partial transcript,
|
||||
settles composer/steering state, and drains or cancels queued corrections
|
||||
exactly once according to the owning turn outcome.
|
||||
- Verify All Profiles with duplicate session ids across two profiles and two
|
||||
saved connections; no late snapshot or old socket generation may mark the
|
||||
wrong row live.
|
||||
|
||||
@@ -258,6 +258,46 @@ class GatewayForegroundRecoveryInstrumentedTest {
|
||||
assertEquals(0, fixture.requestsTo("/v1/chat/completions"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun terminalGapActiveList_settlesExactOwnedTurnAndRendersAuthoritativeHistory() {
|
||||
viewModel.sendMessage("Run an Android-owned task")
|
||||
fixture.awaitRpc("prompt.submit")
|
||||
serverSocket.send(fixture.event("message.start", null, LIVE_SESSION_ID))
|
||||
serverSocket.send(
|
||||
fixture.event(
|
||||
"message.delta",
|
||||
buildJsonObject { put("text", PARTIAL_ANSWER) },
|
||||
LIVE_SESSION_ID,
|
||||
),
|
||||
)
|
||||
compose.waitUntil(5_000) { handler.isStreaming.value }
|
||||
compose.onNodeWithTag("stream-state").assertTextEquals("STREAMING")
|
||||
|
||||
persistedHistory = listOf(
|
||||
MessageItem(
|
||||
id = PERSISTED_ANSWER_ID,
|
||||
sessionId = STORED_SESSION_ID,
|
||||
role = "assistant",
|
||||
content = JsonPrimitive(AUTHORITATIVE_ANSWER),
|
||||
),
|
||||
)
|
||||
fixture.activeSessionStatus = "idle"
|
||||
runBlocking { gatewayClient.listActiveSessions() }
|
||||
|
||||
compose.waitUntil(5_000) {
|
||||
!handler.isStreaming.value &&
|
||||
!gatewayClient.hasActiveTurn() &&
|
||||
handler.messages.value.singleOrNull()?.id == PERSISTED_ANSWER_ID
|
||||
}
|
||||
compose.onNodeWithTag("stream-state").assertTextEquals("IDLE")
|
||||
compose.onNodeWithTag("message-$PERSISTED_ANSWER_ID")
|
||||
.assertTextEquals("${MessageRole.ASSISTANT.name}:$AUTHORITATIVE_ANSWER")
|
||||
assertEquals(1, fixture.rpcCount("prompt.submit"))
|
||||
assertEquals(0, fixture.rpcCount("session.interrupt"))
|
||||
assertEquals(0, fixture.rpcCount("session.activate"))
|
||||
assertEquals(0, fixture.requestsTo("/v1/chat/completions"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun desktopOwnedTurn_remainsReadOnlyAcrossAndroidForegroundLifecycle() {
|
||||
viewModel.setChatVisible(false)
|
||||
|
||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 509 KiB |
@@ -1,3 +1,3 @@
|
||||
v1.14.0 - Connections, delegated work, Git, and voice
|
||||
v1.15.0 - Standard Hermes first, with clearer Relay boundaries
|
||||
|
||||
Connections now recover independently across LAN, Tailscale, and public HTTPS without mixing Dashboard and Relay authentication. Preview delegated agents, use the optional native Git workspace, and get safer Continuous voice, Voice Focus, Assistant, Threads, profile drafts, and Clarify controls. Wake-word detection also packages a compatible native runtime.
|
||||
Standard Chat, Voice, attachments, returned files, current-session Git, usage, and Hermes notices now prefer upstream Dashboard and Gateway support without requiring Relay. Returned media stays loaded, voice survives Relay removal, and Settings clearly separates standard Hermes from Relay tools. Supervised Mode also gains app-specific parent access and recovery.
|
||||
|
||||
@@ -1,6 +1,108 @@
|
||||
{
|
||||
"schema": 3,
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.15.0",
|
||||
"title": "Standard Hermes first, with clearer Relay boundaries",
|
||||
"date": "2026-08-31",
|
||||
"summary": "Chat, voice, attachments, inbound files, current-session Git, usage, and Hermes notices now prefer current upstream Dashboard and Gateway support. Relay stays optional for compatibility and the tools it uniquely provides.",
|
||||
"changes": [
|
||||
{
|
||||
"id": "upstream-standard-surfaces",
|
||||
"kind": "improved",
|
||||
"title": "Use standard Hermes without Relay prompts",
|
||||
"summary": "Chat attachments, inbound files, current-session Git, Nous usage, and Hermes notices use upstream routes first.",
|
||||
"highlight": true
|
||||
},
|
||||
{
|
||||
"id": "stable-inbound-media",
|
||||
"kind": "fixed",
|
||||
"title": "Keep returned files loaded",
|
||||
"summary": "Images, audio, video, and documents download through the Dashboard and no longer flash Relay errors or return to Loading.",
|
||||
"highlight": true
|
||||
},
|
||||
{
|
||||
"id": "supervised-parent-access",
|
||||
"kind": "improved",
|
||||
"title": "Use app-specific parent access",
|
||||
"summary": "A parent PIN or password plus recovery phrase protects Supervised Mode without trusting the phone unlock credential.",
|
||||
"highlight": true
|
||||
},
|
||||
{
|
||||
"id": "settings-relay-boundaries",
|
||||
"kind": "improved",
|
||||
"title": "See which features need Relay",
|
||||
"summary": "Media sits with standard Hermes settings while Threads, Terminal, notifications, enhanced voice, and device tools stay under Relay tools."
|
||||
},
|
||||
{
|
||||
"id": "complete-release-history",
|
||||
"kind": "improved",
|
||||
"title": "Read the complete release record",
|
||||
"summary": "What's New shows one release summary, selected highlights, every remaining change, and relevant compatibility notes."
|
||||
},
|
||||
{
|
||||
"id": "relay-removal-voice",
|
||||
"kind": "fixed",
|
||||
"title": "Keep Standard voice after removing Relay",
|
||||
"summary": "Dashboard voice remains ready, temporary outages preserve choices, and shared default-profile settings stay isolated."
|
||||
},
|
||||
{
|
||||
"id": "passive-external-activity",
|
||||
"kind": "fixed",
|
||||
"title": "Observe another client's activity safely",
|
||||
"summary": "A uniquely matched Desktop or TUI turn can show Working or Waiting without Android taking control."
|
||||
},
|
||||
{
|
||||
"id": "chat-transport-ownership",
|
||||
"kind": "fixed",
|
||||
"title": "Keep each chat on its chosen transport",
|
||||
"summary": "Dashboard chats preserve their transcript, draft, profile, and session through sign-out or outages instead of silently changing databases."
|
||||
},
|
||||
{
|
||||
"id": "history-auth-recovery",
|
||||
"kind": "fixed",
|
||||
"title": "Preserve completed replies at sign-in expiry",
|
||||
"summary": "A Dashboard history authentication failure keeps completed text visible and opens the existing sign-in recovery path."
|
||||
},
|
||||
{
|
||||
"id": "compaction-watchdog",
|
||||
"kind": "fixed",
|
||||
"title": "Let long context compaction finish",
|
||||
"summary": "Visible compaction activity refreshes the turn watchdog instead of being interrupted as idle."
|
||||
},
|
||||
{
|
||||
"id": "bot-chat-binding",
|
||||
"kind": "fixed",
|
||||
"title": "Render Bot Chat history immediately",
|
||||
"summary": "Route-owned Bot Chats observe their bound history from first composition."
|
||||
},
|
||||
{
|
||||
"id": "missing-terminal-recovery",
|
||||
"kind": "fixed",
|
||||
"title": "Settle turns after a lost terminal frame",
|
||||
"summary": "An exact idle live-session snapshot reconciles the Android-owned turn and drains its queued follow-up."
|
||||
},
|
||||
{
|
||||
"id": "supervised-gateway-setup",
|
||||
"kind": "fixed",
|
||||
"title": "Keep Gateway setup parent-owned",
|
||||
"summary": "Relock and back navigation cancel the exact pending setup without bypassing parent authority."
|
||||
},
|
||||
{
|
||||
"id": "generated-image-retention",
|
||||
"kind": "fixed",
|
||||
"title": "Keep completed generated images visible",
|
||||
"summary": "Generated media survives marker persistence lag and retains its intended Chat animation."
|
||||
}
|
||||
],
|
||||
"compatibility": [
|
||||
"Current upstream Hermes provides standard Chat, sessions, Manage, voice, attachments, inbound files, current-session Git reads, usage, and notices without the optional Hermes-Relay Plugin.",
|
||||
"Hermes-Relay Plugin 1.11.1 remains required for Terminal, proactive Threads and offline delivery, Notification Companion, Relay sessions, enhanced voice, Secure Link, and phone or device control.",
|
||||
"Granular Device Control and the system Voice Focus overlay remain sideload-only."
|
||||
],
|
||||
"playNotes": "Standard Chat, Voice, attachments, returned files, current-session Git, usage, and Hermes notices now prefer upstream Dashboard and Gateway support without requiring Relay. Returned media stays loaded, voice survives Relay removal, and Settings clearly separates standard Hermes from Relay tools. Supervised Mode also gains app-specific parent access and recovery.",
|
||||
"sections": []
|
||||
},
|
||||
{
|
||||
"version": "1.14.0",
|
||||
"title": "Connections, delegated work, Git, and voice",
|
||||
|
||||
@@ -1,31 +1,29 @@
|
||||
v1.14.0 - Connections, delegated work, Git, and voice
|
||||
v1.15.0 - Standard Hermes first, with clearer Relay boundaries
|
||||
|
||||
Summary
|
||||
* Connections now recover cleanly across networks. You can also follow delegated agents, work with Git repositories, and rely on steadier voice, sessions, Threads, profiles, Assistant, and Clarify controls.
|
||||
* Chat, voice, attachments, inbound files, current-session Git, usage, and Hermes notices now prefer current upstream Dashboard and Gateway support. Relay stays optional for compatibility and the tools it uniquely provides.
|
||||
|
||||
Highlights
|
||||
* Connections recover independently — Move between LAN, Tailscale, and public HTTPS without mixing Dashboard and Relay authentication.
|
||||
* Follow delegated-agent activity — See lifecycle, progress, tool previews, and available read-only child history from the parent chat.
|
||||
* Work with repositories from Android — Review status, diffs, branches, staging, commits, and remotes from Chat or Settings.
|
||||
* Steer voice at any time — Stop or redirect Hermes while it is Thinking, Transcribing, or Speaking, including with accessibility controls.
|
||||
* Use standard Hermes without Relay prompts — Chat attachments, inbound files, current-session Git, Nous usage, and Hermes notices use upstream routes first.
|
||||
* Keep returned files loaded — Images, audio, video, and documents download through the Dashboard and no longer flash Relay errors or return to Loading.
|
||||
* Use app-specific parent access — A parent PIN or password plus recovery phrase protects Supervised Mode without trusting the phone unlock credential.
|
||||
|
||||
Improved
|
||||
* Release notes stay out of your way — A dismissible post-update notice keeps startup usable and leaves the complete history available from Settings.
|
||||
* Chat uses one consistent presentation — The overlapping clean-focus mode was removed while the separate Voice Focus experience remains available.
|
||||
* See which features need Relay — Media sits with standard Hermes settings while Threads, Terminal, notifications, enhanced voice, and device tools stay under Relay tools.
|
||||
* Read the complete release record — What's New shows one release summary, selected highlights, every remaining change, and relevant compatibility notes.
|
||||
|
||||
Fixed
|
||||
* Wake-word detection starts reliably — Compatible native voice components are now packaged for every supported phone architecture.
|
||||
* The visible Sphere keeps moving smoothly — Foreground animation no longer falls back to a stepped ambient pulse.
|
||||
* Continuous voice keeps the microphone — The next listening turn waits for barge-in recording to release cleanly.
|
||||
* New chats keep the selected profile — Fresh drafts no longer reopen an older session or carry a Thread route into another profile.
|
||||
* Provisional Threads can be removed safely — Local removal and later session promotion no longer risk duplicate rows or server history.
|
||||
* Clarify keeps custom answers reachable — Other answers, keyboard Send, and expired prompts now behave consistently.
|
||||
* Browsing no longer interrupts another client — Passive Android observation does not claim a turn owned by Desktop, TUI, or another client.
|
||||
* Assistant sessions recover more clearly — No-speech feedback, recreated session state, and keyguard privacy now remain intact.
|
||||
* Protected Relay routes report the right problem — Authentication challenges are no longer presented as outages, while unsafe routes still fail closed.
|
||||
* Connections and sessions become ready sooner — Unavailable optional API and Relay routes no longer delay a healthy Dashboard or authenticated session history.
|
||||
* Keep Standard voice after removing Relay — Dashboard voice remains ready, temporary outages preserve choices, and shared default-profile settings stay isolated.
|
||||
* Observe another client's activity safely — A uniquely matched Desktop or TUI turn can show Working or Waiting without Android taking control.
|
||||
* Keep each chat on its chosen transport — Dashboard chats preserve their transcript, draft, profile, and session through sign-out or outages instead of silently changing databases.
|
||||
* Preserve completed replies at sign-in expiry — A Dashboard history authentication failure keeps completed text visible and opens the existing sign-in recovery path.
|
||||
* Let long context compaction finish — Visible compaction activity refreshes the turn watchdog instead of being interrupted as idle.
|
||||
* Render Bot Chat history immediately — Route-owned Bot Chats observe their bound history from first composition.
|
||||
* Settle turns after a lost terminal frame — An exact idle live-session snapshot reconciles the Android-owned turn and drains its queued follow-up.
|
||||
* Keep Gateway setup parent-owned — Relock and back navigation cancel the exact pending setup without bypassing parent authority.
|
||||
* Keep completed generated images visible — Generated media survives marker persistence lag and retains its intended Chat animation.
|
||||
|
||||
Compatibility
|
||||
* Standard Chat, sessions, profiles, Manage, and standard voice continue to work without the optional Hermes-Relay Plugin.
|
||||
* The Git workspace and same-origin Relay extensions require Hermes-Relay Plugin 1.11.0.
|
||||
* Granular Device Control and the system Voice Focus overlay remain available only in the sideload build.
|
||||
* Current upstream Hermes provides standard Chat, sessions, Manage, voice, attachments, inbound files, current-session Git reads, usage, and notices without the optional Hermes-Relay Plugin.
|
||||
* Hermes-Relay Plugin 1.11.1 remains required for Terminal, proactive Threads and offline delivery, Notification Companion, Relay sessions, enhanced voice, Secure Link, and phone or device control.
|
||||
* Granular Device Control and the system Voice Focus overlay remain sideload-only.
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.hermesandroid.relay.data
|
||||
|
||||
import com.hermesandroid.relay.network.upstream.DashboardApiClient
|
||||
import com.hermesandroid.relay.network.upstream.DashboardHttpException
|
||||
import com.hermesandroid.relay.plugins.runtime.ScopedPluginApiClient
|
||||
import java.io.IOException
|
||||
import java.net.URLEncoder
|
||||
import java.util.Locale
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.buildJsonArray
|
||||
@@ -9,113 +15,178 @@ import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.decodeFromJsonElement
|
||||
import kotlinx.serialization.json.put
|
||||
|
||||
// Read + write client for the Hermes-Relay Git State endpoints.
|
||||
// All requests are confined to the ``hermes-relay`` plugin namespace and the
|
||||
// ``git/*`` sub-path via ScopedPluginApiClient, which rejects traversal and
|
||||
// encodes query values.
|
||||
|
||||
private fun pathsArray(paths: List<String>) = buildJsonArray { paths.forEach { add(JsonPrimitive(it)) } }
|
||||
|
||||
/**
|
||||
* Uses official Dashboard `/api/git/…` reads for the active session repository.
|
||||
* Relay remains the discovery source and owns stronger write/preview extensions.
|
||||
* Operational upstream failures are never hidden by a Relay retry; only a 404
|
||||
* can fall back to a matching Relay-discovered repository.
|
||||
*/
|
||||
class GitStateApiClient(
|
||||
dashboard: DashboardApiClient,
|
||||
private val dashboard: DashboardApiClient,
|
||||
) {
|
||||
private val scoped = ScopedPluginApiClient("hermes-relay", dashboard)
|
||||
private val json = Json { ignoreUnknownKeys = true }
|
||||
private val reposById = linkedMapOf<String, GitRepo>()
|
||||
private val relayRepoIdsByRoot = linkedMapOf<String, String>()
|
||||
|
||||
suspend fun repos(): Result<List<GitRepo>> = scoped
|
||||
.get("git/repos")
|
||||
.mapCatching { element ->
|
||||
json.decodeFromJsonElement<ReposResponse>(element).repos
|
||||
suspend fun repos(
|
||||
sessionRepoPath: String? = null,
|
||||
includeRelayDiscovery: Boolean = true,
|
||||
): Result<List<GitRepo>> {
|
||||
reposById.clear()
|
||||
relayRepoIdsByRoot.clear()
|
||||
val path = sessionRepoPath?.trim().orEmpty()
|
||||
if (path.isBlank()) {
|
||||
return if (includeRelayDiscovery) relayRepos().onSuccess(::rememberRepos)
|
||||
else Result.success(emptyList())
|
||||
}
|
||||
|
||||
suspend fun status(repo: String): Result<GitStatus> = scoped
|
||||
.get("git/status", mapOf("repo" to repo))
|
||||
.mapCatching { element -> json.decodeFromJsonElement<GitStatus>(element) }
|
||||
|
||||
suspend fun branches(repo: String): Result<List<GitBranch>> = scoped
|
||||
.get("git/branches", mapOf("repo" to repo))
|
||||
.mapCatching { element ->
|
||||
json.decodeFromJsonElement<BranchesResponse>(element).branches
|
||||
val upstream = upstreamStatus(path)
|
||||
if (upstream.isFailure) {
|
||||
val error = upstream.exceptionOrNull()!!
|
||||
if (!error.isUnsupportedGitRoute()) return Result.failure(error)
|
||||
return if (includeRelayDiscovery) relayRepos().onSuccess(::rememberRepos)
|
||||
else Result.failure(error)
|
||||
}
|
||||
val status = upstream.getOrNull()
|
||||
if (status == null) {
|
||||
return if (includeRelayDiscovery) relayRepos().onSuccess(::rememberRepos)
|
||||
else Result.success(emptyList())
|
||||
}
|
||||
|
||||
suspend fun diff(repo: String, path: String, kind: String): Result<GitDiff> = scoped
|
||||
.get("git/diff", mapOf("repo" to repo, "path" to path, "kind" to kind))
|
||||
.mapCatching { element -> json.decodeFromJsonElement<GitDiff>(element) }
|
||||
val standardRepo = GitRepo(
|
||||
id = UPSTREAM_SESSION_REPO_ID,
|
||||
name = path.replace('\\', '/').trimEnd('/').substringAfterLast('/').ifBlank { path },
|
||||
root = path,
|
||||
currentBranch = status.branch,
|
||||
dirty = status.changed > 0,
|
||||
route = GitRepositoryRoute.UPSTREAM,
|
||||
)
|
||||
|
||||
suspend fun file(repo: String, path: String): Result<GitFile> = scoped
|
||||
.get("git/file", mapOf("repo" to repo, "path" to path))
|
||||
.mapCatching { element -> json.decodeFromJsonElement<GitFile>(element) }
|
||||
// Plugin discovery is an enhancement. Once upstream answered, plugin
|
||||
// absence or breakage cannot take the standard session repository down.
|
||||
val relay = if (includeRelayDiscovery) relayRepos().getOrDefault(emptyList()) else emptyList()
|
||||
val merged = buildList {
|
||||
add(standardRepo)
|
||||
addAll(relay.filterNot { sameRoot(it.root, standardRepo.root) })
|
||||
}
|
||||
rememberRepos(merged)
|
||||
rememberRelayRepos(relay)
|
||||
return Result.success(merged)
|
||||
}
|
||||
|
||||
// ── Write operations ───────────────────────────────────────────────────
|
||||
// Every write requires the plugin.api.write grant, which the app enforces
|
||||
// (see GitStateViewModel: a POST is never sent without the grant). The
|
||||
// server additionally enforces per-use confirmation strings for destructive
|
||||
// ops (discard/push/dirty-checkout) — the caller passes the echoed token.
|
||||
suspend fun status(repo: String): Result<GitStatus> {
|
||||
val target = reposById[repo]
|
||||
if (target?.route != GitRepositoryRoute.UPSTREAM) return relayStatus(repo)
|
||||
return fallbackOnUnsupported(target, upstreamStatusWithFiles(target.root), ::relayStatus)
|
||||
}
|
||||
|
||||
suspend fun branches(repo: String): Result<List<GitBranch>> {
|
||||
val target = reposById[repo]
|
||||
if (target?.route != GitRepositoryRoute.UPSTREAM) return relayBranches(repo)
|
||||
return fallbackOnUnsupported(target, upstreamBranches(target.root), ::relayBranches)
|
||||
}
|
||||
|
||||
suspend fun diff(repo: String, path: String, kind: String): Result<GitDiff> {
|
||||
val target = reposById[repo]
|
||||
if (target?.route != GitRepositoryRoute.UPSTREAM) return relayDiff(repo, path, kind)
|
||||
val upstream = dashboard.getJsonElement(
|
||||
upstreamPath(
|
||||
"/api/git/review/diff",
|
||||
mapOf(
|
||||
"path" to target.root,
|
||||
"file" to path,
|
||||
"scope" to "uncommitted",
|
||||
"staged" to (kind == "staged").toString(),
|
||||
),
|
||||
),
|
||||
).mapCatching { element ->
|
||||
GitDiff(
|
||||
path = path,
|
||||
kind = kind,
|
||||
diff = json.decodeFromJsonElement<UpstreamDiffResponse>(element).diff,
|
||||
)
|
||||
}
|
||||
return fallbackOnUnsupported(target, upstream) { relay -> relayDiff(relay, path, kind) }
|
||||
}
|
||||
|
||||
/** Clean tracked-file preview is a Relay enhancement; file-diff is not equivalent. */
|
||||
suspend fun file(repo: String, path: String): Result<GitFile> {
|
||||
val relay = relayRepoId(repo)
|
||||
?: return Result.failure(IOException("Tracked-file preview requires the Relay plugin"))
|
||||
return relayFile(relay, path)
|
||||
}
|
||||
|
||||
// Writes intentionally stay on Relay. The upstream Desktop mutation shape
|
||||
// does not carry plugin.api.write or the server-enforced confirmation echoes
|
||||
// used by this mobile surface, so it is not an equivalent safety contract.
|
||||
|
||||
suspend fun stage(repo: String, paths: List<String>): Result<GitMutationResult> =
|
||||
scoped.post("git/stage", buildJsonObject {
|
||||
put("repo", repo)
|
||||
relayWrite(repo) { relay -> scoped.post("git/stage", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("paths", pathsArray(paths))
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun unstage(repo: String, paths: List<String>): Result<GitMutationResult> =
|
||||
scoped.post("git/unstage", buildJsonObject {
|
||||
put("repo", repo)
|
||||
relayWrite(repo) { relay -> scoped.post("git/unstage", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("paths", pathsArray(paths))
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun discard(
|
||||
repo: String,
|
||||
paths: List<String>,
|
||||
confirmation: String,
|
||||
deleteUntracked: Boolean = false,
|
||||
): Result<GitMutationResult> = scoped.post("git/discard", buildJsonObject {
|
||||
put("repo", repo)
|
||||
): Result<GitMutationResult> = relayWrite(repo) { relay -> scoped.post("git/discard", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("paths", pathsArray(paths))
|
||||
put("confirmation", confirmation)
|
||||
put("delete_untracked", deleteUntracked)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun commit(repo: String, message: String): Result<GitMutationResult> =
|
||||
scoped.post("git/commit", buildJsonObject {
|
||||
put("repo", repo)
|
||||
relayWrite(repo) { relay -> scoped.post("git/commit", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("message", message)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun commitSelected(
|
||||
repo: String,
|
||||
message: String,
|
||||
paths: List<String>,
|
||||
): Result<GitMutationResult> = scoped.post("git/commit_selected", buildJsonObject {
|
||||
put("repo", repo)
|
||||
): Result<GitMutationResult> = relayWrite(repo) { relay -> scoped.post("git/commit_selected", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("message", message)
|
||||
put("paths", pathsArray(paths))
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun fetch(repo: String, remote: String = "origin"): Result<GitMutationResult> =
|
||||
scoped.post("git/fetch", buildJsonObject {
|
||||
put("repo", repo)
|
||||
relayWrite(repo) { relay -> scoped.post("git/fetch", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("remote", remote)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun pull(repo: String, remote: String = "origin", branch: String = ""): Result<GitMutationResult> =
|
||||
scoped.post("git/pull", buildJsonObject {
|
||||
put("repo", repo)
|
||||
relayWrite(repo) { relay -> scoped.post("git/pull", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("remote", remote)
|
||||
put("branch", branch)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun push(
|
||||
repo: String,
|
||||
confirmation: String,
|
||||
remote: String = "origin",
|
||||
branch: String = "",
|
||||
): Result<GitMutationResult> = scoped.post("git/push", buildJsonObject {
|
||||
put("repo", repo)
|
||||
): Result<GitMutationResult> = relayWrite(repo) { relay -> scoped.post("git/push", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("remote", remote)
|
||||
put("branch", branch)
|
||||
put("confirmation", confirmation)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
suspend fun checkout(
|
||||
repo: String,
|
||||
@@ -123,41 +194,217 @@ class GitStateApiClient(
|
||||
confirmation: String? = null,
|
||||
newBranch: String = "",
|
||||
track: Boolean = false,
|
||||
): Result<GitMutationResult> = scoped.post("git/checkout", buildJsonObject {
|
||||
put("repo", repo)
|
||||
): Result<GitMutationResult> = relayWrite(repo) { relay -> scoped.post("git/checkout", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("ref", ref)
|
||||
if (confirmation != null) put("confirmation", confirmation)
|
||||
if (newBranch.isNotEmpty()) put("new_branch", newBranch)
|
||||
put("track", track)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
}).decodeMutation() }
|
||||
|
||||
// ── Phase 3 extras ─────────────────────────────────────────────────────
|
||||
suspend fun commitMessage(repo: String): Result<GitCommitMessage> = relayWrite(repo) { relay ->
|
||||
scoped.post("git/commit_message", buildJsonObject { put("repo", relay) })
|
||||
.mapCatching { json.decodeFromJsonElement<GitCommitMessage>(it) }
|
||||
}
|
||||
|
||||
/** Generate a commit-message suggestion from the staged diff. */
|
||||
suspend fun commitMessage(repo: String): Result<GitCommitMessage> =
|
||||
scoped.post("git/commit_message", buildJsonObject {
|
||||
put("repo", repo)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitCommitMessage>(it) }
|
||||
suspend fun commitMessageSelected(repo: String, paths: List<String>): Result<GitCommitMessage> =
|
||||
relayWrite(repo) { relay -> scoped.post("git/commit_message_selected", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("paths", pathsArray(paths))
|
||||
}).mapCatching { json.decodeFromJsonElement<GitCommitMessage>(it) } }
|
||||
|
||||
/** Generate a commit-message suggestion from the given paths' staged diff. */
|
||||
suspend fun commitMessageSelected(
|
||||
repo: String,
|
||||
paths: List<String>,
|
||||
): Result<GitCommitMessage> = scoped.post("git/commit_message_selected", buildJsonObject {
|
||||
put("repo", repo)
|
||||
put("paths", pathsArray(paths))
|
||||
}).mapCatching { json.decodeFromJsonElement<GitCommitMessage>(it) }
|
||||
|
||||
/** Checkout that auto-stashes a dirty tree first. */
|
||||
suspend fun stashCheckout(
|
||||
repo: String,
|
||||
ref: String,
|
||||
newBranch: String = "",
|
||||
track: Boolean = false,
|
||||
): Result<GitStashCheckoutResult> = scoped.post("git/stash_checkout", buildJsonObject {
|
||||
put("repo", repo)
|
||||
): Result<GitStashCheckoutResult> = relayWrite(repo) { relay -> scoped.post("git/stash_checkout", buildJsonObject {
|
||||
put("repo", relay)
|
||||
put("ref", ref)
|
||||
if (newBranch.isNotEmpty()) put("new_branch", newBranch)
|
||||
put("track", track)
|
||||
}).mapCatching { json.decodeFromJsonElement<GitStashCheckoutResult>(it) }
|
||||
}).mapCatching { json.decodeFromJsonElement<GitStashCheckoutResult>(it) } }
|
||||
|
||||
private suspend fun relayRepos(): Result<List<GitRepo>> = scoped.get("git/repos").mapCatching {
|
||||
json.decodeFromJsonElement<ReposResponse>(it).repos
|
||||
}
|
||||
|
||||
private suspend fun relayStatus(repo: String): Result<GitStatus> = scoped
|
||||
.get("git/status", mapOf("repo" to repo))
|
||||
.mapCatching { json.decodeFromJsonElement<GitStatus>(it) }
|
||||
|
||||
private suspend fun relayBranches(repo: String): Result<List<GitBranch>> = scoped
|
||||
.get("git/branches", mapOf("repo" to repo))
|
||||
.mapCatching { json.decodeFromJsonElement<BranchesResponse>(it).branches }
|
||||
|
||||
private suspend fun relayDiff(repo: String, path: String, kind: String): Result<GitDiff> = scoped
|
||||
.get("git/diff", mapOf("repo" to repo, "path" to path, "kind" to kind))
|
||||
.mapCatching { json.decodeFromJsonElement<GitDiff>(it) }
|
||||
|
||||
private suspend fun relayFile(repo: String, path: String): Result<GitFile> = scoped
|
||||
.get("git/file", mapOf("repo" to repo, "path" to path))
|
||||
.mapCatching { json.decodeFromJsonElement<GitFile>(it) }
|
||||
|
||||
private suspend fun upstreamStatus(path: String): Result<UpstreamStatus?> = dashboard
|
||||
.getJsonElement(upstreamPath("/api/git/status", mapOf("path" to path)))
|
||||
.mapCatching { json.decodeFromJsonElement<UpstreamStatus?>(it) }
|
||||
|
||||
private suspend fun upstreamStatusWithFiles(path: String): Result<GitStatus> {
|
||||
val status = upstreamStatus(path).mapCatching {
|
||||
it ?: throw IOException("The active session path is not a Git repository")
|
||||
}.getOrElse { return Result.failure(it) }
|
||||
val review = dashboard.getJsonElement(
|
||||
upstreamPath("/api/git/review/list", mapOf("path" to path, "scope" to "uncommitted")),
|
||||
).mapCatching { json.decodeFromJsonElement<UpstreamReviewList>(it) }
|
||||
.getOrElse { return Result.failure(it) }
|
||||
val statusByPath = status.files.associateBy { it.path }
|
||||
val staged = mutableListOf<GitStatusEntry>()
|
||||
val modified = mutableListOf<GitStatusEntry>()
|
||||
val untracked = mutableListOf<GitStatusEntry>()
|
||||
review.files.forEach { file ->
|
||||
val entry = GitStatusEntry(file.path, file.added, file.removed)
|
||||
val fileStatus = statusByPath[file.path]
|
||||
if (fileStatus?.untracked == true) {
|
||||
untracked += entry
|
||||
} else {
|
||||
if (file.staged || fileStatus?.staged == true) staged += entry
|
||||
if (fileStatus?.unstaged == true || (!file.staged && fileStatus == null)) {
|
||||
modified += entry
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(
|
||||
GitStatus(
|
||||
counts = GitStatusCounts(
|
||||
staged = status.staged,
|
||||
modified = status.unstaged,
|
||||
untracked = status.untracked,
|
||||
changes = status.changed,
|
||||
additions = status.added,
|
||||
deletions = status.removed,
|
||||
),
|
||||
staged = staged,
|
||||
modified = modified,
|
||||
untracked = untracked,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
private suspend fun upstreamBranches(path: String): Result<List<GitBranch>> = dashboard
|
||||
.getJsonElement(upstreamPath("/api/git/branches", mapOf("path" to path)))
|
||||
.mapCatching { element ->
|
||||
json.decodeFromJsonElement<UpstreamBranches>(element).branches.map {
|
||||
GitBranch(name = it.name, isCurrent = it.checkedOut)
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun <T> fallbackOnUnsupported(
|
||||
target: GitRepo,
|
||||
upstream: Result<T>,
|
||||
relayCall: suspend (String) -> Result<T>,
|
||||
): Result<T> {
|
||||
if (upstream.isSuccess) return upstream
|
||||
val error = upstream.exceptionOrNull()!!
|
||||
if (!error.isUnsupportedGitRoute()) return Result.failure(error)
|
||||
val relay = relayRepoIdsByRoot[normalizedRoot(target.root)] ?: return Result.failure(error)
|
||||
return relayCall(relay)
|
||||
}
|
||||
|
||||
private suspend fun <T> relayWrite(repo: String, block: suspend (String) -> Result<T>): Result<T> {
|
||||
val relay = relayRepoId(repo)
|
||||
?: return Result.failure(IOException("This Git action requires the Relay plugin enhancement"))
|
||||
return block(relay)
|
||||
}
|
||||
|
||||
private fun relayRepoId(repo: String): String? {
|
||||
val target = reposById[repo] ?: return repo.takeUnless { it == UPSTREAM_SESSION_REPO_ID }
|
||||
return if (target.route == GitRepositoryRoute.RELAY) target.id
|
||||
else relayRepoIdsByRoot[normalizedRoot(target.root)]
|
||||
}
|
||||
|
||||
private fun rememberRepos(repos: List<GitRepo>) {
|
||||
repos.forEach { reposById[it.id] = it }
|
||||
rememberRelayRepos(repos.filter { it.route == GitRepositoryRoute.RELAY })
|
||||
}
|
||||
|
||||
private fun rememberRelayRepos(repos: List<GitRepo>) {
|
||||
repos.forEach { relayRepoIdsByRoot[normalizedRoot(it.root)] = it.id }
|
||||
}
|
||||
|
||||
private fun upstreamPath(path: String, query: Map<String, String>): String = buildString {
|
||||
append(path)
|
||||
if (query.isNotEmpty()) {
|
||||
append('?')
|
||||
append(query.entries.joinToString("&") { (key, value) -> "${encode(key)}=${encode(value)}" })
|
||||
}
|
||||
}
|
||||
|
||||
private fun encode(value: String): String =
|
||||
URLEncoder.encode(value, Charsets.UTF_8.name()).replace("+", "%20")
|
||||
|
||||
private fun normalizedRoot(path: String): String {
|
||||
val normalized = path.trim().replace('\\', '/').trimEnd('/')
|
||||
return if (WINDOWS_ROOT.containsMatchIn(normalized) || normalized.startsWith("//")) {
|
||||
normalized.lowercase(Locale.ROOT)
|
||||
} else {
|
||||
normalized
|
||||
}
|
||||
}
|
||||
|
||||
private fun sameRoot(first: String, second: String): Boolean =
|
||||
normalizedRoot(first) == normalizedRoot(second)
|
||||
|
||||
private fun Result<kotlinx.serialization.json.JsonObject>.decodeMutation(): Result<GitMutationResult> =
|
||||
mapCatching { json.decodeFromJsonElement<GitMutationResult>(it) }
|
||||
|
||||
private fun Throwable.isUnsupportedGitRoute(): Boolean =
|
||||
this is DashboardHttpException && statusCode == 404
|
||||
|
||||
private companion object {
|
||||
const val UPSTREAM_SESSION_REPO_ID = "__upstream_session__"
|
||||
val WINDOWS_ROOT = Regex("^[A-Za-z]:/")
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamStatus(
|
||||
val branch: String? = null,
|
||||
val staged: Int = 0,
|
||||
val unstaged: Int = 0,
|
||||
val untracked: Int = 0,
|
||||
val changed: Int = 0,
|
||||
val added: Int = 0,
|
||||
val removed: Int = 0,
|
||||
val files: List<UpstreamStatusFile> = emptyList(),
|
||||
)
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamStatusFile(
|
||||
val path: String,
|
||||
val staged: Boolean = false,
|
||||
val unstaged: Boolean = false,
|
||||
val untracked: Boolean = false,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamReviewList(val files: List<UpstreamReviewFile> = emptyList())
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamReviewFile(
|
||||
val path: String,
|
||||
val added: Int = 0,
|
||||
val removed: Int = 0,
|
||||
val staged: Boolean = false,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamBranches(val branches: List<UpstreamBranch> = emptyList())
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamBranch(
|
||||
val name: String,
|
||||
@SerialName("checkedOut") val checkedOut: Boolean = false,
|
||||
)
|
||||
|
||||
@Serializable
|
||||
private data class UpstreamDiffResponse(val diff: String = "")
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.hermesandroid.relay.data
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/** A repository discovered by the plugin's /git/repos endpoint. */
|
||||
/** A current-session upstream repository or a Relay-discovered repository. */
|
||||
@Serializable
|
||||
data class GitRepo(
|
||||
val id: String,
|
||||
@@ -11,9 +11,19 @@ data class GitRepo(
|
||||
val root: String,
|
||||
@SerialName("current_branch") val currentBranch: String? = null,
|
||||
val dirty: Boolean = false,
|
||||
val route: GitRepositoryRoute = GitRepositoryRoute.RELAY,
|
||||
)
|
||||
|
||||
/** Working-tree status from /git/status. */
|
||||
@Serializable
|
||||
enum class GitRepositoryRoute {
|
||||
@SerialName("relay")
|
||||
RELAY,
|
||||
|
||||
@SerialName("upstream")
|
||||
UPSTREAM,
|
||||
}
|
||||
|
||||
/** Normalized working-tree status from upstream or Relay Git routes. */
|
||||
@Serializable
|
||||
data class GitStatus(
|
||||
val counts: GitStatusCounts = GitStatusCounts(),
|
||||
|
||||
@@ -344,6 +344,46 @@ class VoicePreferencesRepository(private val dataStore: DataStore<Preferences>)
|
||||
dataStore.edit { it[key] = route.storageValue }
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear Relay-only selections after Relay has been explicitly removed from
|
||||
* the active connection. A temporarily unreachable configured Relay must
|
||||
* not call this: preserving the selection lets the richer route resume
|
||||
* when connectivity returns.
|
||||
*
|
||||
* [expectedScope] fences profile/connection changes that can race the
|
||||
* DataStore edit. Values are re-read inside the transaction instead of
|
||||
* trusting an earlier settings snapshot, so a newer user choice wins.
|
||||
* The legacy default-profile keys are global (their storage names predate
|
||||
* connection scoping), so they are never rewritten here: runtime fallback
|
||||
* handles an unpaired default profile without changing another
|
||||
* connection's selection.
|
||||
*/
|
||||
suspend fun reconcileRelayRemoval(expectedScope: VoiceProfileScope): Boolean {
|
||||
if (_scope.value != expectedScope || expectedScope.profileName == null) return false
|
||||
var changed = false
|
||||
dataStore.edit { prefs ->
|
||||
if (_scope.value != expectedScope) return@edit
|
||||
|
||||
val engine = VoiceEngineMode.fromStorage(
|
||||
resolveString(prefs, KEY_ENGINE_MODE, expectedScope, DEFAULT_ENGINE_MODE),
|
||||
)
|
||||
val route = VoiceAudioRoute.fromStorage(
|
||||
resolveString(prefs, KEY_AUDIO_ROUTE, expectedScope, DEFAULT_AUDIO_ROUTE),
|
||||
)
|
||||
if (engine == VoiceEngineMode.RealtimeAgent) {
|
||||
prefs[stringPreferencesKey(scopedName(KEY_ENGINE_MODE, expectedScope))] =
|
||||
VoiceEngineMode.HermesVoiceOutput.storageValue
|
||||
changed = true
|
||||
}
|
||||
if (route == VoiceAudioRoute.Relay) {
|
||||
prefs[stringPreferencesKey(scopedName(KEY_AUDIO_ROUTE, expectedScope))] =
|
||||
VoiceAudioRoute.Auto.storageValue
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
return changed
|
||||
}
|
||||
|
||||
/** "" clears the override (relay falls back to the server's saved voice). */
|
||||
suspend fun setEnhancedVoice(voice: String) {
|
||||
val key = stringPreferencesKey(scopedName(KEY_ENH_VOICE, _scope.value))
|
||||
|
||||
@@ -28,6 +28,7 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import java.io.IOException
|
||||
import java.io.ByteArrayOutputStream
|
||||
|
||||
internal const val RELAY_SESSION_HEADER: String = "X-Hermes-Relay-Session"
|
||||
|
||||
@@ -88,6 +89,7 @@ class RelayHttpClient(
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RelayHttpClient"
|
||||
private const val DEFAULT_MEDIA_DOWNLOAD_LIMIT_BYTES = 100L * 1024L * 1024L
|
||||
const val MAX_MODEL_CAPABILITY_ROWS = 64
|
||||
private const val MAX_MODEL_CAPABILITY_PROVIDER_CHARS = 128
|
||||
private const val MAX_MODEL_CAPABILITY_MODEL_CHARS = 512
|
||||
@@ -257,7 +259,10 @@ class RelayHttpClient(
|
||||
* underlying exception with a human-readable message suitable for
|
||||
* surfacing in the attachment's `errorMessage` field.
|
||||
*/
|
||||
suspend fun fetchMedia(token: String): Result<FetchedMedia> = withContext(Dispatchers.IO) {
|
||||
suspend fun fetchMedia(
|
||||
token: String,
|
||||
maxBytes: Long = DEFAULT_MEDIA_DOWNLOAD_LIMIT_BYTES,
|
||||
): Result<FetchedMedia> = withContext(Dispatchers.IO) {
|
||||
val relayUrl = relayUrlProvider()?.trim().orEmpty()
|
||||
if (relayUrl.isEmpty()) {
|
||||
return@withContext Result.failure(
|
||||
@@ -318,7 +323,7 @@ class RelayHttpClient(
|
||||
if (body == null) {
|
||||
return@withContext Result.failure(IOException("Empty response body"))
|
||||
}
|
||||
val bytes = body.bytes()
|
||||
val bytes = body.readBytesBounded(maxBytes)
|
||||
Result.success(FetchedMedia(contentType, bytes, fileName, sensitive))
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
@@ -352,6 +357,7 @@ class RelayHttpClient(
|
||||
suspend fun fetchMediaByPath(
|
||||
path: String,
|
||||
contentTypeHint: String? = null,
|
||||
maxBytes: Long = DEFAULT_MEDIA_DOWNLOAD_LIMIT_BYTES,
|
||||
): Result<FetchedMedia> = withContext(Dispatchers.IO) {
|
||||
val relayUrl = relayUrlProvider()?.trim().orEmpty()
|
||||
if (relayUrl.isEmpty()) {
|
||||
@@ -427,12 +433,16 @@ class RelayHttpClient(
|
||||
if (body == null) {
|
||||
return@withContext Result.failure(IOException("Empty response body"))
|
||||
}
|
||||
val bytes = body.bytes()
|
||||
val bytes = body.readBytesBounded(maxBytes)
|
||||
Result.success(FetchedMedia(contentType, bytes, fileName, sensitive))
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, "fetchMediaByPath failed for $path: ${e.message}")
|
||||
Result.failure(IOException("Relay unreachable: ${e.message ?: "IO error"}"))
|
||||
if (e is RelayMediaLimitException) {
|
||||
Result.failure(e)
|
||||
} else {
|
||||
Result.failure(IOException("Relay unreachable: ${e.message ?: "IO error"}"))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "fetchMediaByPath unexpected error for $path: ${e.message}")
|
||||
Result.failure(e)
|
||||
@@ -1456,6 +1466,33 @@ class RelayHttpClient(
|
||||
return match?.groupValues?.get(1)?.trim()?.ifBlank { null }
|
||||
}
|
||||
|
||||
private fun okhttp3.ResponseBody.readBytesBounded(maxBytes: Long): ByteArray {
|
||||
if (maxBytes <= 0L) throw RelayMediaLimitException()
|
||||
val declared = contentLength().takeIf { it >= 0L }
|
||||
if (declared != null && declared > maxBytes) throw RelayMediaLimitException()
|
||||
val output = ByteArrayOutputStream(
|
||||
declared?.coerceAtMost(Int.MAX_VALUE.toLong())?.toInt() ?: DEFAULT_BUFFER_SIZE,
|
||||
)
|
||||
byteStream().use { input ->
|
||||
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
|
||||
var total = 0L
|
||||
while (true) {
|
||||
val count = input.read(buffer)
|
||||
if (count < 0) break
|
||||
total += count
|
||||
if (total > maxBytes) throw RelayMediaLimitException()
|
||||
output.write(buffer, 0, count)
|
||||
}
|
||||
if (declared != null && total != declared) {
|
||||
throw IOException("Media file changed while it was being downloaded")
|
||||
}
|
||||
}
|
||||
return output.toByteArray()
|
||||
}
|
||||
|
||||
private class RelayMediaLimitException :
|
||||
IOException("File exceeds the configured download limit")
|
||||
|
||||
/**
|
||||
* Parse the relay's `X-Media-Sensitive` response header into a bool.
|
||||
*
|
||||
@@ -1468,7 +1505,7 @@ class RelayHttpClient(
|
||||
return value == "1" || value == "true"
|
||||
}
|
||||
|
||||
/** Provider-neutral compatibility fetch for gateways without `account.usage`. */
|
||||
/** Provider-neutral enhancement for pools and providers upstream does not expose. */
|
||||
suspend fun fetchProviderUsage(
|
||||
profile: String? = null,
|
||||
sessionId: String? = null,
|
||||
|
||||
@@ -1540,19 +1540,28 @@ class ChatHandler {
|
||||
val prior = priorById[messageId]
|
||||
// Outbound attachments: prefer an id-match (covers any future
|
||||
// user-message id reconciliation), else fall back to the
|
||||
// content-keyed queue. Inbound attachments normally come back via
|
||||
// marker re-dispatch. One narrow exception retains a completed
|
||||
// image_generate result when the immediate post-turn history read
|
||||
// still lacks its MEDIA marker; otherwise the rendered image
|
||||
// disappears during the persistence-lag window.
|
||||
// content-keyed queue. Exact inbound marker attachments are also
|
||||
// carried by id: a history refresh must not replace a successfully
|
||||
// loaded image/file with a fresh LOADING placeholder. A process
|
||||
// restart has no prior attachment, so the marker still dispatches
|
||||
// normally and rehydrates it. One additional narrow exception
|
||||
// retains a completed image_generate result when the immediate
|
||||
// post-turn history read still lacks its MEDIA marker.
|
||||
val carriedAttachments = run {
|
||||
val persistedImagePaths = persistedImages.paths.toHashSet()
|
||||
val persistedMediaKeys = messageMediaHits.mapTo(HashSet()) { (_, hit) ->
|
||||
when (hit) {
|
||||
is MediaMarkerHit.RelayToken -> hit.token
|
||||
is MediaMarkerHit.BarePath -> hit.path
|
||||
}
|
||||
}
|
||||
val priorGeneratedImage = prior?.toolCalls.orEmpty().any { tool ->
|
||||
isImageGenerationToolName(tool.name) &&
|
||||
tool.isComplete && tool.success != false
|
||||
}
|
||||
val byId = prior?.attachments.orEmpty().filter { attachment ->
|
||||
attachment.relayToken == null ||
|
||||
attachment.relayToken in persistedMediaKeys ||
|
||||
(role == MessageRole.USER && attachment.relayToken in persistedImagePaths) ||
|
||||
(
|
||||
role == MessageRole.ASSISTANT &&
|
||||
@@ -1708,15 +1717,27 @@ class ChatHandler {
|
||||
is MediaMarkerHit.RelayToken -> {
|
||||
val dedupeKey = "$messageId:relay:${hit.token}"
|
||||
if (dispatchedMediaMarkers.add(dedupeKey)) {
|
||||
Log.d(TAG, "Media marker accepted from reloaded Relay history")
|
||||
onMediaAttachmentRequested(messageId, hit.token)
|
||||
val alreadyHydrated = _messages.value
|
||||
.firstOrNull { it.matchesIdentity(messageId) }
|
||||
?.attachments
|
||||
?.any { it.relayToken == hit.token } == true
|
||||
if (!alreadyHydrated) {
|
||||
Log.d(TAG, "Media marker accepted from reloaded Relay history")
|
||||
onMediaAttachmentRequested(messageId, hit.token)
|
||||
}
|
||||
}
|
||||
}
|
||||
is MediaMarkerHit.BarePath -> {
|
||||
val dedupeKey = "$messageId:bare:${hit.path}"
|
||||
if (dispatchedMediaMarkers.add(dedupeKey)) {
|
||||
Log.d(TAG, "Media marker (bare-path, reload): ${hit.path}")
|
||||
onMediaBarePathRequested(messageId, hit.path)
|
||||
val alreadyHydrated = _messages.value
|
||||
.firstOrNull { it.matchesIdentity(messageId) }
|
||||
?.attachments
|
||||
?.any { it.relayToken == hit.path } == true
|
||||
if (!alreadyHydrated) {
|
||||
Log.d(TAG, "Media marker (bare-path, reload): ${hit.path}")
|
||||
onMediaBarePathRequested(messageId, hit.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +293,34 @@ internal fun copyBounded(
|
||||
return written
|
||||
}
|
||||
|
||||
internal fun copyMediaBounded(
|
||||
input: InputStream,
|
||||
output: OutputStream,
|
||||
declaredLength: Long?,
|
||||
limitBytes: Long,
|
||||
): Long {
|
||||
require(limitBytes > 0)
|
||||
require(declaredLength == null || declaredLength >= 0)
|
||||
if (declaredLength != null && declaredLength > limitBytes) {
|
||||
throw IOException("File exceeds the configured download limit")
|
||||
}
|
||||
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
|
||||
var written = 0L
|
||||
while (true) {
|
||||
val read = input.read(buffer)
|
||||
if (read < 0) break
|
||||
written += read
|
||||
if (written > limitBytes) {
|
||||
throw IOException("File exceeds the configured download limit")
|
||||
}
|
||||
output.write(buffer, 0, read)
|
||||
}
|
||||
if (declaredLength != null && written != declaredLength) {
|
||||
throw IOException("Media file changed while it was being downloaded")
|
||||
}
|
||||
return written
|
||||
}
|
||||
|
||||
/** One entry from `GET /api/audio/elevenlabs/voices` — non-secret voice metadata. */
|
||||
data class ElevenLabsVoice(
|
||||
val voiceId: String,
|
||||
@@ -310,6 +338,19 @@ data class ElevenLabsVoices(
|
||||
val voices: List<ElevenLabsVoice>,
|
||||
)
|
||||
|
||||
/**
|
||||
* Metadata for a file streamed from upstream's authenticated managed-files surface.
|
||||
*
|
||||
* The Dashboard applies its own managed-root, sensitive-file, and maximum-size
|
||||
* policy before the file leaves the Hermes host. Android applies the user's
|
||||
* stricter inbound-media cap while reading the response as a second boundary.
|
||||
*/
|
||||
data class DashboardFetchedFile(
|
||||
val sizeBytes: Long,
|
||||
val contentType: String,
|
||||
val fileName: String?,
|
||||
)
|
||||
|
||||
/**
|
||||
* Native client for the Hermes dashboard/admin server (:9119).
|
||||
*
|
||||
@@ -381,6 +422,58 @@ class DashboardApiClient(
|
||||
executeJsonElement(request, normalized)
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a server-local artifact through current upstream Hermes.
|
||||
*
|
||||
* This is the same authenticated `/api/files/download` route official
|
||||
* Desktop uses for remote gateway files. The caller supplies its display
|
||||
* cap so a malicious or stale Content-Length cannot cause an unbounded
|
||||
* allocation. The supplied output is normally Android's on-disk media cache;
|
||||
* local playback supplies seeking, so `/api/files/stream` is unnecessary
|
||||
* on this path.
|
||||
*/
|
||||
suspend fun downloadManagedFile(
|
||||
serverPath: String,
|
||||
maxBytes: Long,
|
||||
output: OutputStream,
|
||||
): Result<DashboardFetchedFile> = withContext(Dispatchers.IO) {
|
||||
if (serverPath.isBlank()) {
|
||||
return@withContext Result.failure(IOException("Media path is empty"))
|
||||
}
|
||||
if (maxBytes <= 0L) {
|
||||
return@withContext Result.failure(IOException("Media download limit is invalid"))
|
||||
}
|
||||
val httpUrl = resolveUrl("/api/files/download")
|
||||
?.newBuilder()
|
||||
?.addQueryParameter("path", serverPath)
|
||||
?.build()
|
||||
?: return@withContext Result.failure(invalidUrlException())
|
||||
val request = Request.Builder().url(httpUrl).get().build()
|
||||
|
||||
executeCancellable(request, "Dashboard media download") { response ->
|
||||
val body = response.body
|
||||
val declaredLength = body.contentLength().takeIf { it >= 0L }
|
||||
if (declaredLength != null && declaredLength > maxBytes) {
|
||||
throw IOException("File exceeds the configured download limit")
|
||||
}
|
||||
val readTotal = body.byteStream().use { input ->
|
||||
copyMediaBounded(input, output, declaredLength, maxBytes)
|
||||
}
|
||||
DashboardFetchedFile(
|
||||
sizeBytes = readTotal,
|
||||
contentType = response.header("Content-Type")
|
||||
?.substringBefore(';')
|
||||
?.trim()
|
||||
?.takeIf(String::isNotEmpty)
|
||||
?: "application/octet-stream",
|
||||
fileName = response.header("Content-Disposition")
|
||||
?.let(::contentDispositionFileName)
|
||||
?: serverPath.substringAfterLast('/').substringAfterLast('\\')
|
||||
.takeIf(String::isNotBlank),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun postJsonObject(
|
||||
path: String,
|
||||
payload: JsonObject = JsonObject(emptyMap()),
|
||||
@@ -2405,6 +2498,23 @@ private fun Response.readJsonElement(json: Json): JsonElement {
|
||||
return json.parseToJsonElement(raw)
|
||||
}
|
||||
|
||||
private fun contentDispositionFileName(header: String): String? {
|
||||
val encoded = Regex("""filename\*=UTF-8''([^;]+)""", RegexOption.IGNORE_CASE)
|
||||
.find(header)
|
||||
?.groupValues
|
||||
?.getOrNull(1)
|
||||
?.let { runCatching { java.net.URLDecoder.decode(it, "UTF-8") }.getOrNull() }
|
||||
val plain = Regex("""filename=\"([^\"]+)\"|filename=([^;]+)""", RegexOption.IGNORE_CASE)
|
||||
.find(header)
|
||||
?.let { it.groupValues[1].ifBlank { it.groupValues[2] } }
|
||||
?.trim()
|
||||
?.trim('"')
|
||||
return (encoded ?: plain)
|
||||
?.substringAfterLast('/')
|
||||
?.substringAfterLast('\\')
|
||||
?.takeIf(String::isNotBlank)
|
||||
}
|
||||
|
||||
internal class DashboardHttpException(
|
||||
val statusCode: Int,
|
||||
message: String,
|
||||
@@ -2448,6 +2558,33 @@ internal fun Throwable.isDashboardSignInRequiredFailure(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
/** True only when the managed-file route itself is absent on this Hermes build. */
|
||||
internal fun Throwable.isDashboardManagedFilesUnsupported(): Boolean {
|
||||
var current: Throwable? = this
|
||||
val seen = java.util.Collections.newSetFromMap(
|
||||
java.util.IdentityHashMap<Throwable, Boolean>(),
|
||||
)
|
||||
while (current != null && seen.add(current)) {
|
||||
if (current is DashboardHttpException) {
|
||||
if (current.statusCode in setOf(405, 501)) return true
|
||||
if (current.statusCode == 404) {
|
||||
val detail = current.message.orEmpty()
|
||||
// FastAPI's missing-route response is the generic "Not Found".
|
||||
// A real managed-file miss says "File not found" and must not
|
||||
// silently escape to Relay's broader path policy.
|
||||
val isManagedFileMiss = detail.contains("File not found", ignoreCase = true) ||
|
||||
detail.contains("Path not found", ignoreCase = true)
|
||||
val isGenericRouteMiss = detail.trim().endsWith(": not found", ignoreCase = true) ||
|
||||
detail.contains("\"detail\":\"Not Found\"", ignoreCase = true) ||
|
||||
detail.contains("\"detail\": \"Not Found\"", ignoreCase = true)
|
||||
if (!isManagedFileMiss && isGenericRouteMiss) return true
|
||||
}
|
||||
}
|
||||
current = current.cause
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private fun apiFailure(response: Response, operation: String): IOException {
|
||||
val bodyDetail = runCatching { response.body.string() }.getOrDefault("")
|
||||
val detail = bodyDetail.take(240).ifBlank { response.message }
|
||||
|
||||
@@ -119,6 +119,8 @@ class GatewayChatClient(
|
||||
private val promptSubmitTimeoutMs: Long = PROMPT_SUBMIT_REQUEST_TIMEOUT_MS,
|
||||
/** Test seam — idle-progress watchdog base. Production keeps [TURN_TIMEOUT_MS]. */
|
||||
private val turnIdleTimeoutMs: Long = TURN_TIMEOUT_MS,
|
||||
/** Test seam — lazy session.create/resume readiness barrier. */
|
||||
private val sessionReadyTimeoutMs: Long = SESSION_READY_TIMEOUT_MS,
|
||||
/** Test seam — compaction idle lease. Production keeps [COMPACTING_TIMEOUT_MS]. */
|
||||
private val compactingTimeoutMs: Long = COMPACTING_TIMEOUT_MS,
|
||||
/** Random source for ordinary reconnect full-jitter. */
|
||||
@@ -191,6 +193,7 @@ class GatewayChatClient(
|
||||
* would have been abandoned server-side anyway.
|
||||
*/
|
||||
private const val PROMPT_SUBMIT_REQUEST_TIMEOUT_MS = 1_800_000L
|
||||
private const val SESSION_READY_TIMEOUT_MS = 300_000L
|
||||
private const val CONNECT_TIMEOUT_MS = 20_000L
|
||||
|
||||
/**
|
||||
@@ -399,6 +402,14 @@ class GatewayChatClient(
|
||||
private val _serverProject = MutableStateFlow<GatewaySessionProject?>(null)
|
||||
val serverProject: StateFlow<GatewaySessionProject?> = _serverProject.asStateFlow()
|
||||
|
||||
/**
|
||||
* Exact model-callable tool names from upstream `session.info.tools` for
|
||||
* the selected live session/profile. Null means the gateway has not
|
||||
* supplied a catalog; an empty set means it authoritatively supplied none.
|
||||
*/
|
||||
private val _serverTools = MutableStateFlow<Set<String>?>(null)
|
||||
val serverTools: StateFlow<Set<String>?> = _serverTools.asStateFlow()
|
||||
|
||||
/** Serializes connect / session-establish so concurrent sends share one socket. */
|
||||
private val connectMutex = Mutex()
|
||||
|
||||
@@ -413,6 +424,9 @@ class GatewayChatClient(
|
||||
/** Invalidates an older async prewarm when a newer session selection wins. */
|
||||
private val prewarmRequestGeneration = AtomicLong(0)
|
||||
private val pendingRpcs = ConcurrentHashMap<Long, CompletableDeferred<JsonObject>>()
|
||||
private val lazyLiveSessions = ConcurrentHashMap.newKeySet<String>()
|
||||
private val readyLiveSessions = ConcurrentHashMap.newKeySet<String>()
|
||||
private val sessionReadyWaiters = ConcurrentHashMap<String, CompletableDeferred<Unit>>()
|
||||
|
||||
/** Monotonic client-local fence for lazy child watch open/close races. */
|
||||
private val childWatchGeneration = AtomicLong(0)
|
||||
@@ -563,6 +577,28 @@ class GatewayChatClient(
|
||||
val terminalRequired: Boolean,
|
||||
)
|
||||
|
||||
/**
|
||||
* One exact turn settled from authoritative session state may still receive
|
||||
* the terminal frame that was already in flight. Consume only that terminal
|
||||
* so it cannot be reported as a second unmatched completion. A subsequent
|
||||
* message.start clears the drain because it establishes the next turn on
|
||||
* the same live runtime.
|
||||
*/
|
||||
@Volatile
|
||||
private var settledTurnDrain: SettledTurnDrain? = null
|
||||
|
||||
private data class SettledTurnDrain(
|
||||
val storedSessionId: String,
|
||||
val liveSessionId: String,
|
||||
)
|
||||
|
||||
private data class ActiveTurnLivenessProbe(
|
||||
val turn: GatewayTurn,
|
||||
val storedSessionId: String,
|
||||
val liveSessionId: String,
|
||||
val progressGeneration: Long,
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates UI callbacks when the server starts a turn that has no matching
|
||||
* [sendTurn] call (for example a background-process completion). The
|
||||
@@ -692,6 +728,7 @@ class GatewayChatClient(
|
||||
): ActiveTurnHandle {
|
||||
val turn = GatewayTurn(
|
||||
callbacks = dispatchOn(callbacks),
|
||||
androidOwned = true,
|
||||
onTransportAccepted = onTransportAccepted,
|
||||
)
|
||||
// Warm = the connection-establish phases are skipped this turn (socket
|
||||
@@ -739,6 +776,10 @@ class GatewayChatClient(
|
||||
cleanupStagedAttachments(stagedImagePaths)
|
||||
return@launch
|
||||
}
|
||||
// A newly accepted Android send is a distinct generation on
|
||||
// this runtime. Its terminal must never be consumed by the
|
||||
// prior turn's optional late-terminal drain.
|
||||
settledTurnDrain = null
|
||||
activeTurn = turn
|
||||
turn.armWatchdog()
|
||||
// Generic `file.attach` uploads are staged artifacts, not
|
||||
@@ -797,7 +838,7 @@ class GatewayChatClient(
|
||||
// through the normal failed-turn callback instead.
|
||||
cleanupStagedAttachments(stagedImagePaths)
|
||||
turn.tracer.done("submit-rejected")
|
||||
turn.callbacks.onError(
|
||||
turn.callbacks.onSubmitRejected(
|
||||
submitError?.message ?: "Hermes rejected the new session",
|
||||
)
|
||||
return@launch
|
||||
@@ -864,7 +905,11 @@ class GatewayChatClient(
|
||||
liveSessionId = null
|
||||
storedSessionId = null
|
||||
liveSessionProfile = null
|
||||
failSessionReadyWaiters("gateway session cleared")
|
||||
lazyLiveSessions.clear()
|
||||
readyLiveSessions.clear()
|
||||
cancelledTurnDrain = null
|
||||
_serverTools.value = null
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1378,6 +1423,7 @@ class GatewayChatClient(
|
||||
callbacks = dispatchOn(callbacks),
|
||||
dedupeAdjacentMessageStarts = true,
|
||||
deferEvents = true,
|
||||
androidOwned = true,
|
||||
).also { turn ->
|
||||
turn.markRecoveredStarted()
|
||||
activeTurn = turn
|
||||
@@ -1501,6 +1547,7 @@ class GatewayChatClient(
|
||||
boundTurn = GatewayTurn(
|
||||
callbacks = dispatchOn(callbacks),
|
||||
dedupeAdjacentMessageStarts = true,
|
||||
androidOwned = true,
|
||||
).also { turn ->
|
||||
turn.markRecoveredStarted()
|
||||
activeTurn = turn
|
||||
@@ -1534,6 +1581,7 @@ class GatewayChatClient(
|
||||
val queuedTurn = GatewayTurn(
|
||||
callbacks = dispatchOn(registration.callbacks),
|
||||
dedupeAdjacentMessageStarts = true,
|
||||
androidOwned = true,
|
||||
)
|
||||
// recoverTurn is resumed on its caller's coroutine context;
|
||||
// ChatViewModel calls it from Main, so this admission runs
|
||||
@@ -1780,18 +1828,17 @@ class GatewayChatClient(
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider-neutral account limits owned by upstream Hermes. Current hosts
|
||||
* may not expose this additive method yet; callers should treat JSON-RPC
|
||||
* method-not-found as capability absence and use the optional Relay
|
||||
* compatibility surface when paired.
|
||||
* Official upstream Nous usage bars. Current hosts may not expose this
|
||||
* additive method yet; callers should treat JSON-RPC method-not-found as
|
||||
* capability absence and use the optional Relay enhancement when paired.
|
||||
*/
|
||||
suspend fun providerUsage(): Result<JsonObject> {
|
||||
suspend fun usageBars(): Result<JsonObject> {
|
||||
try {
|
||||
connectMutex.withLock { ensureConnected() }
|
||||
} catch (e: Exception) {
|
||||
return Result.failure(e)
|
||||
}
|
||||
return rpc("account.usage", JsonObject(emptyMap()))
|
||||
return rpc("usage.bars", JsonObject(emptyMap()))
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2429,6 +2476,7 @@ class GatewayChatClient(
|
||||
} catch (error: Exception) {
|
||||
return GatewayActiveSessionsResult.TransientFailure(error)
|
||||
}
|
||||
val livenessProbe = captureActiveTurnLivenessProbe()
|
||||
val result = rpc(
|
||||
"session.active_list",
|
||||
buildJsonObject {
|
||||
@@ -2448,12 +2496,58 @@ class GatewayChatClient(
|
||||
val payload = result.getOrThrow()
|
||||
val rows = payload["sessions"] as? JsonArray
|
||||
?: throw GatewayRpcException("session.active_list returned no sessions array")
|
||||
GatewayActiveSessionsResult.Success(rows.map(::parseGatewayActiveSession))
|
||||
val sessions = rows.map(::parseGatewayActiveSession)
|
||||
reconcileActiveTurnFromSnapshot(livenessProbe, sessions)
|
||||
GatewayActiveSessionsResult.Success(sessions)
|
||||
} catch (parseError: Exception) {
|
||||
GatewayActiveSessionsResult.TransientFailure(parseError)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Capture only a locally submitted/recovered turn. Merely observing an
|
||||
* exact session through the shared Gateway socket never grants Android
|
||||
* authority to settle Desktop/TUI work.
|
||||
*/
|
||||
private fun captureActiveTurnLivenessProbe(): ActiveTurnLivenessProbe? {
|
||||
val turn = activeTurn ?: return null
|
||||
val generation = turn.captureLivenessGeneration() ?: return null
|
||||
val storedId = storedSessionId ?: return null
|
||||
val liveId = liveSessionId ?: return null
|
||||
return ActiveTurnLivenessProbe(turn, storedId, liveId, generation)
|
||||
}
|
||||
|
||||
/**
|
||||
* `session.active_list` is process-wide, but a row naming both identifiers
|
||||
* already owned by this client is authoritative for that exact runtime.
|
||||
* Fence the delayed snapshot by turn identity and progress generation so an
|
||||
* old idle result cannot settle a newer turn or race newer live events.
|
||||
*/
|
||||
private fun reconcileActiveTurnFromSnapshot(
|
||||
probe: ActiveTurnLivenessProbe?,
|
||||
sessions: List<GatewayActiveSession>,
|
||||
) {
|
||||
probe ?: return
|
||||
if (activeTurn !== probe.turn ||
|
||||
storedSessionId != probe.storedSessionId ||
|
||||
liveSessionId != probe.liveSessionId
|
||||
) return
|
||||
val exact = sessions.singleOrNull { row ->
|
||||
row.runtimeSessionId == probe.liveSessionId &&
|
||||
row.storedSessionId == probe.storedSessionId
|
||||
} ?: return
|
||||
if (exact.status != GatewayActiveSessionStatus.Idle) return
|
||||
if (probe.turn.settleFromAuthoritativeSessionState(
|
||||
running = false,
|
||||
source = "session.active_list",
|
||||
expectedProgressGeneration = probe.progressGeneration,
|
||||
)
|
||||
) {
|
||||
if (activeTurn === probe.turn) activeTurn = null
|
||||
if (!AppForegroundTracker.isForeground.value) scheduleBackgroundClose()
|
||||
}
|
||||
}
|
||||
|
||||
/** Stop one process owned by the current live gateway session. */
|
||||
suspend fun killProcess(processId: String): Result<Unit> {
|
||||
if (processId.isBlank()) {
|
||||
@@ -2846,6 +2940,7 @@ class GatewayChatClient(
|
||||
activeTurn = null
|
||||
backgroundTurns.clear()
|
||||
cancelledTurnDrain = null
|
||||
settledTurnDrain = null
|
||||
unsolicitedTurnProvider = null
|
||||
coldPrewarmSessionReadyListener = null
|
||||
unmatchedTurnCompleteListener = null
|
||||
@@ -3149,6 +3244,18 @@ class GatewayChatClient(
|
||||
)
|
||||
}
|
||||
}
|
||||
if (info.containsKey("tools")) {
|
||||
val groups = info["tools"] as? JsonObject
|
||||
_serverTools.value = groups
|
||||
?.values
|
||||
?.asSequence()
|
||||
?.mapNotNull { it as? JsonArray }
|
||||
?.flatMap { it.asSequence() }
|
||||
?.mapNotNull { (it as? JsonPrimitive)?.contentOrNull }
|
||||
?.filter { it.isNotBlank() }
|
||||
?.toSet()
|
||||
?: emptySet()
|
||||
}
|
||||
// Context usage: require used > 0 — a COLD resume resets counters and
|
||||
// reports 0 until the first turn rebuilds the prompt; painting 0 would
|
||||
// mislead on a session that actually has history.
|
||||
@@ -3164,6 +3271,7 @@ class GatewayChatClient(
|
||||
/** Apply a session create/resume result without leaking metadata from the prior session. */
|
||||
private fun applySessionResultInfo(result: JsonObject) {
|
||||
_serverProject.value = null
|
||||
_serverTools.value = null
|
||||
(result["info"] as? JsonObject)?.let { applySessionInfo(it) }
|
||||
}
|
||||
|
||||
@@ -3282,6 +3390,7 @@ class GatewayChatClient(
|
||||
val requestedProfile = currentSessionProfile()
|
||||
if (requestedStoredId != null && requestedStoredId != storedSessionId) {
|
||||
cancelledTurnDrain = null
|
||||
settledTurnDrain = null
|
||||
}
|
||||
if (
|
||||
liveSessionId != null &&
|
||||
@@ -3289,6 +3398,7 @@ class GatewayChatClient(
|
||||
requestedStoredId != null &&
|
||||
liveSessionProfile == requestedProfile
|
||||
) {
|
||||
awaitSessionReadyIfRequired(liveSessionId!!)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -3318,6 +3428,7 @@ class GatewayChatClient(
|
||||
liveSessionProfile = requestedProfile
|
||||
updateCancelledDrainLiveSession(requestedStoredId, live)
|
||||
applySessionResultInfo(result)
|
||||
awaitSessionReadyIfRequired(live, result)
|
||||
return
|
||||
}
|
||||
throw GatewayAuthoritativeResumeException(
|
||||
@@ -3351,7 +3462,47 @@ class GatewayChatClient(
|
||||
storedSessionId = stored
|
||||
liveSessionProfile = requestedProfile
|
||||
if (cancelledTurnDrain?.storedSessionId != stored) cancelledTurnDrain = null
|
||||
if (settledTurnDrain?.storedSessionId != stored) settledTurnDrain = null
|
||||
turn.callbacks.onSessionId(stored)
|
||||
awaitSessionReadyIfRequired(live, created)
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for current upstream's authoritative deferred-build edge instead of
|
||||
* racing a lazy session into compute-host turn isolation. Without this
|
||||
* barrier, the parent runtime can claim the durable lease before the child
|
||||
* rechecks it, causing the child to reject itself as a second live owner.
|
||||
*/
|
||||
private suspend fun awaitSessionReadyIfRequired(
|
||||
liveId: String,
|
||||
sessionResult: JsonObject? = null,
|
||||
) {
|
||||
val lazy = (sessionResult?.get("info") as? JsonObject)?.booleanField("lazy") == true
|
||||
if (lazy) lazyLiveSessions += liveId
|
||||
if (liveId !in lazyLiveSessions) return
|
||||
if (readyLiveSessions.remove(liveId)) {
|
||||
lazyLiveSessions.remove(liveId)
|
||||
return
|
||||
}
|
||||
val waiter = sessionReadyWaiters.computeIfAbsent(liveId) { CompletableDeferred() }
|
||||
if (readyLiveSessions.remove(liveId)) waiter.complete(Unit)
|
||||
try {
|
||||
withTimeout(sessionReadyTimeoutMs) { waiter.await() }
|
||||
lazyLiveSessions.remove(liveId)
|
||||
} catch (error: Exception) {
|
||||
throw GatewayPreflightException(
|
||||
error.message ?: "Hermes session initialization timed out",
|
||||
)
|
||||
} finally {
|
||||
sessionReadyWaiters.remove(liveId, waiter)
|
||||
}
|
||||
}
|
||||
|
||||
private fun failSessionReadyWaiters(message: String) {
|
||||
sessionReadyWaiters.values.forEach {
|
||||
it.completeExceptionally(GatewayRpcException(message))
|
||||
}
|
||||
sessionReadyWaiters.clear()
|
||||
}
|
||||
|
||||
private fun createListener(ready: CompletableDeferred<Unit>) = object : WebSocketListener() {
|
||||
@@ -3530,6 +3681,17 @@ class GatewayChatClient(
|
||||
return
|
||||
}
|
||||
|
||||
// Lazy create/resume returns before its AIAgent exists. The deferred
|
||||
// build publishes exact-session session.info when it is ready. Record
|
||||
// that edge before live-session routing so a fast build cannot race
|
||||
// the RPC response and strand the first submit.
|
||||
if (type == "session.info" && !eventSessionId.isNullOrBlank() &&
|
||||
payload?.booleanField("lazy") != true
|
||||
) {
|
||||
readyLiveSessions += eventSessionId
|
||||
sessionReadyWaiters.remove(eventSessionId)?.complete(Unit)
|
||||
}
|
||||
|
||||
// Upstream emits session.reclaimed process-wide, so it is identified
|
||||
// by payload rather than params.session_id. Retire only an exact live
|
||||
// runtime we own; preserve the durable id so the next send resumes it.
|
||||
@@ -3728,6 +3890,7 @@ class GatewayChatClient(
|
||||
}
|
||||
dispatchProcessEvent(type, payload, eventSessionId)
|
||||
if (consumeCancelledTurnEvent(type, eventSessionId)) return
|
||||
if (consumeSettledTurnTerminal(type, eventSessionId)) return
|
||||
var turn = activeTurn
|
||||
if (turn == null && type == "message.start") {
|
||||
// Unsolicited turns are accepted only with an explicit exact live-
|
||||
@@ -3856,6 +4019,9 @@ class GatewayChatClient(
|
||||
it.completeExceptionally(GatewayRpcException("gateway connection lost"))
|
||||
}
|
||||
pendingRpcs.clear()
|
||||
failSessionReadyWaiters("gateway connection lost")
|
||||
lazyLiveSessions.clear()
|
||||
readyLiveSessions.clear()
|
||||
failChildWatches("Child watch disconnected from the gateway")
|
||||
val turn = activeTurn
|
||||
if (turn == null) {
|
||||
@@ -4033,6 +4199,9 @@ class GatewayChatClient(
|
||||
webSocket = null
|
||||
readySignal = null
|
||||
liveSessionId = null
|
||||
failSessionReadyWaiters("gateway socket closed")
|
||||
lazyLiveSessions.clear()
|
||||
readyLiveSessions.clear()
|
||||
attachMethodForSocket = null
|
||||
commandsCatalogCache = null
|
||||
_processCapability.value = GatewayProcessCapability.Unknown
|
||||
@@ -4254,6 +4423,7 @@ class GatewayChatClient(
|
||||
val callbacks: GatewayTurnCallbacks,
|
||||
dedupeAdjacentMessageStarts: Boolean = false,
|
||||
deferEvents: Boolean = false,
|
||||
private val androidOwned: Boolean = false,
|
||||
private val onTransportAccepted: () -> Unit = { },
|
||||
) : ActiveTurnHandle {
|
||||
private val mapper = GatewayEventMapper(callbacks, dedupeAdjacentMessageStarts)
|
||||
@@ -4280,6 +4450,7 @@ class GatewayChatClient(
|
||||
|
||||
private val rejoinAttempts = java.util.concurrent.atomic.AtomicInteger(0)
|
||||
private val transportAccepted = AtomicBoolean(false)
|
||||
private val progressGeneration = java.util.concurrent.atomic.AtomicLong(0L)
|
||||
|
||||
fun markTransportAccepted() {
|
||||
if (transportAccepted.compareAndSet(false, true)) {
|
||||
@@ -4356,6 +4527,7 @@ class GatewayChatClient(
|
||||
if (settledWithoutTerminalFrame) return
|
||||
if (type != "session.info") {
|
||||
started = true
|
||||
progressGeneration.incrementAndGet()
|
||||
markTransportAccepted()
|
||||
}
|
||||
tracer.mark("ttfe")
|
||||
@@ -4385,10 +4557,20 @@ class GatewayChatClient(
|
||||
* exact turn has proved it went live. A pre-start `running=false`
|
||||
* heartbeat can race `prompt.submit` and is not a completion boundary.
|
||||
*/
|
||||
fun settleFromAuthoritativeSessionState(running: Boolean?, source: String): Boolean {
|
||||
fun captureLivenessGeneration(): Long? =
|
||||
if (androidOwned && started && !ended) progressGeneration.get() else null
|
||||
|
||||
fun settleFromAuthoritativeSessionState(
|
||||
running: Boolean?,
|
||||
source: String,
|
||||
expectedProgressGeneration: Long? = null,
|
||||
): Boolean {
|
||||
if (running != false || !started) return false
|
||||
val settled = synchronized(deferredEventLock) {
|
||||
if (ended) {
|
||||
if (ended ||
|
||||
(expectedProgressGeneration != null &&
|
||||
progressGeneration.get() != expectedProgressGeneration)
|
||||
) {
|
||||
false
|
||||
} else {
|
||||
settledWithoutTerminalFrame = true
|
||||
@@ -4399,6 +4581,7 @@ class GatewayChatClient(
|
||||
if (!settled) return false
|
||||
|
||||
disarmWatchdog()
|
||||
armSettledTurnDrain()
|
||||
Log.i(TAG, "Gateway turn settled from $source after missing terminal frame")
|
||||
callbacks.onReconcileRequired()
|
||||
callbacks.onComplete()
|
||||
@@ -4419,6 +4602,7 @@ class GatewayChatClient(
|
||||
callbacks = dispatchOn(registration.callbacks),
|
||||
dedupeAdjacentMessageStarts = true,
|
||||
deferEvents = true,
|
||||
androidOwned = true,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -4546,6 +4730,26 @@ class GatewayChatClient(
|
||||
)
|
||||
}
|
||||
|
||||
private fun armSettledTurnDrain() {
|
||||
val storedId = storedSessionId ?: return
|
||||
val liveId = liveSessionId ?: return
|
||||
settledTurnDrain = SettledTurnDrain(storedId, liveId)
|
||||
}
|
||||
|
||||
/** Consume one late terminal from a turn already settled by session state. */
|
||||
private fun consumeSettledTurnTerminal(type: String, eventSessionId: String?): Boolean {
|
||||
val drain = settledTurnDrain ?: return false
|
||||
if (eventSessionId != drain.liveSessionId) return false
|
||||
if (type == "message.start") {
|
||||
if (settledTurnDrain === drain) settledTurnDrain = null
|
||||
return false
|
||||
}
|
||||
if (type != "message.complete" && type != "error") return false
|
||||
if (settledTurnDrain === drain) settledTurnDrain = null
|
||||
Log.d(TAG, "Ignored late terminal for gateway turn settled from session state")
|
||||
return true
|
||||
}
|
||||
|
||||
private fun updateCancelledDrainLiveSession(storedId: String, liveId: String) {
|
||||
val drain = cancelledTurnDrain ?: return
|
||||
if (drain.storedSessionId == storedId) {
|
||||
@@ -4672,6 +4876,11 @@ class GatewayChatClient(
|
||||
dispatchIfCurrent(stillCurrent) { callbacks.onStatusUpdate(kind, text) }
|
||||
},
|
||||
onStatusClear = { kind -> dispatchIfCurrent(stillCurrent) { callbacks.onStatusClear(kind) } },
|
||||
onNoticeShow = { notice -> dispatchIfCurrent(stillCurrent) { callbacks.onNoticeShow(notice) } },
|
||||
onNoticeClear = { key -> dispatchIfCurrent(stillCurrent) { callbacks.onNoticeClear(key) } },
|
||||
onSubmitRejected = { message ->
|
||||
dispatchIfCurrent(stillCurrent) { callbacks.onSubmitRejected(message) }
|
||||
},
|
||||
)
|
||||
|
||||
private fun dispatchIfCurrent(stillCurrent: () -> Boolean, callback: () -> Unit) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.contentOrNull
|
||||
import kotlinx.serialization.json.doubleOrNull
|
||||
import kotlinx.serialization.json.intOrNull
|
||||
import kotlinx.serialization.json.longOrNull
|
||||
import kotlinx.serialization.json.booleanOrNull
|
||||
|
||||
/**
|
||||
@@ -278,7 +279,12 @@ class GatewayEventMapper(
|
||||
|
||||
"error" -> {
|
||||
turnEnded = true
|
||||
callbacks.onError(payload.string("message") ?: "Gateway error")
|
||||
val message = payload.string("message") ?: "Gateway error"
|
||||
if (isSessionOwnershipRejection(message)) {
|
||||
callbacks.onSubmitRejected(message)
|
||||
} else {
|
||||
callbacks.onError(message)
|
||||
}
|
||||
}
|
||||
|
||||
"subagent.spawn_requested", "subagent.start", "subagent.thinking", "subagent.tool",
|
||||
@@ -397,8 +403,26 @@ class GatewayEventMapper(
|
||||
}
|
||||
}
|
||||
|
||||
// Known-but-unrendered (notification.show, …) and unknown types
|
||||
// alike: ignore.
|
||||
"notification.show" -> {
|
||||
val text = payload.string("text")?.trim().orEmpty()
|
||||
if (text.isNotEmpty()) {
|
||||
callbacks.onNoticeShow(
|
||||
GatewayAgentNotice(
|
||||
text = text,
|
||||
level = payload.string("level"),
|
||||
kind = payload.string("kind"),
|
||||
ttlMs = payload.long("ttl_ms"),
|
||||
key = payload.string("key"),
|
||||
id = payload.string("id"),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
"notification.clear" ->
|
||||
payload.string("key")?.trim()?.takeIf(String::isNotEmpty)?.let(callbacks.onNoticeClear)
|
||||
|
||||
// Unknown event types remain forward-compatible no-ops.
|
||||
else -> Unit
|
||||
}
|
||||
previousEventType = type
|
||||
@@ -450,6 +474,19 @@ class GatewayEventMapper(
|
||||
private const val MAX_MOA_REFERENCE_CHARS = 16_000
|
||||
private val OUTPUT_RISK_LEVELS = setOf("low", "medium", "high", "critical")
|
||||
private val TERMINAL_EVENTS = setOf("message.complete", "error")
|
||||
|
||||
/**
|
||||
* Isolated-turn paths can acknowledge `prompt.submit` and then emit
|
||||
* the ownership refusal as a plain terminal `error` event. That event
|
||||
* has no JSON-RPC code or structured reason, so match both stable
|
||||
* clauses from upstream's canonical message.
|
||||
*/
|
||||
internal fun isSessionOwnershipRejection(message: String): Boolean {
|
||||
val normalized = message.lowercase()
|
||||
return "already has a live owner (" in normalized &&
|
||||
"only one surface at a time may run a session" in normalized
|
||||
}
|
||||
|
||||
internal fun isFailedMoaReference(text: String): Boolean {
|
||||
val normalized = text.trimStart().lowercase()
|
||||
return normalized.startsWith("[failed:") || normalized.startsWith("[skipped:")
|
||||
@@ -596,6 +633,9 @@ private fun JsonObject?.string(key: String): String? =
|
||||
private fun JsonObject?.int(key: String): Int? =
|
||||
(this?.get(key) as? JsonPrimitive)?.intOrNull
|
||||
|
||||
private fun JsonObject?.long(key: String): Long? =
|
||||
(this?.get(key) as? JsonPrimitive)?.longOrNull
|
||||
|
||||
private fun JsonObject?.double(key: String): Double? =
|
||||
(this?.get(key) as? JsonPrimitive)?.doubleOrNull
|
||||
|
||||
|
||||
@@ -256,6 +256,16 @@ data class GatewayToolOutputRisk(
|
||||
val redacted: Boolean,
|
||||
)
|
||||
|
||||
/** Official upstream `notification.show` AgentNotice payload. */
|
||||
data class GatewayAgentNotice(
|
||||
val text: String,
|
||||
val level: String? = null,
|
||||
val kind: String? = null,
|
||||
val ttlMs: Long? = null,
|
||||
val key: String? = null,
|
||||
val id: String? = null,
|
||||
)
|
||||
|
||||
/**
|
||||
* One `subagent.*` lifecycle event, emitted on the PARENT session. Lifecycle
|
||||
* per task: SPAWN_REQUESTED → START → (THINKING | TOOL | PROGRESS)* →
|
||||
@@ -727,6 +737,16 @@ class GatewayTurnCallbacks(
|
||||
val onStatusUpdate: (kind: String?, text: String) -> Unit = { _, _ -> },
|
||||
/** Clear a transient status only when [kind] still owns the visible status slot. */
|
||||
val onStatusClear: (kind: String) -> Unit = { _ -> },
|
||||
/** Official upstream account/agent notice; distinct from Relay proactive messages. */
|
||||
val onNoticeShow: (GatewayAgentNotice) -> Unit = { _ -> },
|
||||
/** Exact-key dismissal for an upstream notice. */
|
||||
val onNoticeClear: (key: String) -> Unit = { _ -> },
|
||||
/**
|
||||
* The Gateway authoritatively refused `prompt.submit` before a model turn
|
||||
* began. The composed user row remains local and retryable; callers must
|
||||
* not treat this as a dropped stream or reconcile it from history.
|
||||
*/
|
||||
val onSubmitRejected: (String) -> Unit = onError,
|
||||
)
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.hermesandroid.relay.network.usage
|
||||
import com.hermesandroid.relay.network.relay.RelayHttpClient
|
||||
import com.hermesandroid.relay.network.upstream.GatewayChatClient
|
||||
import com.hermesandroid.relay.network.upstream.DashboardApiClient
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.decodeFromJsonElement
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import kotlinx.serialization.json.booleanOrNull
|
||||
import kotlinx.serialization.json.doubleOrNull
|
||||
|
||||
/** Relay-enhanced usage with an upstream fallback for hosts without Relay support. */
|
||||
/** Upstream usage enriched by the optional Relay provider/pool surface. */
|
||||
class ProviderUsageRepository(
|
||||
private val gatewayClientProvider: () -> GatewayChatClient?,
|
||||
private val dashboardClientProvider: () -> DashboardApiClient? = { null },
|
||||
@@ -14,33 +16,142 @@ class ProviderUsageRepository(
|
||||
private val profileProvider: () -> String? = { null },
|
||||
private val sessionProvider: () -> String? = { null },
|
||||
) {
|
||||
private val json = Json {
|
||||
ignoreUnknownKeys = true
|
||||
coerceInputValues = true
|
||||
explicitNulls = false
|
||||
}
|
||||
|
||||
suspend fun fetch(): Result<ProviderUsageResponse?> {
|
||||
val profile = profileProvider()
|
||||
val session = sessionProvider()
|
||||
val upstream: Result<ProviderUsageResponse?> = gatewayClientProvider()
|
||||
?.usageBars()
|
||||
?.mapCatching(::providerUsageFromUpstreamBars)
|
||||
?: Result.success(null)
|
||||
|
||||
val dashboard = dashboardClientProvider()
|
||||
var enhancement: Result<ProviderUsageResponse?>? = null
|
||||
if (dashboard != null) {
|
||||
val enhanced = dashboard.getProviderUsage(profile, session)
|
||||
if (enhanced.isSuccess && enhanced.getOrNull() != null) return enhanced
|
||||
enhancement = dashboard.getProviderUsage(profile, session)
|
||||
}
|
||||
|
||||
val relay = relayHttpClient.fetchProviderUsage(
|
||||
profile = profile,
|
||||
sessionId = session,
|
||||
if (enhancement?.getOrNull() == null) {
|
||||
enhancement = relayHttpClient.fetchProviderUsage(
|
||||
profile = profile,
|
||||
sessionId = session,
|
||||
)
|
||||
}
|
||||
|
||||
val merged = mergeProviderUsage(
|
||||
upstream = upstream.getOrNull(),
|
||||
enhancement = enhancement?.getOrNull(),
|
||||
)
|
||||
if (relay.isSuccess && relay.getOrNull() != null) return relay
|
||||
if (merged != null) return Result.success(merged)
|
||||
|
||||
val gateway = gatewayClientProvider()
|
||||
if (gateway != null) {
|
||||
val upstream = gateway.providerUsage()
|
||||
.mapCatching { json.decodeFromJsonElement<ProviderUsageResponse>(it) }
|
||||
if (upstream.isSuccess) return upstream
|
||||
return when {
|
||||
upstream.isFailure && enhancement?.isFailure == true ->
|
||||
Result.failure(enhancement?.exceptionOrNull()!!)
|
||||
enhancement?.isFailure == true -> Result.failure(enhancement?.exceptionOrNull()!!)
|
||||
else -> Result.success(null)
|
||||
}
|
||||
return relay
|
||||
}
|
||||
}
|
||||
|
||||
internal fun providerUsageFromUpstreamBars(root: JsonObject): ProviderUsageResponse? {
|
||||
if (root.boolean("available") != true) return null
|
||||
|
||||
val renewsAt = root.string("renews_at")
|
||||
val windows = listOfNotNull(
|
||||
root.usageWindow("plan", "Plan", renewsAt),
|
||||
root.usageWindow("topup", "Top-up", null),
|
||||
)
|
||||
val details = listOfNotNull(
|
||||
root.string("subscription_remaining_display")?.let { "Subscription remaining: $it" },
|
||||
root.string("topup_remaining_display")?.let { "Top-up remaining: $it" },
|
||||
root.string("total_spendable_display")?.let { "Total spendable: $it" },
|
||||
)
|
||||
|
||||
return ProviderUsageResponse(
|
||||
providers = listOf(
|
||||
ProviderUsageProvider(
|
||||
id = "nous",
|
||||
displayName = "Nous",
|
||||
status = ProviderUsageProvider.STATUS_AVAILABLE,
|
||||
source = "upstream:usage.bars",
|
||||
plan = root.string("plan_name"),
|
||||
windows = windows,
|
||||
details = details,
|
||||
renewsAt = renewsAt,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
internal fun mergeProviderUsage(
|
||||
upstream: ProviderUsageResponse?,
|
||||
enhancement: ProviderUsageResponse?,
|
||||
): ProviderUsageResponse? {
|
||||
if (upstream == null) return enhancement
|
||||
if (enhancement == null) return upstream
|
||||
|
||||
val providers = linkedMapOf<String, ProviderUsageProvider>()
|
||||
upstream.providers.forEach { providers[it.id] = it }
|
||||
enhancement.providers.forEach { enhanced ->
|
||||
val standard = providers[enhanced.id]
|
||||
providers[enhanced.id] = when {
|
||||
standard == null -> enhanced
|
||||
standard.available -> standard.copy(
|
||||
// Official usage.bars stays authoritative for every field it
|
||||
// supplies. Relay enriches the row with pool/balance metadata
|
||||
// and fills only gaps that upstream left absent.
|
||||
fetchedAt = standard.fetchedAt ?: enhanced.fetchedAt,
|
||||
plan = standard.plan ?: enhanced.plan,
|
||||
windows = standard.windows.ifEmpty { enhanced.windows },
|
||||
details = (standard.details + enhanced.details).distinct(),
|
||||
balances = enhanced.balances,
|
||||
renewsAt = standard.renewsAt ?: enhanced.renewsAt,
|
||||
actionUrl = standard.actionUrl ?: enhanced.actionUrl,
|
||||
credentials = enhanced.credentials,
|
||||
activeCredentialId = enhanced.activeCredentialId,
|
||||
activeCredentialState = enhanced.activeCredentialState,
|
||||
activeObservedAt = enhanced.activeObservedAt,
|
||||
message = standard.message ?: enhanced.message,
|
||||
)
|
||||
enhanced.available -> enhanced
|
||||
else -> enhanced
|
||||
}
|
||||
}
|
||||
return ProviderUsageResponse(
|
||||
schemaVersion = maxOf(upstream.schemaVersion, enhancement.schemaVersion),
|
||||
fetchedAt = enhancement.fetchedAt ?: upstream.fetchedAt,
|
||||
capabilities = upstream.capabilities + enhancement.capabilities,
|
||||
providers = providers.values.toList(),
|
||||
)
|
||||
}
|
||||
|
||||
private fun JsonObject.usageWindow(
|
||||
id: String,
|
||||
label: String,
|
||||
resetAt: String?,
|
||||
): ProviderUsageWindow? {
|
||||
val bar = this["${id}_bar"] as? JsonObject ?: return null
|
||||
val remaining = bar.string("remaining_display")
|
||||
val total = bar.string("total_display")
|
||||
val detail = when {
|
||||
remaining != null && total != null -> "$remaining remaining of $total"
|
||||
remaining != null -> "$remaining remaining"
|
||||
total != null -> "$total total"
|
||||
else -> null
|
||||
}
|
||||
return ProviderUsageWindow(
|
||||
id = id,
|
||||
label = label,
|
||||
usedPercent = bar.double("pct_used"),
|
||||
resetAt = resetAt,
|
||||
detail = detail,
|
||||
)
|
||||
}
|
||||
|
||||
private fun JsonObject.string(key: String): String? =
|
||||
(this[key] as? JsonPrimitive)?.content?.trim()?.takeIf(String::isNotEmpty)
|
||||
|
||||
private fun JsonObject.boolean(key: String): Boolean? =
|
||||
(this[key] as? JsonPrimitive)?.booleanOrNull
|
||||
|
||||
private fun JsonObject.double(key: String): Double? =
|
||||
(this[key] as? JsonPrimitive)?.doubleOrNull
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.hermesandroid.relay.data.EnhancedVoiceOverrides
|
||||
import com.hermesandroid.relay.data.VoiceAudioRoute
|
||||
import com.hermesandroid.relay.data.VoiceEngineMode
|
||||
import com.hermesandroid.relay.data.VoicePreferencesRepository
|
||||
import com.hermesandroid.relay.data.VoiceProfileScope
|
||||
import com.hermesandroid.relay.data.VoiceSettings
|
||||
import com.hermesandroid.relay.network.relay.RelayVoiceAudioClientAdapter
|
||||
import com.hermesandroid.relay.network.relay.RelayVoiceClient
|
||||
@@ -170,6 +171,9 @@ internal class HermesRuntimeBinder(
|
||||
relayHttpClient = connection.relayHttpClient,
|
||||
mediaSettingsRepo = connection.mediaSettingsRepo,
|
||||
mediaCacheWriter = connection.mediaCacheWriter,
|
||||
dashboardMediaClientProvider = {
|
||||
connection.activeDashboardUrl()?.let(connection::dashboardClientForActive)
|
||||
},
|
||||
)
|
||||
chat.setSelectedProfileProvider { connection.selectedProfile.value }
|
||||
chat.setIsolatedProfileApiProvider { connection.selectedProfileUsesIsolatedApiRoute() }
|
||||
@@ -287,6 +291,36 @@ internal class HermesRuntimeBinder(
|
||||
}
|
||||
}
|
||||
}
|
||||
jobs += runtime.coroutineScope.launch {
|
||||
combine(
|
||||
connection.connectionsHydrated,
|
||||
connection.activeConnectionId,
|
||||
connection.relayConfigured,
|
||||
voiceSettingsHydrated,
|
||||
voicePreferencesRepository.activeScope,
|
||||
) { connectionsReady, connectionId, relayConfigured, settingsReady, scope ->
|
||||
VoiceRelayReconciliationInputs(
|
||||
connectionsReady = connectionsReady,
|
||||
connectionId = connectionId,
|
||||
relayConfigured = relayConfigured,
|
||||
settingsReady = settingsReady,
|
||||
scope = scope,
|
||||
)
|
||||
}.collectLatest { inputs ->
|
||||
if (
|
||||
inputs.connectionsReady &&
|
||||
inputs.settingsReady &&
|
||||
inputs.connectionId != null &&
|
||||
!inputs.relayConfigured &&
|
||||
// Default-profile storage is a legacy global layer shared
|
||||
// across connections. Keep its fallback runtime-only.
|
||||
inputs.scope.profileName != null &&
|
||||
inputs.scope.connectionId == inputs.connectionId
|
||||
) {
|
||||
voicePreferencesRepository.reconcileRelayRemoval(inputs.scope)
|
||||
}
|
||||
}
|
||||
}
|
||||
jobs += runtime.coroutineScope.launch {
|
||||
combine(
|
||||
connection.streamingEndpoint,
|
||||
@@ -403,13 +437,22 @@ internal class HermesRuntimeBinder(
|
||||
connection.chatReady,
|
||||
connection.standardVoiceAvailability,
|
||||
connection.relayVoiceReady,
|
||||
connection.profileSelectionSettled,
|
||||
) { settings, chatReady, standard, relayReady, profileSettled ->
|
||||
connection.relayConfigured,
|
||||
) { settings, chatReady, standard, relayReady, relayConfigured ->
|
||||
VoiceReadinessInputs(
|
||||
settings = settings,
|
||||
chatReady = chatReady,
|
||||
standardAvailability = standard,
|
||||
relayReady = relayReady,
|
||||
relayConfigured = relayConfigured,
|
||||
)
|
||||
}.combine(connection.profileSelectionSettled) { inputs, profileSettled ->
|
||||
resolveVoiceActivationReadiness(
|
||||
settings,
|
||||
chatReady,
|
||||
standard,
|
||||
relayReady,
|
||||
inputs.settings,
|
||||
inputs.chatReady,
|
||||
inputs.standardAvailability,
|
||||
inputs.relayReady,
|
||||
inputs.relayConfigured,
|
||||
profileSettled,
|
||||
)
|
||||
}
|
||||
@@ -563,6 +606,22 @@ internal class HermesRuntimeBinder(
|
||||
val hiddenSources: Set<String> = emptySet(),
|
||||
)
|
||||
|
||||
private data class VoiceRelayReconciliationInputs(
|
||||
val connectionsReady: Boolean,
|
||||
val connectionId: String?,
|
||||
val relayConfigured: Boolean,
|
||||
val settingsReady: Boolean,
|
||||
val scope: VoiceProfileScope,
|
||||
)
|
||||
|
||||
private data class VoiceReadinessInputs(
|
||||
val settings: VoiceSettings,
|
||||
val chatReady: Boolean,
|
||||
val standardAvailability: StandardVoiceAvailability,
|
||||
val relayReady: Boolean,
|
||||
val relayConfigured: Boolean,
|
||||
)
|
||||
|
||||
private companion object {
|
||||
const val PROFILE_SETTLE_BACKSTOP_MS = 2_500L
|
||||
const val PROFILE_CONTEXT_COALESCE_MS = 160L
|
||||
@@ -601,12 +660,14 @@ internal fun resolveVoiceActivationReadiness(
|
||||
chatReady: Boolean,
|
||||
standardAvailability: StandardVoiceAvailability,
|
||||
relayReady: Boolean,
|
||||
relayConfigured: Boolean,
|
||||
profileSettled: Boolean,
|
||||
): HermesVoiceActivationReadiness {
|
||||
if (!profileSettled) {
|
||||
return HermesVoiceActivationReadiness.Waiting("Loading the selected Hermes profile")
|
||||
}
|
||||
return when (VoiceEngineMode.fromStorage(settings.engineMode)) {
|
||||
val effectiveSettings = voiceSettingsForRelayConfiguration(settings, relayConfigured)
|
||||
return when (VoiceEngineMode.fromStorage(effectiveSettings.engineMode)) {
|
||||
VoiceEngineMode.RealtimeAgent -> {
|
||||
if (relayReady) {
|
||||
HermesVoiceActivationReadiness.Ready(HermesVoiceActivationRoute.Realtime)
|
||||
@@ -618,7 +679,7 @@ internal fun resolveVoiceActivationReadiness(
|
||||
if (!chatReady) {
|
||||
return HermesVoiceActivationReadiness.Waiting("Waiting for Hermes chat")
|
||||
}
|
||||
when (VoiceAudioRoute.fromStorage(settings.audioRoute)) {
|
||||
when (VoiceAudioRoute.fromStorage(effectiveSettings.audioRoute)) {
|
||||
VoiceAudioRoute.Relay -> if (relayReady) {
|
||||
HermesVoiceActivationReadiness.Ready(
|
||||
HermesVoiceActivationRoute.RelayAudio
|
||||
@@ -642,6 +703,24 @@ internal fun resolveVoiceActivationReadiness(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Relay absence is a topology decision, unlike a transient route outage. Only
|
||||
* the former may fall back from Relay-only persisted selections.
|
||||
*/
|
||||
internal fun voiceSettingsForRelayConfiguration(
|
||||
settings: VoiceSettings,
|
||||
relayConfigured: Boolean,
|
||||
): VoiceSettings {
|
||||
if (relayConfigured) return settings
|
||||
return settings.copy(
|
||||
engineMode = VoiceEngineMode.HermesVoiceOutput.storageValue,
|
||||
audioRoute = when (VoiceAudioRoute.fromStorage(settings.audioRoute)) {
|
||||
VoiceAudioRoute.Relay -> VoiceAudioRoute.Auto.storageValue
|
||||
else -> settings.audioRoute
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
private fun standardVoiceReadiness(
|
||||
availability: StandardVoiceAvailability,
|
||||
): HermesVoiceActivationReadiness = when (availability) {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.hermesandroid.relay.ui
|
||||
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/** Width policy shared by Chat's content and persistent status surfaces. */
|
||||
internal data class ChatResponsiveLayout(
|
||||
val introMaxWidth: Dp?,
|
||||
val avatarSize: Dp?,
|
||||
val chromeMaxWidth: Dp?,
|
||||
val transcriptMaxWidth: Dp?,
|
||||
val focusVoiceMaxWidth: Dp?,
|
||||
)
|
||||
|
||||
internal fun chatResponsiveLayout(screenWidthDp: Int): ChatResponsiveLayout = when {
|
||||
screenWidthDp >= 840 -> ChatResponsiveLayout(
|
||||
introMaxWidth = 720.dp,
|
||||
avatarSize = 360.dp,
|
||||
chromeMaxWidth = 960.dp,
|
||||
transcriptMaxWidth = 960.dp,
|
||||
focusVoiceMaxWidth = 1120.dp,
|
||||
)
|
||||
screenWidthDp >= 600 -> ChatResponsiveLayout(
|
||||
introMaxWidth = 600.dp,
|
||||
avatarSize = 300.dp,
|
||||
chromeMaxWidth = 760.dp,
|
||||
transcriptMaxWidth = 760.dp,
|
||||
focusVoiceMaxWidth = 760.dp,
|
||||
)
|
||||
else -> ChatResponsiveLayout(
|
||||
introMaxWidth = null,
|
||||
avatarSize = null,
|
||||
chromeMaxWidth = null,
|
||||
transcriptMaxWidth = null,
|
||||
focusVoiceMaxWidth = null,
|
||||
)
|
||||
}
|
||||
|
||||
internal fun useSplitVoiceLayout(screenWidthDp: Int, screenHeightDp: Int): Boolean =
|
||||
screenWidthDp >= 840 && screenWidthDp > screenHeightDp
|
||||
@@ -1015,6 +1015,17 @@ fun RelayApp() {
|
||||
chatSessions.firstOrNull { it.sessionId == currentChatSessionId }
|
||||
}
|
||||
|
||||
LaunchedEffect(
|
||||
gitOwnerKey,
|
||||
activeChatSession?.gitRepoRoot,
|
||||
activeChatSession?.workingDirectory,
|
||||
) {
|
||||
gitStateViewModel.setSessionWorkspace(
|
||||
repoRoot = activeChatSession?.gitRepoRoot,
|
||||
workingDirectory = activeChatSession?.workingDirectory,
|
||||
)
|
||||
}
|
||||
|
||||
// Bind Git to the active coding session when upstream supplies its exact
|
||||
// workspace metadata. CWD fallback only matches a path-segment descendant;
|
||||
// an ambiguous multi-repo catalog stays unselected until the user chooses.
|
||||
@@ -1031,7 +1042,7 @@ fun RelayApp() {
|
||||
}
|
||||
}
|
||||
|
||||
val gitWorkspaceAvailable = gitRepoScanningEnabled &&
|
||||
val gitWorkspaceAvailable =
|
||||
(gitReposState as? GitStateUiState.Ready)?.repos?.isNotEmpty() == true
|
||||
val gitWorkspaceSummary = remember(
|
||||
gitReposState,
|
||||
@@ -2189,6 +2200,9 @@ fun RelayApp() {
|
||||
// Routine in-progress reconnect surfaces here (amber cue)
|
||||
// instead of a take-space banner or a floating toast.
|
||||
reconnecting = connectionReconnecting,
|
||||
maxContentWidth = chatResponsiveLayout(
|
||||
LocalConfiguration.current.screenWidthDp,
|
||||
).chromeMaxWidth,
|
||||
modifier = Modifier.petPerchSurface(
|
||||
key = APP_STATUS_PET_WALK_REGION,
|
||||
routes = APP_STATUS_PET_ROUTES,
|
||||
|
||||
@@ -8,17 +8,38 @@ import kotlinx.coroutines.flow.asSharedFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/** Visual tone of a transient banner message. Errors are NOT modelled here —
|
||||
* they stay on the snackbar (see [LocalSnackbarHost]); this bus is info-only. */
|
||||
enum class UiMessageSeverity { Info, Success, Status }
|
||||
/** Visual tone of a transient banner message. */
|
||||
enum class UiMessageSeverity { Info, Success, Status, Warning }
|
||||
|
||||
data class UiMessage(
|
||||
val id: Long,
|
||||
val text: String,
|
||||
val severity: UiMessageSeverity,
|
||||
val ttlMillis: Long,
|
||||
/** Stable upstream key for replace-in-place and exact dismissal. */
|
||||
val key: String? = null,
|
||||
)
|
||||
|
||||
sealed interface UiMessageEvent {
|
||||
data class Show(val message: UiMessage) : UiMessageEvent
|
||||
data class Clear(val key: String) : UiMessageEvent
|
||||
}
|
||||
|
||||
internal fun reduceUiMessages(
|
||||
current: List<UiMessage>,
|
||||
event: UiMessageEvent,
|
||||
maxRetained: Int,
|
||||
): List<UiMessage> = when (event) {
|
||||
is UiMessageEvent.Clear -> current.filterNot { it.key == event.key }
|
||||
is UiMessageEvent.Show -> {
|
||||
val incoming = event.message
|
||||
val withoutDuplicate = current.filterNot { existing ->
|
||||
if (incoming.key != null) existing.key == incoming.key else existing.text == incoming.text
|
||||
}
|
||||
(withoutDuplicate + incoming).takeLast(maxRetained)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* App-wide bus for transient, non-error status/confirmation messages that
|
||||
* surface in the top [com.hermesandroid.relay.ui.components.MessageBannerHost]
|
||||
@@ -26,8 +47,10 @@ data class UiMessage(
|
||||
* shows the newest line collapsed, expands to a few recent lines, auto-dismisses
|
||||
* and coalesces duplicates.
|
||||
*
|
||||
* Deliberately info-only: errors and persistent/actionable messages keep going
|
||||
* to the snackbar so they demand acknowledgement. Migrate frequent
|
||||
* App-owned errors and persistent/actionable messages keep going to the
|
||||
* snackbar so they demand acknowledgement. Upstream keyed AgentNotices may use
|
||||
* the warning tone here because their own sticky/clear lifecycle owns them.
|
||||
* Migrate frequent
|
||||
* `snackbarHostState.showSnackbar("…")` confirmations/status to [info] /
|
||||
* [success] / [status] here.
|
||||
*
|
||||
@@ -39,8 +62,8 @@ object UiMessageBus {
|
||||
const val STATUS_TTL_MS = 6_000L
|
||||
|
||||
private val counter = AtomicLong(0L)
|
||||
private val _events = MutableSharedFlow<UiMessage>(extraBufferCapacity = 24)
|
||||
val events: SharedFlow<UiMessage> = _events.asSharedFlow()
|
||||
private val _events = MutableSharedFlow<UiMessageEvent>(extraBufferCapacity = 24)
|
||||
val events: SharedFlow<UiMessageEvent> = _events.asSharedFlow()
|
||||
|
||||
// Number of messages currently shown by the host. Lifted here so the app
|
||||
// scaffold can fold banner visibility into its status-bar inset accounting
|
||||
@@ -52,10 +75,26 @@ object UiMessageBus {
|
||||
text: String,
|
||||
severity: UiMessageSeverity = UiMessageSeverity.Info,
|
||||
ttlMillis: Long = DEFAULT_TTL_MS,
|
||||
key: String? = null,
|
||||
) {
|
||||
val trimmed = text.trim()
|
||||
if (trimmed.isEmpty()) return
|
||||
_events.tryEmit(UiMessage(counter.incrementAndGet(), trimmed, severity, ttlMillis))
|
||||
_events.tryEmit(
|
||||
UiMessageEvent.Show(
|
||||
UiMessage(
|
||||
id = counter.incrementAndGet(),
|
||||
text = trimmed,
|
||||
severity = severity,
|
||||
ttlMillis = ttlMillis.coerceAtLeast(0L),
|
||||
key = key?.trim()?.takeIf(String::isNotEmpty),
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
/** Dismiss only the keyed message owned by the matching upstream notice. */
|
||||
fun clear(key: String) {
|
||||
key.trim().takeIf(String::isNotEmpty)?.let { _events.tryEmit(UiMessageEvent.Clear(it)) }
|
||||
}
|
||||
|
||||
/** Neutral confirmation/info (e.g. "Pairing code copied"). */
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.hermesandroid.relay.ui.components
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.net.Uri
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
@@ -97,9 +98,9 @@ private fun isSensitiveAltText(alt: String): Boolean {
|
||||
|
||||
/**
|
||||
* Resolves a server-local image path — an absolute path the agent put in a
|
||||
* markdown image `` — to raw bytes, via the relay's
|
||||
* `/media/by-path` route when a relay session is paired. Returns null when no
|
||||
* relay is available or the fetch fails, so the renderer falls back to the
|
||||
* markdown image `` — to an on-disk cache URI, via the relay's
|
||||
* authenticated Dashboard route (or Relay compatibility route). Returns a
|
||||
* failure when no route is available or the fetch fails, so the renderer falls back to the
|
||||
* "this image is on the server" notice. Provided by ChatScreen from
|
||||
* [com.hermesandroid.relay.viewmodel.ChatViewModel.resolveServerImage]; the
|
||||
* default is null, which preserves the standard (no-plugin) behavior where a
|
||||
@@ -113,12 +114,12 @@ private fun isSensitiveAltText(alt: String): Boolean {
|
||||
* `RelayServerImage` on app open with a server-local image in history).
|
||||
*/
|
||||
sealed interface ServerImageResult {
|
||||
class Success(val bytes: ByteArray, val sensitive: Boolean = false) : ServerImageResult
|
||||
class Success(val cachedUri: String, val sensitive: Boolean = false) : ServerImageResult
|
||||
class Failure(val reason: String) : ServerImageResult
|
||||
}
|
||||
|
||||
fun interface RelayServerImageResolver {
|
||||
/** Fetch the server-local file's bytes over the relay, or a
|
||||
/** Fetch the server-local file into the media cache, or a
|
||||
* [ServerImageResult.Failure] whose reason explains why (unpaired /
|
||||
* sandboxed / missing / decode) so the UI can surface it instead of a
|
||||
* generic placeholder. */
|
||||
@@ -461,6 +462,7 @@ private fun RelayServerImage(
|
||||
maxWidth: Dp,
|
||||
resolver: RelayServerImageResolver,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var phase by remember(image.src) {
|
||||
mutableStateOf<RelayImagePhase>(
|
||||
cachedInlineImage(image.src)
|
||||
@@ -478,15 +480,15 @@ private fun RelayServerImage(
|
||||
}
|
||||
when (result) {
|
||||
is ServerImageResult.Success -> {
|
||||
val bytes = result.bytes
|
||||
val cachedUri = Uri.parse(result.cachedUri)
|
||||
val bmp = runCatching {
|
||||
decodeOrientedBitmap(bytes)
|
||||
decodeOrientedBitmap(context, cachedUri)
|
||||
}.getOrNull()?.asImageBitmap()
|
||||
if (bmp != null) {
|
||||
putInlineImage(image.src, bmp, result.sensitive)
|
||||
RelayImagePhase.Loaded(bmp, result.sensitive)
|
||||
} else {
|
||||
RelayImagePhase.Failed("fetched ${bytes.size} B but couldn't decode the image")
|
||||
RelayImagePhase.Failed("fetched file could not be decoded as an image")
|
||||
}
|
||||
}
|
||||
is ServerImageResult.Failure -> RelayImagePhase.Failed(result.reason)
|
||||
@@ -527,6 +529,7 @@ private fun RelayServerImageContent(
|
||||
maxWidth: Dp,
|
||||
resolver: RelayServerImageResolver,
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
var viewerOpen by remember { mutableStateOf(false) }
|
||||
val blurMode = LocalMediaBlurMode.current
|
||||
var revealed by remember(image.src) { mutableStateOf(false) }
|
||||
@@ -542,7 +545,12 @@ private fun RelayServerImageContent(
|
||||
mime = "image/*",
|
||||
// Save/Share re-fetch the original bytes on demand so we don't
|
||||
// hold them in memory next to the decoded bitmap.
|
||||
bytesProvider = { (resolver.fetch(image.src) as? ServerImageResult.Success)?.bytes },
|
||||
bytesProvider = {
|
||||
(resolver.fetch(image.src) as? ServerImageResult.Success)?.let { fetched ->
|
||||
context.contentResolver.openInputStream(Uri.parse(fetched.cachedUri))
|
||||
?.use { it.readBytes() }
|
||||
}
|
||||
},
|
||||
),
|
||||
onDismiss = { viewerOpen = false },
|
||||
sensitive = sensitive,
|
||||
|
||||
@@ -741,6 +741,7 @@ fun AgentInfoSheet(
|
||||
val relayConnectionState by connectionViewModel.relayConnectionState.collectAsState()
|
||||
val streamingEndpoint by connectionViewModel.streamingEndpoint.collectAsState()
|
||||
val voiceReady by connectionViewModel.voiceReady.collectAsState()
|
||||
val standardVoiceReady by connectionViewModel.standardVoiceReady.collectAsState()
|
||||
val proactiveEnabled by connectionViewModel.proactiveEnabled.collectAsState()
|
||||
val activeEndpoint by connectionViewModel.activeEndpoint.collectAsState()
|
||||
val allConnections by connectionViewModel.connectionStore.connections.collectAsState()
|
||||
@@ -842,6 +843,7 @@ fun AgentInfoSheet(
|
||||
val sessionCaps = sessionCapabilities(
|
||||
transport = sessionTransport,
|
||||
gatewayAvailability = gatewayAvailability,
|
||||
upstreamMediaAvailable = gatewayAvailability == GatewayAvailability.Ready || standardVoiceReady,
|
||||
relayConnected = relayConnectionState == ConnectionState.Connected,
|
||||
relayConfigured = relayUrl.isNotBlank(),
|
||||
voiceReady = voiceReady,
|
||||
@@ -3423,6 +3425,8 @@ private fun LegacyAgentInfoSheet(
|
||||
val sessionCaps = sessionCapabilities(
|
||||
transport = sessionTransport,
|
||||
gatewayAvailability = gatewayAvailability,
|
||||
upstreamMediaAvailable = gatewayAvailability == GatewayAvailability.Ready ||
|
||||
connectionViewModel.standardVoiceReady.collectAsState().value,
|
||||
relayConnected = relayConnected,
|
||||
relayConfigured = relayUrl.isNotBlank(),
|
||||
voiceReady = voiceReady,
|
||||
|
||||
@@ -206,29 +206,49 @@ private fun FailedCard(
|
||||
modifier: Modifier,
|
||||
maxWidth: Dp
|
||||
) {
|
||||
val hostOnly = attachment.errorMessage == ChatViewModel.MEDIA_HOST_ONLY
|
||||
Surface(
|
||||
shape = appearanceRoundedCornerShape(10.dp),
|
||||
color = MaterialTheme.colorScheme.errorContainer,
|
||||
color = if (hostOnly) MaterialTheme.colorScheme.surfaceVariant else MaterialTheme.colorScheme.errorContainer,
|
||||
modifier = modifier
|
||||
.widthIn(max = maxWidth)
|
||||
.clickable { onRetry() }
|
||||
.then(if (hostOnly) Modifier else Modifier.clickable { onRetry() })
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.padding(12.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
Text(text = "\u26A0\uFE0F", style = MaterialTheme.typography.titleMedium)
|
||||
Text(
|
||||
text = if (hostOnly) "\uD83D\uDCCE" else "\u26A0\uFE0F",
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
)
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = attachment.errorMessage ?: stringResource(R.string.inbound_attach_failed),
|
||||
text = if (hostOnly) {
|
||||
stringResource(R.string.inbound_attach_host_only)
|
||||
} else {
|
||||
attachment.errorMessage ?: stringResource(R.string.inbound_attach_failed)
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onErrorContainer
|
||||
color = if (hostOnly) {
|
||||
MaterialTheme.colorScheme.onSurfaceVariant
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onErrorContainer
|
||||
},
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.inbound_attach_tap_retry),
|
||||
text = if (hostOnly) {
|
||||
stringResource(R.string.inbound_attach_host_only_help)
|
||||
} else {
|
||||
stringResource(R.string.inbound_attach_tap_retry)
|
||||
},
|
||||
style = MaterialTheme.typography.labelSmall,
|
||||
color = MaterialTheme.colorScheme.onErrorContainer.copy(alpha = 0.7f)
|
||||
color = if (hostOnly) {
|
||||
MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.7f)
|
||||
} else {
|
||||
MaterialTheme.colorScheme.onErrorContainer.copy(alpha = 0.7f)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -283,15 +303,17 @@ private fun ImageRender(
|
||||
LaunchedEffect(attachment.cachedUri, attachment.content) {
|
||||
val decoded = withContext(Dispatchers.IO) {
|
||||
runCatching {
|
||||
val bytes: ByteArray? = when {
|
||||
when {
|
||||
!attachment.cachedUri.isNullOrBlank() ->
|
||||
context.contentResolver.openInputStream(Uri.parse(attachment.cachedUri))
|
||||
?.use { it.readBytes() }
|
||||
decodeOrientedBitmap(context, Uri.parse(attachment.cachedUri))
|
||||
?.asImageBitmap()
|
||||
attachment.content.isNotBlank() ->
|
||||
android.util.Base64.decode(attachment.content, android.util.Base64.DEFAULT)
|
||||
android.util.Base64.decode(
|
||||
attachment.content,
|
||||
android.util.Base64.DEFAULT,
|
||||
).let { decodeOrientedBitmap(it)?.asImageBitmap() }
|
||||
else -> null
|
||||
}
|
||||
bytes?.let { decodeOrientedBitmap(it)?.asImageBitmap() }
|
||||
}.getOrNull()
|
||||
}
|
||||
if (decoded != null) bitmap = decoded else decodeFailed = true
|
||||
|
||||
@@ -26,6 +26,7 @@ import androidx.compose.material.icons.filled.Info
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material.icons.filled.Sync
|
||||
import androidx.compose.material.icons.filled.Warning
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
@@ -53,7 +54,9 @@ import androidx.compose.ui.unit.dp
|
||||
import com.hermesandroid.relay.R
|
||||
import com.hermesandroid.relay.ui.UiMessage
|
||||
import com.hermesandroid.relay.ui.UiMessageBus
|
||||
import com.hermesandroid.relay.ui.UiMessageEvent
|
||||
import com.hermesandroid.relay.ui.UiMessageSeverity
|
||||
import com.hermesandroid.relay.ui.reduceUiMessages
|
||||
import kotlinx.coroutines.delay
|
||||
|
||||
private const val MAX_RETAINED = 6
|
||||
@@ -68,7 +71,8 @@ private const val ROW_MIN_HEIGHT_DP = 34
|
||||
* overlay. Auto-dismisses (paused while expanded) and coalesces duplicates so a
|
||||
* burst of the same status collapses to one refreshed row.
|
||||
*
|
||||
* Errors stay on the snackbar — only post info/success/status here.
|
||||
* App-owned errors stay on the snackbar. Keyed upstream AgentNotices may also
|
||||
* use the warning tone because their sticky/clear lifecycle is server-owned.
|
||||
*/
|
||||
@Composable
|
||||
fun MessageBannerHost(
|
||||
@@ -82,18 +86,19 @@ fun MessageBannerHost(
|
||||
var expanded by remember { mutableStateOf(false) }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
UiMessageBus.events.collect { msg ->
|
||||
// Coalesce identical text so e.g. repeated "Reconnecting…" collapses
|
||||
// to a single, freshly-timed row rather than stacking.
|
||||
shown.filter { it.text == msg.text }.forEach { dup ->
|
||||
shown.remove(dup)
|
||||
expiresAt.remove(dup.id)
|
||||
}
|
||||
shown.add(msg)
|
||||
expiresAt[msg.id] = nowMs() + msg.ttlMillis
|
||||
while (shown.size > MAX_RETAINED) {
|
||||
val dropped = shown.removeAt(0)
|
||||
expiresAt.remove(dropped.id)
|
||||
UiMessageBus.events.collect { event ->
|
||||
val next = reduceUiMessages(shown, event, MAX_RETAINED)
|
||||
val retainedIds = next.mapTo(mutableSetOf()) { it.id }
|
||||
expiresAt.keys.filterNot(retainedIds::contains).forEach { expiresAt.remove(it) }
|
||||
shown.clear()
|
||||
shown.addAll(next)
|
||||
if (event is UiMessageEvent.Show) {
|
||||
val msg = event.message
|
||||
expiresAt[msg.id] = if (msg.ttlMillis == 0L) {
|
||||
Long.MAX_VALUE
|
||||
} else {
|
||||
nowMs() + msg.ttlMillis
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,6 +109,7 @@ fun MessageBannerHost(
|
||||
while (shown.isNotEmpty()) {
|
||||
val now = nowMs()
|
||||
val soonest = shown.minOfOrNull { expiresAt[it.id] ?: Long.MAX_VALUE } ?: break
|
||||
if (soonest == Long.MAX_VALUE) break
|
||||
if (soonest <= now) {
|
||||
shown.filter { (expiresAt[it.id] ?: Long.MAX_VALUE) <= now }.forEach { expired ->
|
||||
shown.remove(expired)
|
||||
@@ -281,6 +287,7 @@ private fun MessageRow(
|
||||
private fun severityContainer(severity: UiMessageSeverity): Color = when (severity) {
|
||||
UiMessageSeverity.Success -> MaterialTheme.colorScheme.tertiaryContainer.copy(alpha = 0.58f)
|
||||
UiMessageSeverity.Status -> MaterialTheme.colorScheme.secondaryContainer.copy(alpha = 0.74f)
|
||||
UiMessageSeverity.Warning -> MaterialTheme.colorScheme.errorContainer.copy(alpha = 0.72f)
|
||||
UiMessageSeverity.Info -> MaterialTheme.colorScheme.surfaceVariant.copy(alpha = 0.90f)
|
||||
}
|
||||
|
||||
@@ -288,12 +295,14 @@ private fun severityContainer(severity: UiMessageSeverity): Color = when (severi
|
||||
private fun severityOnContainer(severity: UiMessageSeverity): Color = when (severity) {
|
||||
UiMessageSeverity.Success -> MaterialTheme.colorScheme.onTertiaryContainer
|
||||
UiMessageSeverity.Status -> MaterialTheme.colorScheme.onSecondaryContainer
|
||||
UiMessageSeverity.Warning -> MaterialTheme.colorScheme.onErrorContainer
|
||||
UiMessageSeverity.Info -> MaterialTheme.colorScheme.onSurfaceVariant
|
||||
}
|
||||
|
||||
private fun severityIcon(severity: UiMessageSeverity): ImageVector = when (severity) {
|
||||
UiMessageSeverity.Success -> Icons.Filled.CheckCircle
|
||||
UiMessageSeverity.Status -> Icons.Filled.Sync
|
||||
UiMessageSeverity.Warning -> Icons.Filled.Warning
|
||||
UiMessageSeverity.Info -> Icons.Filled.Info
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.hermesandroid.relay.ui.components
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Matrix
|
||||
import android.net.Uri
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import java.io.ByteArrayInputStream
|
||||
|
||||
@@ -62,3 +64,30 @@ internal fun decodeOrientedBitmap(
|
||||
if (oriented !== decoded) decoded.recycle()
|
||||
} ?: decoded
|
||||
}
|
||||
|
||||
/** Decode a cached content URI without first copying the encoded file into RAM. */
|
||||
internal fun decodeOrientedBitmap(context: Context, uri: Uri): Bitmap? {
|
||||
val decoded = context.contentResolver.openFileDescriptor(uri, "r")?.use { descriptor ->
|
||||
BitmapFactory.decodeFileDescriptor(descriptor.fileDescriptor)
|
||||
} ?: return null
|
||||
val orientation = runCatching {
|
||||
context.contentResolver.openFileDescriptor(uri, "r")?.use { descriptor ->
|
||||
ExifInterface(descriptor.fileDescriptor).getAttributeInt(
|
||||
ExifInterface.TAG_ORIENTATION,
|
||||
ExifInterface.ORIENTATION_NORMAL,
|
||||
)
|
||||
}
|
||||
}.getOrNull() ?: ExifInterface.ORIENTATION_NORMAL
|
||||
val transform = imageOrientationTransform(orientation)
|
||||
if (transform.rotationDegrees == 0f && !transform.flipHorizontal) return decoded
|
||||
|
||||
val matrix = Matrix().apply {
|
||||
if (transform.rotationDegrees != 0f) postRotate(transform.rotationDegrees)
|
||||
if (transform.flipHorizontal) postScale(-1f, 1f)
|
||||
}
|
||||
return runCatching {
|
||||
Bitmap.createBitmap(decoded, 0, 0, decoded.width, decoded.height, matrix, true)
|
||||
}.getOrNull()?.also { oriented ->
|
||||
if (oriented !== decoded) decoded.recycle()
|
||||
} ?: decoded
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
@@ -15,6 +16,7 @@ import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.safeDrawing
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.material3.Text
|
||||
@@ -24,6 +26,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.hermesandroid.relay.R
|
||||
@@ -48,63 +51,70 @@ fun RelayStatusStrip(
|
||||
* surfaces — the top chrome stays empty so chat content never shifts.
|
||||
*/
|
||||
reconnecting: Boolean = false,
|
||||
maxContentWidth: Dp? = null,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.windowInsetsPadding(
|
||||
WindowInsets.safeDrawing.only(
|
||||
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom,
|
||||
),
|
||||
)
|
||||
.padding(start = 14.dp, end = 14.dp, top = 3.dp, bottom = 4.dp)
|
||||
.clip(appearanceRoundedCornerShape(16.dp))
|
||||
.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier)
|
||||
.relayPanel(
|
||||
shape = appearanceRoundedCornerShape(16.dp),
|
||||
background = RelayRefresh.Navy2.copy(alpha = 0.88f),
|
||||
borderColor = RelayRefresh.Line,
|
||||
),
|
||||
Box(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
Column(
|
||||
modifier = modifier
|
||||
.then(maxContentWidth?.let { Modifier.widthIn(max = it) } ?: Modifier)
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 22.dp)
|
||||
.padding(horizontal = 14.dp, vertical = 2.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
.windowInsetsPadding(
|
||||
WindowInsets.safeDrawing.only(
|
||||
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom,
|
||||
),
|
||||
)
|
||||
.padding(start = 14.dp, end = 14.dp, top = 3.dp, bottom = 4.dp)
|
||||
.clip(appearanceRoundedCornerShape(16.dp))
|
||||
.then(if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier)
|
||||
.relayPanel(
|
||||
shape = appearanceRoundedCornerShape(16.dp),
|
||||
background = RelayRefresh.Navy2.copy(alpha = 0.88f),
|
||||
borderColor = RelayRefresh.Line,
|
||||
),
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(min = 22.dp)
|
||||
.padding(horizontal = 14.dp, vertical = 2.dp),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
leadingBadge()
|
||||
if (securityGlyph != null) {
|
||||
securityGlyph()
|
||||
}
|
||||
// Route is in flux mid-reconnect, so the amber cue replaces the
|
||||
// route label rather than stacking beside it in the 22dp strip.
|
||||
when {
|
||||
reconnecting -> ReconnectingCue(modifier = Modifier.weight(1f))
|
||||
routeLabel.isNotBlank() -> Text(
|
||||
text = "· $routeLabel",
|
||||
style = relayMetadataStyle(),
|
||||
color = RelayRefresh.Muted,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
Row(
|
||||
modifier = Modifier.weight(1f),
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
leadingBadge()
|
||||
if (securityGlyph != null) {
|
||||
securityGlyph()
|
||||
}
|
||||
// Route is in flux mid-reconnect, so the amber cue replaces the
|
||||
// route label rather than stacking beside it in the 22dp strip.
|
||||
when {
|
||||
reconnecting -> ReconnectingCue(modifier = Modifier.weight(1f))
|
||||
routeLabel.isNotBlank() -> Text(
|
||||
text = "· $routeLabel",
|
||||
style = relayMetadataStyle(),
|
||||
color = RelayRefresh.Muted,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.weight(1f),
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
Text(
|
||||
text = trailing,
|
||||
style = relayMetadataStyle(),
|
||||
color = RelayRefresh.Muted,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.width(10.dp))
|
||||
Text(
|
||||
text = trailing,
|
||||
style = relayMetadataStyle(),
|
||||
color = RelayRefresh.Muted,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,8 +141,8 @@ internal data class SessionCapability(
|
||||
* live. SSE paths only get post-hoc reasoning, so this is gateway-only.
|
||||
* While the gateway is still being probed (Unknown) we surface it as a
|
||||
* "checking" reason rather than a confirmed chip.
|
||||
* - Media / Terminal → require the relay to be CONNECTED (the relay brokers
|
||||
* those channels). A configured-but-disconnected relay is not enough.
|
||||
* - Media → current upstream Dashboard managed-file delivery OR connected
|
||||
* Relay compatibility transport. Terminal remains Relay-owned.
|
||||
* - Voice → `voiceReady` (standard dashboard voice OR relay voice — whichever
|
||||
* the connection actually has).
|
||||
*/
|
||||
@@ -150,6 +150,7 @@ internal data class SessionCapability(
|
||||
internal fun sessionCapabilities(
|
||||
transport: SessionPathTransport,
|
||||
gatewayAvailability: GatewayAvailability,
|
||||
upstreamMediaAvailable: Boolean,
|
||||
relayConnected: Boolean,
|
||||
relayConfigured: Boolean,
|
||||
voiceReady: Boolean,
|
||||
@@ -170,11 +171,11 @@ internal fun sessionCapabilities(
|
||||
),
|
||||
SessionCapability(
|
||||
type = "media",
|
||||
available = relayConnected,
|
||||
available = upstreamMediaAvailable || relayConnected,
|
||||
reason = when {
|
||||
relayConnected -> null
|
||||
upstreamMediaAvailable || relayConnected -> null
|
||||
relayConfigured -> stringResource(R.string.session_path_relay_not_connected)
|
||||
else -> stringResource(R.string.session_path_pair_relay_media)
|
||||
else -> stringResource(R.string.session_path_media_not_ready)
|
||||
},
|
||||
),
|
||||
SessionCapability(
|
||||
|
||||
@@ -23,14 +23,18 @@ import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyListState
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
@@ -71,6 +75,7 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
|
||||
import androidx.compose.ui.input.key.onPreviewKeyEvent
|
||||
import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.LocalConfiguration
|
||||
import androidx.compose.ui.platform.LocalHapticFeedback
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.Role
|
||||
@@ -81,6 +86,7 @@ import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.hermesandroid.relay.data.ChatMessage
|
||||
@@ -92,7 +98,9 @@ import com.hermesandroid.relay.ui.components.avatar.AvatarRenderState
|
||||
import com.hermesandroid.relay.ui.components.avatar.LocalAgentAvatar
|
||||
import com.hermesandroid.relay.ui.components.avatar.LocalBackgroundVisualizationEnabled
|
||||
import com.hermesandroid.relay.ui.LocalSnackbarHost
|
||||
import com.hermesandroid.relay.ui.chatResponsiveLayout
|
||||
import com.hermesandroid.relay.ui.showHumanError
|
||||
import com.hermesandroid.relay.ui.useSplitVoiceLayout
|
||||
import com.hermesandroid.relay.util.HumanError
|
||||
import kotlinx.coroutines.delay
|
||||
import com.hermesandroid.relay.viewmodel.BackgroundRunPhase
|
||||
@@ -112,6 +120,8 @@ import com.hermesandroid.relay.R
|
||||
import com.hermesandroid.relay.ui.theme.appearanceRoundedCornerShape
|
||||
|
||||
internal const val VOICE_MODE_MIC_TEST_TAG = "voiceModeMic"
|
||||
internal const val VOICE_FOCUS_SPLIT_LAYOUT_TEST_TAG = "voiceFocusSplitLayout"
|
||||
internal const val VOICE_FOCUS_STACKED_LAYOUT_TEST_TAG = "voiceFocusStackedLayout"
|
||||
|
||||
/**
|
||||
* Full-screen voice-mode overlay. Renders the MorphingSphere in its voiceMode
|
||||
@@ -186,6 +196,56 @@ fun VoiceModeOverlay(
|
||||
val backgroundVisualizationEnabled = LocalBackgroundVisualizationEnabled.current
|
||||
val surface = MaterialTheme.colorScheme.surface
|
||||
val haptic = LocalHapticFeedback.current
|
||||
val configuration = LocalConfiguration.current
|
||||
val responsiveLayout = chatResponsiveLayout(configuration.screenWidthDp)
|
||||
val splitFocusLayout = useSplitVoiceLayout(
|
||||
screenWidthDp = configuration.screenWidthDp,
|
||||
screenHeightDp = configuration.screenHeightDp,
|
||||
)
|
||||
|
||||
val focusMicTap: () -> Unit = {
|
||||
dispatchVoiceMicTap(
|
||||
uiState = uiState,
|
||||
onStartListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicTap()
|
||||
},
|
||||
onStopListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicRelease()
|
||||
},
|
||||
onInterrupt = onInterrupt,
|
||||
onPauseAutoMode = onPauseAutoMode,
|
||||
)
|
||||
}
|
||||
val focusMicHoldPress: () -> Unit = {
|
||||
dispatchVoiceMicHoldPress(
|
||||
uiState = uiState,
|
||||
onStartListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicTap()
|
||||
},
|
||||
onInterruptAndStart = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onInterrupt()
|
||||
onMicTap()
|
||||
},
|
||||
)
|
||||
}
|
||||
val focusMicHoldRelease: () -> Unit = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicRelease()
|
||||
}
|
||||
|
||||
var controlsExpanded by remember { mutableStateOf(false) }
|
||||
val focusMode = presentationMode == VoicePresentationMode.Focus
|
||||
@@ -253,6 +313,11 @@ fun VoiceModeOverlay(
|
||||
onOpenSettings = onOpenSettings,
|
||||
onExit = onDismiss,
|
||||
modifier = Modifier
|
||||
.then(
|
||||
responsiveLayout.focusVoiceMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.statusBarsPadding()
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
@@ -328,162 +393,93 @@ fun VoiceModeOverlay(
|
||||
exit = fadeOut(tween(120)),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(top = 92.dp, bottom = 160.dp, start = 20.dp, end = 20.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1.0f),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
if (backgroundVisualizationEnabled) {
|
||||
LocalAgentAvatar.current.Render(
|
||||
state = AvatarRenderState(
|
||||
state = voiceStateToSphereState(uiState.state),
|
||||
voiceAmplitude = uiState.amplitude,
|
||||
voiceMode = true,
|
||||
),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
if (splitFocusLayout) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.widthIn(max = responsiveLayout.focusVoiceMaxWidth ?: 1120.dp)
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
.padding(top = 92.dp, bottom = 28.dp, start = 32.dp, end = 32.dp)
|
||||
.testTag(VOICE_FOCUS_SPLIT_LAYOUT_TEST_TAG),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
VoiceFocusIdentityPane(
|
||||
uiState = uiState,
|
||||
backgroundVisualizationEnabled = backgroundVisualizationEnabled,
|
||||
onMicTap = focusMicTap,
|
||||
onMicHoldPress = focusMicHoldPress,
|
||||
onMicHoldRelease = focusMicHoldRelease,
|
||||
showMic = true,
|
||||
modifier = Modifier
|
||||
.weight(0.86f)
|
||||
.fillMaxHeight(),
|
||||
)
|
||||
Spacer(Modifier.width(32.dp))
|
||||
VoiceFocusStatusAndTranscriptPane(
|
||||
uiState = uiState,
|
||||
transcriptMessages = visibleTranscriptMessages,
|
||||
pendingTranscriptText = pendingTranscriptText,
|
||||
transcriptListState = transcriptListState,
|
||||
showThinking = showThinking,
|
||||
onBackgroundRunCancel = onBackgroundRunCancel,
|
||||
onBackgroundRunTap = onBackgroundRunTap,
|
||||
onPermissionDeniedChipTap = onPermissionDeniedChipTap,
|
||||
onHermesConfirmationAnswer = onHermesConfirmationAnswer,
|
||||
onPresentationModeChange = onPresentationModeChange,
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
horizontalContentPadding = 0.dp,
|
||||
modifier = Modifier
|
||||
.weight(1.14f)
|
||||
.fillMaxHeight(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
VoiceWaveform(
|
||||
amplitude = uiState.amplitude,
|
||||
state = uiState.state,
|
||||
outputAudioActive = uiState.outputAudioActive,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 32.dp, vertical = 8.dp),
|
||||
)
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = uiState.handoffStatus != null,
|
||||
enter = fadeIn(tween(140)),
|
||||
exit = fadeOut(tween(180)),
|
||||
) {
|
||||
VoiceHandoffStrip(
|
||||
status = uiState.handoffStatus,
|
||||
} else {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 4.dp),
|
||||
)
|
||||
}
|
||||
|
||||
BackgroundRunChip(
|
||||
run = uiState.backgroundRun,
|
||||
onCancel = onBackgroundRunCancel,
|
||||
onTap = onBackgroundRunTap,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 4.dp),
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(8.dp))
|
||||
|
||||
DestructiveCountdownRow(
|
||||
countdown = uiState.destructiveCountdown,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp),
|
||||
)
|
||||
|
||||
PermissionDeniedChip(
|
||||
callout = uiState.permissionDeniedCallout,
|
||||
onTap = onPermissionDeniedChipTap,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 4.dp),
|
||||
)
|
||||
|
||||
HermesConfirmationCard(
|
||||
confirmation = uiState.hermesConfirmation,
|
||||
onAnswer = onHermesConfirmationAnswer,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 24.dp, vertical = 4.dp),
|
||||
)
|
||||
|
||||
Spacer(Modifier.height(4.dp))
|
||||
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1.25f, fill = true),
|
||||
) {
|
||||
val hasTranscript = visibleTranscriptMessages.isNotEmpty() ||
|
||||
pendingTranscriptText != null
|
||||
if (hasTranscript) {
|
||||
val latestId = visibleTranscriptMessages.lastOrNull()?.id
|
||||
LazyColumn(
|
||||
state = transcriptListState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
// Match ChatScreen's identity contract. A history
|
||||
// reconcile can adopt the same authoritative server
|
||||
// id into a live row while Compose still holds the
|
||||
// pre-reconcile row for a frame. uiKey remains stable
|
||||
// and unique across that transition.
|
||||
items(visibleTranscriptMessages, key = ::voiceTranscriptItemKey) { msg ->
|
||||
CompactTranscriptRow(
|
||||
message = msg,
|
||||
showThinking = showThinking,
|
||||
expanded = msg.id == latestId || msg.isStreaming,
|
||||
onViewConversation = {
|
||||
onPresentationModeChange(VoicePresentationMode.Conversation)
|
||||
},
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
)
|
||||
}
|
||||
if (pendingTranscriptText != null) {
|
||||
item(key = "aux:pending-voice-transcript") {
|
||||
CompactTranscriptRow(
|
||||
message = ChatMessage(
|
||||
id = "pending-voice-transcript",
|
||||
role = MessageRole.USER,
|
||||
content = pendingTranscriptText,
|
||||
timestamp = System.currentTimeMillis(),
|
||||
isStreaming = true,
|
||||
),
|
||||
showThinking = showThinking,
|
||||
expanded = true,
|
||||
onViewConversation = {
|
||||
onPresentationModeChange(VoicePresentationMode.Conversation)
|
||||
},
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Spacer(Modifier.height(12.dp)) }
|
||||
}
|
||||
} else {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
AnimatedContent(
|
||||
targetState = stateHint(uiState.state),
|
||||
transitionSpec = {
|
||||
fadeIn(tween(200)) togetherWith fadeOut(tween(200))
|
||||
},
|
||||
label = "stateHint",
|
||||
) { hint ->
|
||||
Text(
|
||||
text = hint,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
}
|
||||
.then(
|
||||
responsiveLayout.focusVoiceMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
)
|
||||
.fillMaxSize()
|
||||
.padding(top = 92.dp, bottom = 160.dp, start = 20.dp, end = 20.dp)
|
||||
.testTag(VOICE_FOCUS_STACKED_LAYOUT_TEST_TAG),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
VoiceFocusIdentityPane(
|
||||
uiState = uiState,
|
||||
backgroundVisualizationEnabled = backgroundVisualizationEnabled,
|
||||
onMicTap = focusMicTap,
|
||||
onMicHoldPress = focusMicHoldPress,
|
||||
onMicHoldRelease = focusMicHoldRelease,
|
||||
showMic = false,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f),
|
||||
)
|
||||
VoiceFocusStatusAndTranscriptPane(
|
||||
uiState = uiState,
|
||||
transcriptMessages = visibleTranscriptMessages,
|
||||
pendingTranscriptText = pendingTranscriptText,
|
||||
transcriptListState = transcriptListState,
|
||||
showThinking = showThinking,
|
||||
onBackgroundRunCancel = onBackgroundRunCancel,
|
||||
onBackgroundRunTap = onBackgroundRunTap,
|
||||
onPermissionDeniedChipTap = onPermissionDeniedChipTap,
|
||||
onHermesConfirmationAnswer = onHermesConfirmationAnswer,
|
||||
onPresentationModeChange = onPresentationModeChange,
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
horizontalContentPadding = 24.dp,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1.25f),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -498,6 +494,12 @@ fun VoiceModeOverlay(
|
||||
exit = fadeOut(tween(180)),
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.then(
|
||||
responsiveLayout.chromeMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 176.dp, start = 24.dp, end = 24.dp),
|
||||
) {
|
||||
BackgroundRunChip(
|
||||
@@ -515,6 +517,12 @@ fun VoiceModeOverlay(
|
||||
exit = fadeOut(),
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopCenter)
|
||||
.then(
|
||||
responsiveLayout.chromeMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.padding(top = 64.dp, start = 16.dp, end = 16.dp),
|
||||
) {
|
||||
Surface(
|
||||
@@ -570,57 +578,205 @@ fun VoiceModeOverlay(
|
||||
// that visually said "Stop" but was actually wired to "Start."
|
||||
VoiceMicButton(
|
||||
uiState = uiState,
|
||||
onTap = {
|
||||
dispatchVoiceMicTap(
|
||||
uiState = uiState,
|
||||
onStartListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicTap()
|
||||
},
|
||||
onStopListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicRelease()
|
||||
},
|
||||
onInterrupt = onInterrupt,
|
||||
onPauseAutoMode = onPauseAutoMode,
|
||||
)
|
||||
},
|
||||
onHoldPress = {
|
||||
dispatchVoiceMicHoldPress(
|
||||
uiState = uiState,
|
||||
onStartListening = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicTap()
|
||||
},
|
||||
onInterruptAndStart = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onInterrupt()
|
||||
onMicTap()
|
||||
},
|
||||
)
|
||||
},
|
||||
onHoldRelease = {
|
||||
try {
|
||||
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
|
||||
} catch (_: Exception) { /* ignore */ }
|
||||
onMicRelease()
|
||||
},
|
||||
onTap = focusMicTap,
|
||||
onHoldPress = focusMicHoldPress,
|
||||
onHoldRelease = focusMicHoldRelease,
|
||||
modifier = Modifier
|
||||
.align(Alignment.BottomCenter)
|
||||
.padding(bottom = 48.dp),
|
||||
visible = focusMode,
|
||||
visible = focusMode && !splitFocusLayout,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun VoiceFocusIdentityPane(
|
||||
uiState: VoiceUiState,
|
||||
backgroundVisualizationEnabled: Boolean,
|
||||
onMicTap: () -> Unit,
|
||||
onMicHoldPress: () -> Unit,
|
||||
onMicHoldRelease: () -> Unit,
|
||||
showMic: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(
|
||||
modifier = modifier.testTag("voiceFocusIdentityPane"),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
if (backgroundVisualizationEnabled) {
|
||||
LocalAgentAvatar.current.Render(
|
||||
state = AvatarRenderState(
|
||||
state = voiceStateToSphereState(uiState.state),
|
||||
voiceAmplitude = uiState.amplitude,
|
||||
voiceMode = true,
|
||||
),
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
)
|
||||
}
|
||||
}
|
||||
VoiceWaveform(
|
||||
amplitude = uiState.amplitude,
|
||||
state = uiState.state,
|
||||
outputAudioActive = uiState.outputAudioActive,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 20.dp, vertical = 8.dp),
|
||||
)
|
||||
if (showMic) {
|
||||
Spacer(Modifier.height(16.dp))
|
||||
VoiceMicButton(
|
||||
uiState = uiState,
|
||||
onTap = onMicTap,
|
||||
onHoldPress = onMicHoldPress,
|
||||
onHoldRelease = onMicHoldRelease,
|
||||
visible = true,
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun VoiceFocusStatusAndTranscriptPane(
|
||||
uiState: VoiceUiState,
|
||||
transcriptMessages: List<ChatMessage>,
|
||||
pendingTranscriptText: String?,
|
||||
transcriptListState: LazyListState,
|
||||
showThinking: Boolean,
|
||||
onBackgroundRunCancel: () -> Unit,
|
||||
onBackgroundRunTap: () -> Unit,
|
||||
onPermissionDeniedChipTap: (PermissionDeniedCallout) -> Unit,
|
||||
onHermesConfirmationAnswer: (String) -> Unit,
|
||||
onPresentationModeChange: (VoicePresentationMode) -> Unit,
|
||||
onCardAction: (messageId: String, cardKey: String, action: HermesCardAction) -> Unit,
|
||||
onCardInput: (messageId: String, cardKey: String, value: String) -> Unit,
|
||||
horizontalContentPadding: Dp,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
Column(modifier = modifier.testTag("voiceFocusTranscriptPane")) {
|
||||
AnimatedVisibility(
|
||||
visible = uiState.handoffStatus != null,
|
||||
enter = fadeIn(tween(140)),
|
||||
exit = fadeOut(tween(180)),
|
||||
) {
|
||||
VoiceHandoffStrip(
|
||||
status = uiState.handoffStatus,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalContentPadding, vertical = 4.dp),
|
||||
)
|
||||
}
|
||||
BackgroundRunChip(
|
||||
run = uiState.backgroundRun,
|
||||
onCancel = onBackgroundRunCancel,
|
||||
onTap = onBackgroundRunTap,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalContentPadding, vertical = 4.dp),
|
||||
)
|
||||
Spacer(Modifier.height(8.dp))
|
||||
DestructiveCountdownRow(
|
||||
countdown = uiState.destructiveCountdown,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalContentPadding),
|
||||
)
|
||||
PermissionDeniedChip(
|
||||
callout = uiState.permissionDeniedCallout,
|
||||
onTap = onPermissionDeniedChipTap,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalContentPadding, vertical = 4.dp),
|
||||
)
|
||||
HermesConfirmationCard(
|
||||
confirmation = uiState.hermesConfirmation,
|
||||
onAnswer = onHermesConfirmationAnswer,
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = horizontalContentPadding, vertical = 4.dp),
|
||||
)
|
||||
Spacer(Modifier.height(4.dp))
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(1f, fill = true),
|
||||
) {
|
||||
val hasTranscript = transcriptMessages.isNotEmpty() || pendingTranscriptText != null
|
||||
if (hasTranscript) {
|
||||
val latestId = transcriptMessages.lastOrNull()?.id
|
||||
LazyColumn(
|
||||
state = transcriptListState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
// uiKey remains stable while Gateway reconciliation adopts
|
||||
// an authoritative server id into a live transcript row.
|
||||
items(transcriptMessages, key = ::voiceTranscriptItemKey) { msg ->
|
||||
CompactTranscriptRow(
|
||||
message = msg,
|
||||
showThinking = showThinking,
|
||||
expanded = msg.id == latestId || msg.isStreaming,
|
||||
onViewConversation = {
|
||||
onPresentationModeChange(VoicePresentationMode.Conversation)
|
||||
},
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
)
|
||||
}
|
||||
if (pendingTranscriptText != null) {
|
||||
item(key = "aux:pending-voice-transcript") {
|
||||
CompactTranscriptRow(
|
||||
message = ChatMessage(
|
||||
id = "pending-voice-transcript",
|
||||
role = MessageRole.USER,
|
||||
content = pendingTranscriptText,
|
||||
timestamp = System.currentTimeMillis(),
|
||||
isStreaming = true,
|
||||
),
|
||||
showThinking = showThinking,
|
||||
expanded = true,
|
||||
onViewConversation = {
|
||||
onPresentationModeChange(VoicePresentationMode.Conversation)
|
||||
},
|
||||
onCardAction = onCardAction,
|
||||
onCardInput = onCardInput,
|
||||
)
|
||||
}
|
||||
}
|
||||
item { Spacer(Modifier.height(12.dp)) }
|
||||
}
|
||||
} else {
|
||||
Box(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
AnimatedContent(
|
||||
targetState = stateHint(uiState.state),
|
||||
transitionSpec = {
|
||||
fadeIn(tween(200)) togetherWith fadeOut(tween(200))
|
||||
},
|
||||
label = "stateHint",
|
||||
) { hint ->
|
||||
Text(
|
||||
text = hint,
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
textAlign = TextAlign.Center,
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun VoiceMicButton(
|
||||
uiState: VoiceUiState,
|
||||
|
||||
@@ -98,6 +98,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.foundation.layout.aspectRatio
|
||||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.clipToBounds
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
@@ -119,6 +120,7 @@ import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.zIndex
|
||||
import com.hermesandroid.relay.R
|
||||
import com.hermesandroid.relay.ui.chatResponsiveLayout
|
||||
import com.hermesandroid.relay.ui.theme.radialNavyBackground
|
||||
import com.hermesandroid.relay.network.upstream.ApiModelOption
|
||||
import com.hermesandroid.relay.network.upstream.ChatMode
|
||||
@@ -749,6 +751,7 @@ fun ChatScreen(
|
||||
gitWorkspaceAvailable: Boolean = gitWorkspaceSummary != null,
|
||||
onNavigateToGitWorkspace: () -> Unit = {},
|
||||
) {
|
||||
val responsiveLayout = chatResponsiveLayout(LocalConfiguration.current.screenWidthDp)
|
||||
val supervised = supervisedPolicy.enabled
|
||||
val supervisedVisibility = supervisedPolicy.visibility.resolved()
|
||||
LaunchedEffect(supervisedPolicy) {
|
||||
@@ -3311,7 +3314,13 @@ fun ChatScreen(
|
||||
) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
modifier = Modifier.padding(horizontal = 32.dp)
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 32.dp)
|
||||
.then(
|
||||
responsiveLayout.introMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
),
|
||||
) {
|
||||
Spacer(modifier = Modifier.weight(0.15f))
|
||||
|
||||
@@ -3320,12 +3329,15 @@ fun ChatScreen(
|
||||
LocalBackgroundVisualizationEnabled.current &&
|
||||
(!supervised || supervisedVisibility.showAgentIdentity)
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(1f)
|
||||
.weight(0.7f, fill = false)
|
||||
) {
|
||||
val avatarModifier = responsiveLayout.avatarSize?.let { size ->
|
||||
Modifier
|
||||
.size(size)
|
||||
.clipToBounds()
|
||||
} ?: Modifier
|
||||
.fillMaxWidth()
|
||||
.aspectRatio(1f)
|
||||
.weight(0.7f, fill = false)
|
||||
Box(modifier = avatarModifier) {
|
||||
LocalAgentAvatar.current.Render(
|
||||
state = AvatarRenderState(
|
||||
state = if (error != null) SphereState.Error else SphereState.Idle,
|
||||
@@ -3568,7 +3580,14 @@ fun ChatScreen(
|
||||
LazyColumn(
|
||||
state = listState,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.align(Alignment.Center)
|
||||
.fillMaxHeight()
|
||||
.then(
|
||||
responsiveLayout.transcriptMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
)
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 12.dp)
|
||||
.padding(top = if (showTranscriptSearch) 112.dp else 0.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp)
|
||||
@@ -4650,6 +4669,13 @@ fun ChatScreen(
|
||||
supervisedPolicy.capabilities.attachmentCategories
|
||||
)) pasteImageFromClipboard else ({ }),
|
||||
onLongPressAttach = { if (!supervised) showCommandPalette = true },
|
||||
modifier = Modifier
|
||||
.align(Alignment.CenterHorizontally)
|
||||
.then(
|
||||
responsiveLayout.chromeMaxWidth?.let {
|
||||
Modifier.widthIn(max = it)
|
||||
} ?: Modifier,
|
||||
),
|
||||
charLimit = charLimit,
|
||||
caption = turnStatus ?: inputCaption,
|
||||
voiceReady = voiceReady,
|
||||
|
||||
@@ -706,8 +706,9 @@ fun ChatSettingsScreen(
|
||||
)
|
||||
}
|
||||
|
||||
// Live preview of the exact text that will be sent.
|
||||
// Rebuilds on every toggle change via remember(key1..key5).
|
||||
// Representative preview of each enabled block.
|
||||
// The chat context audit remains the exact selected-
|
||||
// session preview. Rebuilds on every toggle change.
|
||||
val previewText = remember(
|
||||
appContextEnabled,
|
||||
appContextBridgeState,
|
||||
@@ -735,6 +736,14 @@ fun ChatSettingsScreen(
|
||||
destructiveVerbCount = 5,
|
||||
autoDisableMinutes = 15,
|
||||
),
|
||||
// This card is an explanatory fixture, not
|
||||
// the active session audit. Supply one
|
||||
// representative Relay tool so the bridge
|
||||
// and safety toggles remain visible; the
|
||||
// real send path uses the selected
|
||||
// session/profile's authoritative catalog.
|
||||
availableTools =
|
||||
com.hermesandroid.relay.util.PHONE_CONTEXT_PREVIEW_TOOLS,
|
||||
)
|
||||
}
|
||||
Card(
|
||||
|
||||
@@ -544,19 +544,24 @@ internal fun buildStatusChecks(
|
||||
)
|
||||
}
|
||||
|
||||
// A healthy standard-only connection should not read like three missing
|
||||
// dependencies. Collapse the absent optional extension to one neutral row;
|
||||
// configured Relay keeps the detailed auth/server/plugin troubleshooting.
|
||||
if (!relayConfigured) {
|
||||
checks += StatusCheck(
|
||||
context.getString(R.string.diag_relay_tools_optional),
|
||||
CheckStatus.Unknown,
|
||||
reason = context.getString(R.string.diag_relay_tools_not_paired),
|
||||
category = DiagnosticCategory.Relay,
|
||||
)
|
||||
}
|
||||
// 6) Optional Relay / pairing auth.
|
||||
val authLabel = context.getString(R.string.diag_check_pairing_auth)
|
||||
val authRelayActive = context.getString(R.string.diag_check_relay_active)
|
||||
val authPairingProg = context.getString(R.string.diag_check_pairing_progress)
|
||||
val authNotPaired = context.getString(R.string.diag_check_not_paired)
|
||||
val authErr = recentError(DiagnosticCategory.Auth)
|
||||
checks += when {
|
||||
!relayConfigured ->
|
||||
StatusCheck(
|
||||
authLabel, CheckStatus.Unknown,
|
||||
reason = context.getString(R.string.active_section_optional),
|
||||
category = DiagnosticCategory.Auth,
|
||||
)
|
||||
if (relayConfigured) checks += when {
|
||||
authState is AuthState.Paired ->
|
||||
StatusCheck(
|
||||
authLabel, CheckStatus.Pass,
|
||||
@@ -586,18 +591,11 @@ internal fun buildStatusChecks(
|
||||
|
||||
// 7) Relay server (optional — Unknown when not paired/configured).
|
||||
val relayLabel = context.getString(R.string.active_section_optional_relay)
|
||||
val relayNotConfigured = context.getString(R.string.diag_check_relay_not_configured)
|
||||
val relayConnected = context.getString(R.string.diag_check_connected)
|
||||
val relayReachableNotReady = context.getString(R.string.diag_check_reachable_not_ready)
|
||||
val relayConfiguredNotReachable = context.getString(R.string.diag_check_configured_not_reachable)
|
||||
val relayErr = recentError(DiagnosticCategory.Relay)
|
||||
checks += when {
|
||||
!relayConfigured ->
|
||||
StatusCheck(
|
||||
relayLabel, CheckStatus.Unknown,
|
||||
reason = relayNotConfigured,
|
||||
category = DiagnosticCategory.Relay,
|
||||
)
|
||||
if (relayConfigured) checks += when {
|
||||
relayReady ->
|
||||
StatusCheck(
|
||||
relayLabel, CheckStatus.Pass,
|
||||
@@ -629,7 +627,7 @@ internal fun buildStatusChecks(
|
||||
relayReady = relayReady,
|
||||
relayUpdateInfo = relayUpdateInfo,
|
||||
)
|
||||
checks += when (pluginState) {
|
||||
if (relayConfigured) checks += when (pluginState) {
|
||||
RelayPluginDiagnosticState.NotConfigured ->
|
||||
StatusCheck(
|
||||
pluginLabel, CheckStatus.Unknown,
|
||||
|
||||
@@ -98,7 +98,7 @@ private data class DisplayFile(
|
||||
val deletions: Int?,
|
||||
)
|
||||
|
||||
/** First-class native Git workspace backed by the optional Relay contribution. */
|
||||
/** Native Git workspace: upstream current-session reads plus optional Relay enhancements. */
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun GitStateScreen(
|
||||
@@ -131,7 +131,7 @@ fun GitStateScreen(
|
||||
var pendingConfirm by remember { mutableStateOf<ConfirmationRequest?>(null) }
|
||||
|
||||
LaunchedEffect(scanningEnabled) {
|
||||
if (scanningEnabled) viewModel.loadRepos()
|
||||
viewModel.loadRepos()
|
||||
}
|
||||
|
||||
val repos = (reposState as? GitStateUiState.Ready)?.repos.orEmpty()
|
||||
@@ -202,29 +202,27 @@ fun GitStateScreen(
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
if (scanningEnabled) {
|
||||
IconButton(onClick = { selectedRepo?.let { viewModel.selectRepo(it.id) } ?: viewModel.loadRepos() }) {
|
||||
Icon(Icons.Filled.Refresh, "Refresh Git workspace")
|
||||
}
|
||||
Box {
|
||||
IconButton(onClick = { showOverflow = true }) { Icon(Icons.Filled.MoreVert, "More Git actions") }
|
||||
DropdownMenu(expanded = showOverflow, onDismissRequest = { showOverflow = false }) {
|
||||
DropdownMenuItem(text = { Text("Choose repository") }, onClick = { showOverflow = false; showRepos = true })
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.git_state_branches)) }, enabled = detail != null, onClick = { showOverflow = false; showBranches = true })
|
||||
}
|
||||
IconButton(onClick = { selectedRepo?.let { viewModel.selectRepo(it.id) } ?: viewModel.loadRepos() }) {
|
||||
Icon(Icons.Filled.Refresh, "Refresh Git workspace")
|
||||
}
|
||||
Box {
|
||||
IconButton(onClick = { showOverflow = true }) { Icon(Icons.Filled.MoreVert, "More Git actions") }
|
||||
DropdownMenu(expanded = showOverflow, onDismissRequest = { showOverflow = false }) {
|
||||
DropdownMenuItem(text = { Text("Choose repository") }, onClick = { showOverflow = false; showRepos = true })
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.git_state_branches)) }, enabled = detail != null, onClick = { showOverflow = false; showBranches = true })
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
},
|
||||
bottomBar = {
|
||||
if (scanningEnabled && detail != null) {
|
||||
if (detail != null) {
|
||||
Surface(shadowElevation = 8.dp, tonalElevation = 2.dp) {
|
||||
Column {
|
||||
if (selection.isNotEmpty()) {
|
||||
SelectionRail(
|
||||
count = selection.size,
|
||||
canWrite = hasGrant,
|
||||
canWrite = hasGrant && scanningEnabled,
|
||||
allStaged = selection.all { it.filter == FileFilter.Staged },
|
||||
onStage = stageSelection,
|
||||
onDiscard = discardSelection,
|
||||
@@ -234,7 +232,7 @@ fun GitStateScreen(
|
||||
OutlinedButton(onClick = { showBranches = true }, modifier = Modifier.weight(1f)) {
|
||||
Icon(Icons.Filled.AccountTree, null, Modifier.size(18.dp)); Spacer(Modifier.width(8.dp)); Text(stringResource(R.string.git_state_branches))
|
||||
}
|
||||
Button(onClick = { showCommit = true }, enabled = hasGrant && detail.status.counts.staged > 0, modifier = Modifier.weight(1f)) {
|
||||
Button(onClick = { showCommit = true }, enabled = scanningEnabled && hasGrant && detail.status.counts.staged > 0, modifier = Modifier.weight(1f)) {
|
||||
Icon(Icons.Filled.AutoAwesome, null, Modifier.size(18.dp)); Spacer(Modifier.width(8.dp)); Text(stringResource(R.string.git_state_commit))
|
||||
}
|
||||
}
|
||||
@@ -248,21 +246,21 @@ fun GitStateScreen(
|
||||
enabled = scanningEnabled,
|
||||
onEnabledChange = onScanningEnabledChange,
|
||||
)
|
||||
if (scanningEnabled) {
|
||||
when (val state = reposState) {
|
||||
GitStateUiState.Loading -> FullState(Modifier.weight(1f), true, "Finding repositories")
|
||||
is GitStateUiState.Unavailable -> UnavailableState(Modifier.weight(1f), state.message, viewModel::loadRepos)
|
||||
is GitStateUiState.Error -> UnavailableState(Modifier.weight(1f), state.message, viewModel::loadRepos)
|
||||
is GitStateUiState.Ready -> when {
|
||||
state.repos.isEmpty() -> FullState(Modifier.weight(1f), false, "No Git repositories found", "Add a repository to the host's configured Git roots, then refresh.")
|
||||
selectedRepo == null -> RepositoryPrompt(Modifier.weight(1f), state.repos, viewModel::selectRepo)
|
||||
else -> WorkspaceBody(
|
||||
when (val state = reposState) {
|
||||
GitStateUiState.Loading -> FullState(Modifier.weight(1f), true, "Finding repositories")
|
||||
is GitStateUiState.Unavailable -> UnavailableState(Modifier.weight(1f), state.message, viewModel::loadRepos)
|
||||
is GitStateUiState.Error -> UnavailableState(Modifier.weight(1f), state.message, viewModel::loadRepos)
|
||||
is GitStateUiState.Ready -> when {
|
||||
state.repos.isEmpty() -> FullState(Modifier.weight(1f), false, "No current-session Git repository", "Open a Hermes coding session with repository context, or enable host repository discovery above.")
|
||||
selectedRepo == null -> RepositoryPrompt(Modifier.weight(1f), state.repos, viewModel::selectRepo)
|
||||
else -> WorkspaceBody(
|
||||
modifier = Modifier.weight(1f),
|
||||
repo = selectedRepo,
|
||||
reposNotice = state.notice,
|
||||
detailState = detailState,
|
||||
mutation = mutation,
|
||||
stashNotice = stashNotice,
|
||||
relayEnhancementsEnabled = scanningEnabled,
|
||||
hasGrant = hasGrant,
|
||||
filter = filter,
|
||||
onFilter = { filter = it },
|
||||
@@ -289,8 +287,7 @@ fun GitStateScreen(
|
||||
onPush = { viewModel.currentTarget()?.let { pendingConfirm = ConfirmationRequest.Push(it) } },
|
||||
onClearMutation = viewModel::clearMutationError,
|
||||
onRetry = { viewModel.selectRepo(selectedRepo.id) },
|
||||
)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -311,7 +308,7 @@ fun GitStateScreen(
|
||||
onCreate = { name, track -> showBranches = false; viewModel.checkout("", newBranch = name, track = track) },
|
||||
)
|
||||
}
|
||||
if (showCommit && detail != null) {
|
||||
if (showCommit && scanningEnabled && detail != null) {
|
||||
val stagedPaths = detail.status.staged.map { it.path }
|
||||
CommitDialog(
|
||||
hasStaged = stagedPaths.isNotEmpty(),
|
||||
@@ -392,6 +389,7 @@ private fun WorkspaceBody(
|
||||
detailState: GitRepoDetailState,
|
||||
mutation: GitMutationState,
|
||||
stashNotice: String?,
|
||||
relayEnhancementsEnabled: Boolean,
|
||||
hasGrant: Boolean,
|
||||
filter: FileFilter,
|
||||
onFilter: (FileFilter) -> Unit,
|
||||
@@ -421,9 +419,11 @@ private fun WorkspaceBody(
|
||||
LazyColumn(modifier.fillMaxSize(), contentPadding = PaddingValues(bottom = 18.dp)) {
|
||||
item {
|
||||
SummaryRail(repo, detailState)
|
||||
RemoteActions(hasGrant, status, onFetch, onPull, onPush)
|
||||
if (relayEnhancementsEnabled) {
|
||||
RemoteActions(hasGrant, status, onFetch, onPull, onPush)
|
||||
}
|
||||
reposNotice?.let { NoticeCard(it) }
|
||||
if (!hasGrant) WriteGrantNotice()
|
||||
if (relayEnhancementsEnabled && !hasGrant) WriteGrantNotice()
|
||||
MutationBanner(mutation, onClearMutation)
|
||||
stashNotice?.let { NoticeCard(it) }
|
||||
if (status.truncated) NoticeCard(stringResource(R.string.git_state_truncated), error = true)
|
||||
@@ -438,6 +438,7 @@ private fun WorkspaceBody(
|
||||
FileRow(
|
||||
file = file,
|
||||
selected = file in selection,
|
||||
selectionEnabled = relayEnhancementsEnabled,
|
||||
expanded = expandedPath == file.path,
|
||||
mode = contentMode,
|
||||
contentState = contentState,
|
||||
@@ -554,6 +555,7 @@ private fun GitStatus.uniqueChangeCount(): Int = counts.changes.takeIf { it >= 0
|
||||
private fun FileRow(
|
||||
file: DisplayFile,
|
||||
selected: Boolean,
|
||||
selectionEnabled: Boolean,
|
||||
expanded: Boolean,
|
||||
mode: ContentMode,
|
||||
contentState: GitContentViewState,
|
||||
@@ -572,7 +574,7 @@ private fun FileRow(
|
||||
) {
|
||||
Checkbox(
|
||||
checked = selected,
|
||||
onCheckedChange = { onToggleSelected() },
|
||||
onCheckedChange = if (selectionEnabled) ({ _ -> onToggleSelected() }) else null,
|
||||
modifier = Modifier.semantics {
|
||||
contentDescription = "Select ${file.path}"
|
||||
},
|
||||
@@ -602,7 +604,9 @@ private fun FileRow(
|
||||
if (expanded && file.filter != FileFilter.Untracked) {
|
||||
Row(Modifier.padding(start = 56.dp, end = 16.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
if (file.filter != FileFilter.Untracked) FilterChip(mode == ContentMode.Diff, { onOpen(ContentMode.Diff) }, label = { Text("Diff") })
|
||||
FilterChip(mode == ContentMode.File, { onOpen(ContentMode.File) }, label = { Text("File") })
|
||||
if (selectionEnabled) {
|
||||
FilterChip(mode == ContentMode.File, { onOpen(ContentMode.File) }, label = { Text("File") })
|
||||
}
|
||||
}
|
||||
InlineContent(contentState, Modifier.padding(start = 16.dp, end = 16.dp, bottom = 10.dp))
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ fun SettingsScreen(
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
// The Power tools below all ride the relay plugin. Rather than stamp an
|
||||
// The Relay tools below all ride the optional plugin. Rather than stamp an
|
||||
// identical badge on every card (noise, not signal), the dependency is
|
||||
// surfaced ONCE on the section header as a single plugin-state badge.
|
||||
val pluginBadge = when (relayUiState) {
|
||||
@@ -629,6 +629,14 @@ fun SettingsScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
)
|
||||
|
||||
SettingsCategoryRow(
|
||||
icon = Icons.Filled.Image,
|
||||
title = stringResource(R.string.settings_media),
|
||||
subtitle = stringResource(R.string.settings_media_desc),
|
||||
onClick = onNavigateToMediaSettings,
|
||||
isDarkTheme = isDarkTheme,
|
||||
)
|
||||
|
||||
SettingsCategoryRow(
|
||||
icon = Icons.Filled.GraphicEq,
|
||||
title = stringResource(R.string.settings_voice_mode),
|
||||
@@ -637,6 +645,8 @@ fun SettingsScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
)
|
||||
|
||||
SettingsSectionHeader(stringResource(R.string.settings_power_tools), trailing = pluginBadge)
|
||||
|
||||
SettingsCategoryRow(
|
||||
icon = Icons.AutoMirrored.Filled.Message,
|
||||
title = stringResource(R.string.settings_threads),
|
||||
@@ -645,8 +655,6 @@ fun SettingsScreen(
|
||||
isDarkTheme = isDarkTheme,
|
||||
)
|
||||
|
||||
SettingsSectionHeader(stringResource(R.string.settings_power_tools), trailing = pluginBadge)
|
||||
|
||||
SettingsCategoryRow(
|
||||
icon = Icons.Filled.Code,
|
||||
title = stringResource(R.string.settings_terminal),
|
||||
@@ -681,13 +689,6 @@ fun SettingsScreen(
|
||||
)
|
||||
// === END PHASE3-notif-listener-followup ===
|
||||
|
||||
SettingsCategoryRow(
|
||||
icon = Icons.Filled.Image,
|
||||
title = stringResource(R.string.settings_media),
|
||||
subtitle = stringResource(R.string.settings_media_desc), onClick = onNavigateToMediaSettings,
|
||||
isDarkTheme = isDarkTheme,
|
||||
)
|
||||
|
||||
if (BuildFlavor.isSideload) {
|
||||
// === PHASE3-safety-rails: bridge safety entry-point ===
|
||||
SettingsCategoryRow(
|
||||
|
||||
@@ -957,25 +957,6 @@ private fun VoiceForThisProfileCard(
|
||||
) {
|
||||
val scope = rememberCoroutineScope()
|
||||
|
||||
// Auto-repair when Relay disappears out from under a Relay-only selection:
|
||||
// a persisted RealtimeAgent engine (Relay-only) or Relay route can't run
|
||||
// without a paired Relay, so fall back to the always-available defaults.
|
||||
LaunchedEffect(relayVoiceReady, currentEngine, currentAudioRoute) {
|
||||
if (!relayVoiceReady) {
|
||||
if (currentEngine == VoiceEngineMode.RealtimeAgent) {
|
||||
prefsRepo.setEngineMode(VoiceEngineMode.HermesVoiceOutput)
|
||||
}
|
||||
val coerced = coerceAudioRoute(
|
||||
engine = VoiceEngineMode.HermesVoiceOutput,
|
||||
route = currentAudioRoute,
|
||||
relayVoiceReady = false,
|
||||
)
|
||||
if (coerced != currentAudioRoute) {
|
||||
prefsRepo.setAudioRoute(coerced)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SectionCard(title = stringResource(R.string.voice_settings_for_profile_title)) {
|
||||
Text(
|
||||
text = stringResource(R.string.voice_settings_engine_label),
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.core.content.FileProvider
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
import java.io.InputStream
|
||||
import java.security.MessageDigest
|
||||
|
||||
/**
|
||||
@@ -98,7 +99,7 @@ class MediaCacheWriter(
|
||||
suspend fun cache(bytes: ByteArray, contentType: String, fileName: String?): Uri =
|
||||
withContext(Dispatchers.IO) {
|
||||
val dir = cacheRoot
|
||||
val targetName = buildFilename(bytes, contentType, fileName)
|
||||
val targetName = buildFilename(bytes.sha1(), contentType, fileName)
|
||||
val file = File(dir, targetName)
|
||||
file.writeBytes(bytes)
|
||||
// Best-effort LRU enforcement — never fatal on a cache operation.
|
||||
@@ -113,6 +114,45 @@ class MediaCacheWriter(
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a completed streaming download into the media cache without ever
|
||||
* materializing the file as a ByteArray. The caller retains ownership of
|
||||
* [source] when this throws; successful calls consume or copy it.
|
||||
*/
|
||||
suspend fun cache(source: File, contentType: String, fileName: String?): Uri {
|
||||
val target = cacheFile(source, contentType, fileName)
|
||||
return withContext(Dispatchers.IO) {
|
||||
FileProvider.getUriForFile(
|
||||
context,
|
||||
"${context.packageName}.fileprovider",
|
||||
target,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
internal suspend fun cacheFile(source: File, contentType: String, fileName: String?): File =
|
||||
withContext(Dispatchers.IO) {
|
||||
require(source.isFile) { "Media cache source does not exist" }
|
||||
val dir = cacheRoot
|
||||
val target = File(dir, buildFilename(source.sha1(), contentType, fileName))
|
||||
if (source.canonicalFile != target.canonicalFile) {
|
||||
if (target.exists()) {
|
||||
source.delete()
|
||||
target.setLastModified(System.currentTimeMillis())
|
||||
} else if (!source.renameTo(target)) {
|
||||
source.inputStream().use { input ->
|
||||
target.outputStream().use { output -> input.copyTo(output) }
|
||||
}
|
||||
source.delete()
|
||||
}
|
||||
}
|
||||
try {
|
||||
enforceCap()
|
||||
} catch (_: Exception) { /* swallow */ }
|
||||
|
||||
target
|
||||
}
|
||||
|
||||
/**
|
||||
* Wipe the entire `hermes-media/` directory. Returns the number of bytes
|
||||
* freed so the caller can show a "Freed X MB" snackbar/toast.
|
||||
@@ -133,15 +173,8 @@ class MediaCacheWriter(
|
||||
|
||||
// --- internals ---
|
||||
|
||||
private fun buildFilename(bytes: ByteArray, contentType: String, fileName: String?): String {
|
||||
private fun buildFilename(sha1: String, contentType: String, fileName: String?): String {
|
||||
val ext = mimeToExt[contentType.lowercase().substringBefore(';').trim()] ?: "bin"
|
||||
// SHA-1 of the bytes — stable + collision-resistant enough for cache keys.
|
||||
val sha1 = try {
|
||||
MessageDigest.getInstance("SHA-1").digest(bytes).joinToString("") { "%02x".format(it) }
|
||||
} catch (_: Exception) {
|
||||
// fallback to a weaker but always-available hash
|
||||
bytes.contentHashCode().toUInt().toString(16)
|
||||
}
|
||||
|
||||
// If the server supplied a filename, keep the base (sanitized) but
|
||||
// force the extension we derived from the MIME. This keeps the
|
||||
@@ -162,6 +195,33 @@ class MediaCacheWriter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun ByteArray.sha1(): String = try {
|
||||
MessageDigest.getInstance("SHA-1").digest(this).toHexString()
|
||||
} catch (_: Exception) {
|
||||
contentHashCode().toUInt().toString(16)
|
||||
}
|
||||
|
||||
private fun File.sha1(): String = try {
|
||||
inputStream().use { input ->
|
||||
val digest = MessageDigest.getInstance("SHA-1")
|
||||
input.updateDigest(digest)
|
||||
digest.digest().toHexString()
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
"${length().toUInt().toString(16)}-${lastModified().toUInt().toString(16)}"
|
||||
}
|
||||
|
||||
private fun InputStream.updateDigest(digest: MessageDigest) {
|
||||
val buffer = ByteArray(DEFAULT_BUFFER_SIZE)
|
||||
while (true) {
|
||||
val read = read(buffer)
|
||||
if (read < 0) return
|
||||
digest.update(buffer, 0, read)
|
||||
}
|
||||
}
|
||||
|
||||
private fun ByteArray.toHexString(): String = joinToString("") { "%02x".format(it) }
|
||||
|
||||
/**
|
||||
* Delete oldest-mtime files until the cache directory fits under the cap.
|
||||
* Called after every write; safe to call more often.
|
||||
|
||||
@@ -99,8 +99,14 @@ private const val PREAMBLE =
|
||||
"The user is chatting via the Hermes-Relay Android app. " +
|
||||
"Keep responses mobile-friendly and concise when possible."
|
||||
|
||||
/** Representative capability used only by the Settings preview fixture. */
|
||||
internal val PHONE_CONTEXT_PREVIEW_TOOLS = setOf("android_phone_status")
|
||||
|
||||
/**
|
||||
* Build the system-prompt block from [settings] + [snapshot].
|
||||
* Build the system-prompt block from [settings] + [snapshot]. Relay-only
|
||||
* bridge guidance is emitted only when [availableTools] proves that this exact
|
||||
* selected session/profile can call at least one `android_*` tool. A missing
|
||||
* catalog fails closed for tool claims while preserving neutral mobile context.
|
||||
*
|
||||
* Returns `null` iff:
|
||||
* 1. [AppContextSettings.master] is false, OR
|
||||
@@ -112,14 +118,27 @@ private const val PREAMBLE =
|
||||
* itself is useful (it's the original v0.1.0 behavior). The "everything
|
||||
* off → null" case in the brief is the `master=false` branch.
|
||||
*/
|
||||
fun buildPromptBlock(settings: AppContextSettings, snapshot: PhoneSnapshot): String? {
|
||||
fun buildPromptBlock(
|
||||
settings: AppContextSettings,
|
||||
snapshot: PhoneSnapshot,
|
||||
availableTools: Set<String>? = null,
|
||||
): String? {
|
||||
if (!settings.master) return null
|
||||
|
||||
val lines = mutableListOf<String>()
|
||||
lines += PREAMBLE
|
||||
|
||||
if (settings.bridgeState) {
|
||||
lines += buildBridgeLine(snapshot)
|
||||
val phoneControlTools = availableTools
|
||||
?.filterTo(mutableSetOf()) {
|
||||
it.startsWith("android_") && it != "android_setup"
|
||||
}
|
||||
.orEmpty()
|
||||
|
||||
if (settings.bridgeState && phoneControlTools.isNotEmpty()) {
|
||||
lines += buildBridgeLine(
|
||||
snapshot = snapshot,
|
||||
phoneStatusToolAvailable = "android_phone_status" in phoneControlTools,
|
||||
)
|
||||
}
|
||||
|
||||
if (settings.currentApp && snapshot.currentApp != null) {
|
||||
@@ -130,7 +149,7 @@ fun buildPromptBlock(settings: AppContextSettings, snapshot: PhoneSnapshot): Str
|
||||
lines += "Battery: ${snapshot.batteryPercent}%."
|
||||
}
|
||||
|
||||
if (settings.safetyStatus) {
|
||||
if (settings.safetyStatus && phoneControlTools.isNotEmpty()) {
|
||||
buildSafetyLine(snapshot)?.let { lines += it }
|
||||
}
|
||||
|
||||
@@ -151,7 +170,10 @@ fun buildPromptBlock(settings: AppContextSettings, snapshot: PhoneSnapshot): Str
|
||||
* the bridge isn't bound — "Phone bridge: not installed" is itself useful
|
||||
* context (tells the agent not to try tool calls into the phone).
|
||||
*/
|
||||
private fun buildBridgeLine(snapshot: PhoneSnapshot): String {
|
||||
private fun buildBridgeLine(
|
||||
snapshot: PhoneSnapshot,
|
||||
phoneStatusToolAvailable: Boolean,
|
||||
): String {
|
||||
if (!snapshot.bridgeBound) {
|
||||
return "Phone bridge: not connected. Tool calls into the phone are unavailable."
|
||||
}
|
||||
@@ -189,8 +211,12 @@ private fun buildBridgeLine(snapshot: PhoneSnapshot): String {
|
||||
|
||||
val screenText = if (snapshot.screenOn) "Screen: on." else "Screen: off."
|
||||
|
||||
return "Phone bridge: enabled. $permsText. $screenText $unattendedText " +
|
||||
"For full phone status (current app, battery, blocklist), call the android_phone_status tool."
|
||||
val statusToolHint = if (phoneStatusToolAvailable) {
|
||||
" For full phone status (current app, battery, blocklist), call the android_phone_status tool."
|
||||
} else {
|
||||
""
|
||||
}
|
||||
return "Phone bridge: enabled. $permsText. $screenText $unattendedText$statusToolHint"
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -70,6 +70,7 @@ import com.hermesandroid.relay.network.upstream.ActiveTurnKeepAliveRegistry
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAsk
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAskExpiry
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAskResponse
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAgentNotice
|
||||
import com.hermesandroid.relay.network.upstream.GatewayActiveSession
|
||||
import com.hermesandroid.relay.network.upstream.GatewayActiveSessionStatus
|
||||
import com.hermesandroid.relay.network.upstream.GatewayActiveSessionsResult
|
||||
@@ -82,6 +83,7 @@ import com.hermesandroid.relay.network.upstream.GatewayCompressResult
|
||||
import com.hermesandroid.relay.network.upstream.GatewayConnectionState
|
||||
import com.hermesandroid.relay.network.upstream.GatewayReconnectDisposition
|
||||
import com.hermesandroid.relay.network.upstream.isDashboardSignInRequiredFailure
|
||||
import com.hermesandroid.relay.network.upstream.isDashboardManagedFilesUnsupported
|
||||
import com.hermesandroid.relay.network.upstream.GatewayEventMapper
|
||||
import com.hermesandroid.relay.network.upstream.GatewayInboundTurnRegistration
|
||||
import com.hermesandroid.relay.network.upstream.GatewayModelProvider
|
||||
@@ -98,11 +100,13 @@ import com.hermesandroid.relay.network.upstream.resolveReasoningEffortAvailabili
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAttachment
|
||||
import com.hermesandroid.relay.network.upstream.GatewayRpcException
|
||||
import com.hermesandroid.relay.network.upstream.GatewayTurnCallbacks
|
||||
import com.hermesandroid.relay.network.upstream.DashboardApiClient
|
||||
import com.hermesandroid.relay.network.upstream.ApiModelOption
|
||||
import com.hermesandroid.relay.network.upstream.ApiModelRoutingErrorCode
|
||||
import com.hermesandroid.relay.network.upstream.ApiModelRoutingException
|
||||
import com.hermesandroid.relay.network.upstream.ApiModelSelectionAck
|
||||
import com.hermesandroid.relay.network.upstream.HermesApiClient
|
||||
import com.hermesandroid.relay.network.upstream.ToolsetInfo
|
||||
import com.hermesandroid.relay.network.upstream.isCurrentModelOptionsResponse
|
||||
import com.hermesandroid.relay.network.upstream.modelOptionsIdentityToPublish
|
||||
import com.hermesandroid.relay.network.upstream.parsePersonalityPrompts
|
||||
@@ -126,6 +130,8 @@ import com.hermesandroid.relay.notifications.InteractionRequestNotifier
|
||||
import com.hermesandroid.relay.reliability.ReliabilityCenter
|
||||
import com.hermesandroid.relay.reliability.SessionResetEvidence
|
||||
import com.hermesandroid.relay.ui.components.ServerImageResult
|
||||
import com.hermesandroid.relay.ui.UiMessageBus
|
||||
import com.hermesandroid.relay.ui.UiMessageSeverity
|
||||
import com.hermesandroid.relay.data.isImageGenerationToolName
|
||||
import com.hermesandroid.relay.ui.components.SlashCommand
|
||||
import com.hermesandroid.relay.voice.RealtimeTurnSyncBuilder
|
||||
@@ -167,6 +173,8 @@ import kotlinx.serialization.json.contentOrNull
|
||||
import kotlinx.serialization.json.intOrNull
|
||||
import kotlinx.serialization.json.longOrNull
|
||||
import okhttp3.sse.EventSource
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.io.InterruptedIOException
|
||||
import java.util.UUID
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
@@ -176,6 +184,39 @@ import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
internal const val SESSION_DIRECTORY_PAGE_SIZE = 50
|
||||
|
||||
internal data class GatewayNoticePresentation(
|
||||
val text: String,
|
||||
val severity: UiMessageSeverity,
|
||||
val ttlMillis: Long,
|
||||
val key: String?,
|
||||
)
|
||||
|
||||
private val LEADING_NOTICE_GLYPH = Regex("^[•⚠✕✗✓]\uFE0F?\\s*")
|
||||
|
||||
internal fun gatewayNoticePresentation(notice: GatewayAgentNotice): GatewayNoticePresentation {
|
||||
val severity = when (notice.level?.trim()?.lowercase()) {
|
||||
"success" -> UiMessageSeverity.Success
|
||||
"warn", "warning", "error" -> UiMessageSeverity.Warning
|
||||
else -> UiMessageSeverity.Info
|
||||
}
|
||||
val ttl = when (notice.kind?.trim()?.lowercase()) {
|
||||
"ttl" -> notice.ttlMs?.takeIf { it > 0L }
|
||||
?.coerceAtMost(60_000L)
|
||||
?: UiMessageBus.DEFAULT_TTL_MS
|
||||
// Official Desktop keeps every non-TTL notice until an exact keyed
|
||||
// notification.clear arrives. This includes kind="agent" startup
|
||||
// notices whose lifetime is owned by the gateway, not a client timer.
|
||||
else -> 0L
|
||||
}
|
||||
return GatewayNoticePresentation(
|
||||
text = notice.text.trim().replaceFirst(LEADING_NOTICE_GLYPH, "").trim(),
|
||||
severity = severity,
|
||||
ttlMillis = ttl,
|
||||
key = notice.key?.trim()?.takeIf(String::isNotEmpty)
|
||||
?: notice.id?.trim()?.takeIf(String::isNotEmpty),
|
||||
)
|
||||
}
|
||||
|
||||
data class SessionDirectoryReadyEvent(
|
||||
val contextKey: String?,
|
||||
val profileName: String?,
|
||||
@@ -354,6 +395,22 @@ internal fun voiceTurnTransportRejection(
|
||||
null
|
||||
}
|
||||
|
||||
internal fun buildMediaCapabilityHint(
|
||||
upstreamAvailable: Boolean,
|
||||
relayAvailable: Boolean,
|
||||
): String? = listOfNotNull(
|
||||
ChatViewModel.UPSTREAM_MEDIA_HINT.takeIf { upstreamAvailable },
|
||||
ChatViewModel.RELAY_MEDIA_HINT.takeIf { relayAvailable },
|
||||
).joinToString("\n\n").ifBlank { null }
|
||||
|
||||
internal fun eligibleSseToolNames(toolsets: List<ToolsetInfo>?): Set<String>? =
|
||||
toolsets
|
||||
?.asSequence()
|
||||
?.filter { it.enabled && it.configured }
|
||||
?.flatMap { it.tools.asSequence() }
|
||||
?.filter { it.isNotBlank() }
|
||||
?.toSet()
|
||||
|
||||
class ChatViewModel : ViewModel() {
|
||||
/**
|
||||
* Active Android-only supervision policy. RelayApp replaces this snapshot
|
||||
@@ -376,6 +433,8 @@ class ChatViewModel : ViewModel() {
|
||||
|
||||
private var apiClient: HermesApiClient? = null
|
||||
private var chatHandler: ChatHandler? = null
|
||||
private var sseToolCatalogJob: Job? = null
|
||||
private val _sseToolNames = MutableStateFlow<Set<String>?>(null)
|
||||
|
||||
/**
|
||||
* The in-flight chat turn, transport-agnostic: SSE turns wrap their
|
||||
@@ -652,6 +711,7 @@ class ChatViewModel : ViewModel() {
|
||||
|
||||
// --- Media dependencies (wired via initializeMedia from RelayApp) ---
|
||||
private var relayHttpClient: RelayHttpClient? = null
|
||||
private var dashboardMediaClientProvider: (() -> DashboardApiClient?)? = null
|
||||
private var mediaSettingsRepo: MediaSettingsRepository? = null
|
||||
private var mediaCacheWriter: MediaCacheWriter? = null
|
||||
private var appContext: Context? = null
|
||||
@@ -674,6 +734,7 @@ class ChatViewModel : ViewModel() {
|
||||
// `send()` below for the construction site.
|
||||
// === END PHASE3-status ===
|
||||
const val MEDIA_TAP_TO_DOWNLOAD = "Tap to download"
|
||||
const val MEDIA_HOST_ONLY = "File is on your Hermes host"
|
||||
private const val MEDIA_FETCH_TIMEOUT_MS = 120_000L
|
||||
private val WINDOWS_ABSOLUTE_MEDIA_PATH_REGEX = Regex("""^[A-Za-z]:[\\/].+""")
|
||||
|
||||
@@ -693,21 +754,18 @@ class ChatViewModel : ViewModel() {
|
||||
private const val MAX_CHECKPOINT_MOA_LABEL_CHARS = 120
|
||||
private const val MAX_CHECKPOINT_MOA_TEXT_CHARS = 16_000
|
||||
|
||||
/**
|
||||
* One-line capability nudge appended to the SSE `system_message` when a
|
||||
* relay route is configured, so the agent knows it can surface images/
|
||||
* files by absolute server path (the client fetches them over the relay
|
||||
* `/media/by-path` channel and renders them inline). SSE-only: the
|
||||
* gateway transport has no per-turn system slot, so this can't ride a
|
||||
* gateway turn — there the upstream prompt_builder's own `MEDIA:`
|
||||
* instruction plus the client-side render fallback cover it.
|
||||
*/
|
||||
/** Upstream-first file/media capability for SSE fallback turns. */
|
||||
const val UPSTREAM_MEDIA_HINT =
|
||||
"Media display: this client supports standard upstream Hermes file delivery. " +
|
||||
"To show a host-local image, audio, video, or file, put its absolute path " +
|
||||
"on its own line as `MEDIA:/absolute/path`. The client fetches it through " +
|
||||
"the authenticated upstream Dashboard file routes and renders it inline."
|
||||
|
||||
/** Additive Relay compatibility/metadata capability for SSE fallback turns. */
|
||||
const val RELAY_MEDIA_HINT =
|
||||
"Media display: this client can render images and files you reference by " +
|
||||
"absolute server path. To show one to the user, put its absolute path on " +
|
||||
"its own line as `MEDIA:/absolute/path`, or use a markdown image " +
|
||||
"``. The client fetches it over the secure " +
|
||||
"relay channel and shows it inline."
|
||||
"Relay enhancement: a paired Relay may add legacy-path compatibility and " +
|
||||
"sensitivity metadata when standard upstream delivery cannot serve an " +
|
||||
"artifact. Relay is not required for ordinary upstream media delivery."
|
||||
}
|
||||
|
||||
/** Callback to persist session ID — set by RelayApp */
|
||||
@@ -3095,6 +3153,8 @@ class ChatViewModel : ViewModel() {
|
||||
onStatusClear = { kind ->
|
||||
if (acceptsEvent()) handler.clearTurnStatus(kind)
|
||||
},
|
||||
onNoticeShow = ::showGatewayNotice,
|
||||
onNoticeClear = ::clearGatewayNotice,
|
||||
)
|
||||
return GatewayInboundTurnRegistration(
|
||||
callbacks = callbacks,
|
||||
@@ -3568,6 +3628,21 @@ class ChatViewModel : ViewModel() {
|
||||
private val _transientNotice = MutableSharedFlow<String>(extraBufferCapacity = 8)
|
||||
val transientNotice: SharedFlow<String> = _transientNotice.asSharedFlow()
|
||||
|
||||
private fun showGatewayNotice(notice: GatewayAgentNotice) {
|
||||
val presentation = gatewayNoticePresentation(notice)
|
||||
if (presentation.text.isEmpty()) return
|
||||
UiMessageBus.post(
|
||||
text = presentation.text,
|
||||
severity = presentation.severity,
|
||||
ttlMillis = presentation.ttlMillis,
|
||||
key = presentation.key,
|
||||
)
|
||||
}
|
||||
|
||||
private fun clearGatewayNotice(key: String) {
|
||||
UiMessageBus.clear(key)
|
||||
}
|
||||
|
||||
fun reactToMessage(message: ChatMessage, emoji: String?) {
|
||||
val gateway = gatewayClient ?: return
|
||||
val role = message.role
|
||||
@@ -4467,6 +4542,7 @@ class ChatViewModel : ViewModel() {
|
||||
fetchSkills()
|
||||
fetchPersonalities()
|
||||
fetchModels()
|
||||
refreshSseToolCatalog(apiClient)
|
||||
// Keep the tool-call history in sync with the active chat handler's
|
||||
// messages. Subscribed on every initialize() call so a replaced
|
||||
// handler (connection switch) picks up fresh events without leaking
|
||||
@@ -4533,6 +4609,8 @@ class ChatViewModel : ViewModel() {
|
||||
* repeatedly; re-subscribes the tool-call history collector.
|
||||
*/
|
||||
fun bindDemoHandler(handler: ChatHandler) {
|
||||
sseToolCatalogJob?.cancel()
|
||||
_sseToolNames.value = null
|
||||
this.chatHandler = handler
|
||||
backgroundProcessSessionJob?.cancel()
|
||||
selectBackgroundProcessSession(null)
|
||||
@@ -4575,7 +4653,8 @@ class ChatViewModel : ViewModel() {
|
||||
context: Context,
|
||||
relayHttpClient: RelayHttpClient,
|
||||
mediaSettingsRepo: MediaSettingsRepository,
|
||||
mediaCacheWriter: MediaCacheWriter
|
||||
mediaCacheWriter: MediaCacheWriter,
|
||||
dashboardMediaClientProvider: () -> DashboardApiClient? = { null },
|
||||
) {
|
||||
this.appContext = context.applicationContext
|
||||
if (chatTurnCheckpointStore == null) {
|
||||
@@ -4583,6 +4662,7 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
ensureCheckpointObservers()
|
||||
this.relayHttpClient = relayHttpClient
|
||||
this.dashboardMediaClientProvider = dashboardMediaClientProvider
|
||||
if (_modelProviders.value.isNotEmpty()) refreshRelayReasoningCapabilities()
|
||||
this.mediaSettingsRepo = mediaSettingsRepo
|
||||
this.mediaCacheWriter = mediaCacheWriter
|
||||
@@ -4624,6 +4704,16 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun refreshSseToolCatalog(client: HermesApiClient?) {
|
||||
sseToolCatalogJob?.cancel()
|
||||
_sseToolNames.value = null
|
||||
if (client == null) return
|
||||
sseToolCatalogJob = viewModelScope.launch {
|
||||
val names = eligibleSseToolNames(client.getToolsets().getOrNull())
|
||||
if (apiClient === client) _sseToolNames.value = names
|
||||
}
|
||||
}
|
||||
|
||||
fun updateApiClient(client: HermesApiClient?) {
|
||||
// A route handoff / reconnect rebuilds the HTTP API client. An SSE turn
|
||||
// is bound to the OLD client, so it must be cancelled. A GATEWAY turn
|
||||
@@ -4653,6 +4743,7 @@ class ChatViewModel : ViewModel() {
|
||||
fetchSkills()
|
||||
fetchPersonalities()
|
||||
fetchModels()
|
||||
refreshSseToolCatalog(client)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -8022,6 +8113,8 @@ class ChatViewModel : ViewModel() {
|
||||
onStatusClear = { kind ->
|
||||
if (owns()) handler.clearTurnStatus(kind)
|
||||
},
|
||||
onNoticeShow = ::showGatewayNotice,
|
||||
onNoticeClear = ::clearGatewayNotice,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -9368,11 +9461,7 @@ class ChatViewModel : ViewModel() {
|
||||
val personaPrompt: String?,
|
||||
val appContext: String?,
|
||||
val interfaceContext: String?,
|
||||
/**
|
||||
* Relay media-capability hint — tells the agent it can surface images/
|
||||
* files by absolute server path. Non-null only on SSE turns when a relay
|
||||
* route is configured (the gateway has no system slot to carry it).
|
||||
*/
|
||||
/** Upstream-first media capability plus any additive Relay enhancement. */
|
||||
val mediaCapability: String?,
|
||||
/**
|
||||
* Relay-plugin-owned server-side context blocks that are injected into
|
||||
@@ -9427,13 +9516,23 @@ class ChatViewModel : ViewModel() {
|
||||
selected != _defaultPersonality.value -> personalityPrompts[selected]
|
||||
else -> null
|
||||
}
|
||||
val appContextRaw = buildPromptBlock(appContextSettings, capturePhoneSnapshot())
|
||||
// Tell the agent it can surface images/files by absolute server path —
|
||||
// but only on SSE (the gateway carries no system_message) and only when
|
||||
// a relay route is configured (otherwise the client can't fetch them).
|
||||
val availableTools = if (gateway) {
|
||||
gatewayClient?.serverTools?.value
|
||||
} else {
|
||||
_sseToolNames.value
|
||||
}
|
||||
val appContextRaw = buildPromptBlock(
|
||||
settings = appContextSettings,
|
||||
snapshot = capturePhoneSnapshot(),
|
||||
availableTools = availableTools,
|
||||
)
|
||||
// Gateway has no per-turn system slot. SSE carries the standard
|
||||
// Dashboard route first, then the optional Relay enhancement.
|
||||
val upstreamMediaAvailable = dashboardMediaClientProvider?.invoke() != null
|
||||
val relayMediaAvailable = relayHttpClient?.mediaUrlConfigured() == true
|
||||
val mediaCapability: String? =
|
||||
RELAY_MEDIA_HINT.takeIf { !gateway && relayMediaAvailable }
|
||||
buildMediaCapabilityHint(upstreamMediaAvailable, relayMediaAvailable)
|
||||
.takeIf { !gateway }
|
||||
// combinedSystemMessage appends the media hint after the phone-status
|
||||
// block (a stable environment fact, like phone status) and before the
|
||||
// per-turn interface context. The per-block fields below null out blanks
|
||||
@@ -9673,6 +9772,7 @@ class ChatViewModel : ViewModel() {
|
||||
scheduleCheckpointWrite(immediate = true)
|
||||
}
|
||||
val observedImageToolStates = mutableMapOf<String, String>()
|
||||
val nativeImageToolProgressObserved = AtomicBoolean(false)
|
||||
val handleToolCallStart = { toolCallId: String, toolName: String, argsPreview: String? ->
|
||||
markTransportAccepted()
|
||||
ensurePostInterimMessage()
|
||||
@@ -9686,10 +9786,16 @@ class ChatViewModel : ViewModel() {
|
||||
scheduleCheckpointWrite(immediate = true)
|
||||
}
|
||||
val onToolCallStartCb = { toolCallId: String, toolName: String ->
|
||||
if (isImageGenerationToolName(toolName)) {
|
||||
nativeImageToolProgressObserved.set(true)
|
||||
}
|
||||
handleToolCallStart(toolCallId, toolName, null)
|
||||
}
|
||||
val onGatewayToolCallStartCb =
|
||||
{ toolCallId: String, toolName: String, argsPreview: String? ->
|
||||
if (isImageGenerationToolName(toolName)) {
|
||||
nativeImageToolProgressObserved.set(true)
|
||||
}
|
||||
handleToolCallStart(toolCallId, toolName, argsPreview)
|
||||
}
|
||||
val onToolCallDoneCb = { toolCallId: String, resultPreview: String? ->
|
||||
@@ -9722,10 +9828,18 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
fun startImageActivityBridge() {
|
||||
val relay = relayHttpClient ?: return
|
||||
if (!relay.mediaUrlConfigured()) return
|
||||
stopImageActivityBridge()
|
||||
imageActivityJob = viewModelScope.launch {
|
||||
// Current upstream emits native tool progress. Give that
|
||||
// authoritative path the first opportunity to identify image
|
||||
// work; Relay polling is compatibility-only for older hosts
|
||||
// whose stream omitted those events.
|
||||
delay(1_000)
|
||||
if (nativeImageToolProgressObserved.get()) return@launch
|
||||
var consecutiveErrors = 0
|
||||
while (true) {
|
||||
if (nativeImageToolProgressObserved.get()) break
|
||||
val activeSessionId = handler.currentSessionId.value
|
||||
if (activeSessionId.isNullOrBlank()) {
|
||||
delay(250)
|
||||
@@ -9747,7 +9861,7 @@ class ChatViewModel : ViewModel() {
|
||||
snapshot.activities.forEach { activity ->
|
||||
val prior = observedImageToolStates[activity.callId]
|
||||
if (prior == null) {
|
||||
onToolCallStartCb(activity.callId, activity.toolName)
|
||||
handleToolCallStart(activity.callId, activity.toolName, null)
|
||||
}
|
||||
if (
|
||||
activity.state == "completed" &&
|
||||
@@ -10419,6 +10533,10 @@ class ChatViewModel : ViewModel() {
|
||||
_steerableTurn.value = false
|
||||
onPreflightErrorCb(Exception(reason))
|
||||
},
|
||||
onSubmitRejected = { reason ->
|
||||
_steerableTurn.value = false
|
||||
onPreflightErrorCb(Exception(reason))
|
||||
},
|
||||
onFailure = { failure ->
|
||||
val confirmedModel = gateway.serverModel.value
|
||||
?.takeIf { it.isNotBlank() }
|
||||
@@ -10454,6 +10572,8 @@ class ChatViewModel : ViewModel() {
|
||||
onStatusClear = { kind ->
|
||||
handler.clearTurnStatus(kind)
|
||||
},
|
||||
onNoticeShow = ::showGatewayNotice,
|
||||
onNoticeClear = ::clearGatewayNotice,
|
||||
),
|
||||
attachments = (attachments.orEmpty() + gatewayOnlyAttachments)
|
||||
.map { it.toGatewayAttachment() },
|
||||
@@ -10609,7 +10729,7 @@ class ChatViewModel : ViewModel() {
|
||||
* placeholder as actionable FAILED with [MEDIA_TAP_TO_DOWNLOAD] in
|
||||
* [Attachment.errorMessage]. The UI renders a retry card.
|
||||
* 4. Otherwise → kick off a background fetch, enforce the max size cap,
|
||||
* cache the bytes via [MediaCacheWriter], and update the attachment
|
||||
* stream into [MediaCacheWriter], and update the attachment
|
||||
* to LOADED (or FAILED on any error).
|
||||
*
|
||||
* Note: the matching happens by (messageId + relayToken). If the same
|
||||
@@ -10625,6 +10745,8 @@ class ChatViewModel : ViewModel() {
|
||||
val relay = relayHttpClient
|
||||
val repo = mediaSettingsRepo
|
||||
val cache = mediaCacheWriter
|
||||
val routeOwner = activeProfileContextKey
|
||||
val historyGeneration = historyLoadGeneration.get()
|
||||
|
||||
// 1. Insert LOADING placeholder.
|
||||
val placeholder = Attachment(
|
||||
@@ -10662,8 +10784,22 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
|
||||
// 3. Fetch + cache.
|
||||
performFetchWith(handler, messageId, token, settings) {
|
||||
relay.fetchMedia(token)
|
||||
performFetchWith(
|
||||
handler,
|
||||
messageId,
|
||||
token,
|
||||
settings,
|
||||
expectedContextKey = routeOwner,
|
||||
expectedHistoryGeneration = historyGeneration,
|
||||
) { _ ->
|
||||
if (relay.mediaUrlConfigured()) {
|
||||
relay.fetchMedia(
|
||||
token,
|
||||
maxBytes = settings.maxInboundSizeMb.toLong().coerceAtLeast(1L) * 1024L * 1024L,
|
||||
).asInboundFetchedMedia()
|
||||
} else {
|
||||
Result.failure(MediaRouteUnavailableException())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10690,6 +10826,9 @@ class ChatViewModel : ViewModel() {
|
||||
val att = msg.attachments.getOrNull(attachmentIndex) ?: return
|
||||
val fetchKey = att.relayToken ?: return
|
||||
val expectedRole = msg.role
|
||||
val routeOwner = activeProfileContextKey
|
||||
val historyGeneration = historyLoadGeneration.get()
|
||||
val upstreamMediaClient = dashboardMediaClientProvider?.invoke()
|
||||
|
||||
// Flip back to a pure LOADING spinner (drop the CTA marker) so the
|
||||
// user gets immediate feedback that the download kicked off.
|
||||
@@ -10710,14 +10849,20 @@ class ChatViewModel : ViewModel() {
|
||||
fetchKey,
|
||||
settings,
|
||||
expectedRole = expectedRole,
|
||||
) {
|
||||
expectedContextKey = routeOwner,
|
||||
expectedHistoryGeneration = historyGeneration,
|
||||
) { maxBytes ->
|
||||
if (
|
||||
fetchKey.startsWith("/") ||
|
||||
WINDOWS_ABSOLUTE_MEDIA_PATH_REGEX.matches(fetchKey)
|
||||
) {
|
||||
relay.fetchMediaByPath(fetchKey)
|
||||
fetchServerPath(fetchKey, maxBytes, upstreamMediaClient)
|
||||
} else {
|
||||
relay.fetchMedia(fetchKey)
|
||||
if (relay.mediaUrlConfigured()) {
|
||||
relay.fetchMedia(fetchKey, maxBytes = maxBytes).asInboundFetchedMedia()
|
||||
} else {
|
||||
Result.failure(MediaRouteUnavailableException())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10757,14 +10902,39 @@ class ChatViewModel : ViewModel() {
|
||||
if (supervisedModePolicy.enabled &&
|
||||
!supervisedModePolicy.capabilities.generatedImages
|
||||
) return ServerImageResult.Failure("Generated images are disabled in supervised mode")
|
||||
val relay = relayHttpClient
|
||||
?: return ServerImageResult.Failure("Relay not configured on this connection")
|
||||
// fetchMediaByPath returns Result<MediaBytes>; fold it ONCE, right here,
|
||||
// into a non-Result type. The resolver boundary must not return
|
||||
// kotlin.Result from a suspend fun (see [ServerImageResult]).
|
||||
return relay.fetchMediaByPath(serverPath).fold(
|
||||
onSuccess = { ServerImageResult.Success(it.bytes, it.sensitive) },
|
||||
onFailure = { ServerImageResult.Failure(it.message ?: "relay fetch failed") },
|
||||
val routeOwner = activeProfileContextKey
|
||||
val historyGeneration = historyLoadGeneration.get()
|
||||
val upstreamMediaClient = dashboardMediaClientProvider?.invoke()
|
||||
val maxBytes = mediaSettingsRepo?.settings?.first()?.maxInboundSizeMb
|
||||
?.toLong()
|
||||
?.coerceAtLeast(1L)
|
||||
?.times(1024L * 1024L)
|
||||
?: 25L * 1024L * 1024L
|
||||
val result = fetchServerPath(serverPath, maxBytes, upstreamMediaClient)
|
||||
if (
|
||||
routeOwner != activeProfileContextKey ||
|
||||
historyGeneration != historyLoadGeneration.get()
|
||||
) {
|
||||
return ServerImageResult.Failure("Connection changed while loading image")
|
||||
}
|
||||
return result.fold(
|
||||
onSuccess = { fetched ->
|
||||
try {
|
||||
val cachedUri = fetched.cachedUri ?: mediaCacheWriter?.cache(
|
||||
requireNotNull(fetched.bytes),
|
||||
fetched.contentType,
|
||||
fetched.fileName,
|
||||
)?.toString()
|
||||
if (cachedUri == null) {
|
||||
ServerImageResult.Failure("Media cache is unavailable")
|
||||
} else {
|
||||
ServerImageResult.Success(cachedUri, fetched.sensitive)
|
||||
}
|
||||
} catch (error: Exception) {
|
||||
ServerImageResult.Failure(error.message ?: "Image cache failed")
|
||||
}
|
||||
},
|
||||
onFailure = { ServerImageResult.Failure(it.message ?: "Image unavailable") },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -10808,6 +10978,9 @@ class ChatViewModel : ViewModel() {
|
||||
val relay = relayHttpClient
|
||||
val repo = mediaSettingsRepo
|
||||
val cache = mediaCacheWriter
|
||||
val routeOwner = activeProfileContextKey
|
||||
val historyGeneration = historyLoadGeneration.get()
|
||||
val upstreamMediaClient = dashboardMediaClientProvider?.invoke()
|
||||
|
||||
val placeholder = Attachment(
|
||||
contentType = if (expectedRole == MessageRole.USER) {
|
||||
@@ -10864,12 +11037,81 @@ class ChatViewModel : ViewModel() {
|
||||
originalPath,
|
||||
settings,
|
||||
expectedRole = expectedRole,
|
||||
) {
|
||||
relay.fetchMediaByPath(originalPath)
|
||||
expectedContextKey = routeOwner,
|
||||
expectedHistoryGeneration = historyGeneration,
|
||||
) { maxBytes ->
|
||||
fetchServerPath(originalPath, maxBytes, upstreamMediaClient)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve a gateway-local path upstream-first. Relay is an additive
|
||||
* compatibility route for older hosts or paths outside upstream's managed
|
||||
* file policy; it is never required when current upstream can serve the
|
||||
* file directly.
|
||||
*/
|
||||
private suspend fun fetchServerPath(
|
||||
serverPath: String,
|
||||
maxBytes: Long,
|
||||
upstream: DashboardApiClient?,
|
||||
): Result<InboundFetchedMedia> {
|
||||
if (upstream != null) {
|
||||
val cache = mediaCacheWriter
|
||||
?: return Result.failure(IOException("Media cache is unavailable"))
|
||||
val context = appContext
|
||||
?: return Result.failure(IOException("Application context is unavailable"))
|
||||
val staging = File.createTempFile("hermes-media-", ".part", context.cacheDir)
|
||||
val upstreamResult = try {
|
||||
val fetchedResult = staging.outputStream().buffered().use { output ->
|
||||
upstream.downloadManagedFile(serverPath, maxBytes, output)
|
||||
}
|
||||
if (fetchedResult.isFailure) {
|
||||
Result.failure(fetchedResult.exceptionOrNull()!!)
|
||||
} else {
|
||||
val fetched = fetchedResult.getOrThrow()
|
||||
val uri = cache.cache(staging, fetched.contentType, fetched.fileName)
|
||||
Result.success(
|
||||
InboundFetchedMedia(
|
||||
contentType = fetched.contentType,
|
||||
fileName = fetched.fileName,
|
||||
sensitive = false,
|
||||
sizeBytes = fetched.sizeBytes,
|
||||
cachedUri = uri.toString(),
|
||||
),
|
||||
)
|
||||
}
|
||||
} catch (error: CancellationException) {
|
||||
throw error
|
||||
} catch (error: Exception) {
|
||||
Result.failure(error)
|
||||
} finally {
|
||||
staging.delete()
|
||||
}
|
||||
if (upstreamResult.isSuccess) return upstreamResult
|
||||
val upstreamFailure = upstreamResult.exceptionOrNull()
|
||||
if (upstreamFailure?.isDashboardManagedFilesUnsupported() != true) {
|
||||
return upstreamResult
|
||||
}
|
||||
val relay = relayHttpClient
|
||||
if (relay?.mediaUrlConfigured() == true) {
|
||||
return relay.fetchMediaByPath(serverPath, maxBytes = maxBytes)
|
||||
.asInboundFetchedMedia()
|
||||
}
|
||||
return Result.failure(MediaRouteUnavailableException(upstreamFailure))
|
||||
}
|
||||
|
||||
val relay = relayHttpClient
|
||||
return if (relay?.mediaUrlConfigured() == true) {
|
||||
relay.fetchMediaByPath(serverPath, maxBytes = maxBytes).asInboundFetchedMedia()
|
||||
} else {
|
||||
Result.failure(MediaRouteUnavailableException())
|
||||
}
|
||||
}
|
||||
|
||||
private class MediaRouteUnavailableException(cause: Throwable? = null) :
|
||||
java.io.IOException(MEDIA_HOST_ONLY, cause)
|
||||
|
||||
private fun persistedImageContentType(path: String): String =
|
||||
when (path.substringAfterLast('.').lowercase()) {
|
||||
"avif" -> "image/avif"
|
||||
@@ -10899,13 +11141,15 @@ class ChatViewModel : ViewModel() {
|
||||
fetchKey: String,
|
||||
settings: MediaSettings,
|
||||
expectedRole: MessageRole = MessageRole.ASSISTANT,
|
||||
fetch: suspend () -> Result<RelayHttpClient.FetchedMedia>,
|
||||
expectedContextKey: String? = activeProfileContextKey,
|
||||
expectedHistoryGeneration: Int = historyLoadGeneration.get(),
|
||||
fetch: suspend (maxBytes: Long) -> Result<InboundFetchedMedia>,
|
||||
) {
|
||||
val cache = mediaCacheWriter ?: return
|
||||
val maxBytes = settings.maxInboundSizeMb.toLong().coerceAtLeast(1) * 1024L * 1024L
|
||||
|
||||
val result = try {
|
||||
withTimeout(MEDIA_FETCH_TIMEOUT_MS) { fetch() }
|
||||
withTimeout(MEDIA_FETCH_TIMEOUT_MS) { fetch(maxBytes) }
|
||||
} catch (e: TimeoutCancellationException) {
|
||||
Result.failure(java.io.IOException("Media download timed out"))
|
||||
} catch (e: CancellationException) {
|
||||
@@ -10913,10 +11157,15 @@ class ChatViewModel : ViewModel() {
|
||||
} catch (e: Exception) {
|
||||
Result.failure(e)
|
||||
}
|
||||
if (
|
||||
chatHandler !== handler ||
|
||||
activeProfileContextKey != expectedContextKey ||
|
||||
historyLoadGeneration.get() != expectedHistoryGeneration
|
||||
) return
|
||||
result.fold(
|
||||
onSuccess = { fetched ->
|
||||
if (fetched.bytes.size > maxBytes) {
|
||||
val sizeMb = fetched.bytes.size / (1024.0 * 1024.0)
|
||||
if (fetched.sizeBytes > maxBytes) {
|
||||
val sizeMb = fetched.sizeBytes / (1024.0 * 1024.0)
|
||||
updateAttachmentByToken(handler, messageId, fetchKey, expectedRole = expectedRole) { att ->
|
||||
att.copy(
|
||||
state = AttachmentState.FAILED,
|
||||
@@ -10925,22 +11174,26 @@ class ChatViewModel : ViewModel() {
|
||||
),
|
||||
contentType = fetched.contentType,
|
||||
fileName = fetched.fileName ?: att.fileName,
|
||||
fileSize = fetched.bytes.size.toLong()
|
||||
fileSize = fetched.sizeBytes
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
val uri = cache.cache(fetched.bytes, fetched.contentType, fetched.fileName)
|
||||
val cachedUri = fetched.cachedUri ?: cache.cache(
|
||||
requireNotNull(fetched.bytes),
|
||||
fetched.contentType,
|
||||
fetched.fileName,
|
||||
).toString()
|
||||
updateAttachmentByToken(handler, messageId, fetchKey, expectedRole = expectedRole) { att ->
|
||||
att.copy(
|
||||
state = AttachmentState.LOADED,
|
||||
errorMessage = null,
|
||||
contentType = fetched.contentType,
|
||||
fileName = fetched.fileName ?: att.fileName,
|
||||
fileSize = fetched.bytes.size.toLong(),
|
||||
cachedUri = uri.toString(),
|
||||
fileSize = fetched.sizeBytes,
|
||||
cachedUri = cachedUri,
|
||||
// Carry the relay-authoritative sensitivity bit
|
||||
// (X-Media-Sensitive header) onto the LOADED
|
||||
// attachment so the renderer can blur per the
|
||||
@@ -10965,6 +11218,15 @@ class ChatViewModel : ViewModel() {
|
||||
}
|
||||
},
|
||||
onFailure = { err ->
|
||||
if (err is MediaRouteUnavailableException) {
|
||||
updateAttachmentByToken(handler, messageId, fetchKey, expectedRole = expectedRole) { att ->
|
||||
att.copy(
|
||||
state = AttachmentState.FAILED,
|
||||
errorMessage = MEDIA_HOST_ONLY,
|
||||
)
|
||||
}
|
||||
return@fold
|
||||
}
|
||||
val human = classifyError(err, context = "media_fetch", ctx = appContext)
|
||||
updateAttachmentByToken(handler, messageId, fetchKey, expectedRole = expectedRole) { att ->
|
||||
att.copy(
|
||||
@@ -10977,6 +11239,26 @@ class ChatViewModel : ViewModel() {
|
||||
)
|
||||
}
|
||||
|
||||
private data class InboundFetchedMedia(
|
||||
val contentType: String,
|
||||
val fileName: String?,
|
||||
val sensitive: Boolean,
|
||||
val sizeBytes: Long,
|
||||
val bytes: ByteArray? = null,
|
||||
val cachedUri: String? = null,
|
||||
)
|
||||
|
||||
private fun Result<RelayHttpClient.FetchedMedia>.asInboundFetchedMedia(): Result<InboundFetchedMedia> =
|
||||
map { fetched ->
|
||||
InboundFetchedMedia(
|
||||
contentType = fetched.contentType,
|
||||
fileName = fetched.fileName,
|
||||
sensitive = fetched.sensitive,
|
||||
sizeBytes = fetched.bytes.size.toLong(),
|
||||
bytes = fetched.bytes,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Append an attachment to a specific assistant message, matched by id.
|
||||
* No-ops if the message can't be found (e.g. it was trimmed from the
|
||||
|
||||
@@ -72,8 +72,9 @@ data class GitTarget(
|
||||
/**
|
||||
* View model for the Git State Android surface (read + write).
|
||||
*
|
||||
* Loads the scanned repo list from the Hermes-Relay plugin and, on selection,
|
||||
* fetches working-tree status + branches. Mutations (stage/unstage/discard/
|
||||
* Loads the active session repository from upstream first and adds repositories
|
||||
* discovered by the Hermes-Relay plugin. On selection it fetches working-tree
|
||||
* status + branches. Mutations (stage/unstage/discard/
|
||||
* commit/fetch/pull/push/checkout) all require the ``plugin.api.write`` grant:
|
||||
* ``configure`` binds one connection/profile/Dashboard owner and every mutation
|
||||
* refuses (surfacing a readable message, never a POST) when that owner's grant
|
||||
@@ -119,12 +120,12 @@ class GitStateViewModel(application: Application) : AndroidViewModel(application
|
||||
private var mutationJob: Job? = null
|
||||
private var messageJob: Job? = null
|
||||
private var scopeKey: String? = null
|
||||
private var sessionRepoPath: String? = null
|
||||
private var targetGeneration: Long = 0
|
||||
|
||||
fun selectedRepoIdForDisplay(): String? = _selectedRepoId.value
|
||||
|
||||
fun currentTarget(): GitTarget? {
|
||||
if (!_scanningEnabled.value) return null
|
||||
val owner = scopeKey ?: return null
|
||||
val repo = _selectedRepoId.value ?: return null
|
||||
return GitTarget(owner, repo, targetGeneration)
|
||||
@@ -143,10 +144,34 @@ class GitStateViewModel(application: Application) : AndroidViewModel(application
|
||||
api = dashboard?.let(::GitStateApiClient)
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind standard Git to the active upstream session workspace.
|
||||
*
|
||||
* An exact `git_repo_root` wins; `cwd` is the official Desktop-compatible
|
||||
* fallback. Changing sessions invalidates every selected repository target
|
||||
* before starting a fresh, owner-bound discovery pass.
|
||||
*/
|
||||
fun setSessionWorkspace(repoRoot: String?, workingDirectory: String?) {
|
||||
val next = repoRoot?.trim()?.takeIf { it.isNotBlank() }
|
||||
?: workingDirectory?.trim()?.takeIf { it.isNotBlank() }
|
||||
if (sessionRepoPath == next) return
|
||||
val workspaceWasLoaded = _repos.value !is GitStateUiState.Loading
|
||||
sessionRepoPath = next
|
||||
targetGeneration += 1
|
||||
clearWorkspaceState()
|
||||
// Preserve lazy discovery: the first host scan still starts only when
|
||||
// the Git workspace asks for it. Once visible/loaded, a session switch
|
||||
// refreshes immediately against the new exact workspace.
|
||||
if (workspaceWasLoaded) loadRepos()
|
||||
}
|
||||
|
||||
fun setScanningEnabled(enabled: Boolean) {
|
||||
if (_scanningEnabled.value == enabled) return
|
||||
val workspaceWasLoaded = _repos.value !is GitStateUiState.Loading
|
||||
_scanningEnabled.value = enabled
|
||||
if (!enabled) clearWorkspaceState()
|
||||
targetGeneration += 1
|
||||
clearWorkspaceState()
|
||||
if (workspaceWasLoaded) loadRepos()
|
||||
}
|
||||
|
||||
/** Grants the plugin.api.write capability for this connection/profile. */
|
||||
@@ -158,7 +183,6 @@ class GitStateViewModel(application: Application) : AndroidViewModel(application
|
||||
fun hasWriteGrant(): Boolean = _writeGrant.value
|
||||
|
||||
fun loadRepos() {
|
||||
if (!_scanningEnabled.value) return
|
||||
val client = api ?: run {
|
||||
_repos.value = GitStateUiState.Error("Dashboard connection unavailable")
|
||||
return
|
||||
@@ -167,7 +191,10 @@ class GitStateViewModel(application: Application) : AndroidViewModel(application
|
||||
reposJob?.cancel()
|
||||
reposJob = viewModelScope.launch {
|
||||
_repos.value = GitStateUiState.Loading
|
||||
client.repos().fold(
|
||||
client.repos(
|
||||
sessionRepoPath = sessionRepoPath,
|
||||
includeRelayDiscovery = _scanningEnabled.value,
|
||||
).fold(
|
||||
onSuccess = { list ->
|
||||
if (scopeKey == expectedScope) {
|
||||
_repos.value = GitStateUiState.Ready(list, null)
|
||||
@@ -208,7 +235,6 @@ class GitStateViewModel(application: Application) : AndroidViewModel(application
|
||||
}
|
||||
|
||||
fun selectRepo(repoId: String) {
|
||||
if (!_scanningEnabled.value) return
|
||||
val client = api ?: return
|
||||
targetGeneration += 1
|
||||
_selectedRepoId.value = repoId
|
||||
|
||||
@@ -669,8 +669,8 @@
|
||||
<string name="settings_voice_mode">Modo de voz</string>
|
||||
<string name="settings_voice_mode_desc">Voz do painel, opções de relay em tempo real e provedores</string>
|
||||
<string name="settings_threads">Threads</string>
|
||||
<string name="settings_threads_desc">Permita que o agente inicie conversas com você (desativado por padrão)</string>
|
||||
<string name="settings_power_tools">Ferramentas avançadas</string>
|
||||
<string name="settings_threads_desc">Conversas iniciadas pelo Relay e entrega proativa (desativado por padrão)</string>
|
||||
<string name="settings_power_tools">Ferramentas do Relay</string>
|
||||
<string name="settings_terminal">Terminal</string>
|
||||
<string name="settings_terminal_desc">Acesso ao shell do servidor por uma sessão pareada do relay</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -682,7 +682,7 @@
|
||||
<string name="settings_notification_companion">Assistente de notificações</string>
|
||||
<string name="settings_notification_companion_desc">Notificações compartilhadas do celular para ferramentas pareadas do relay</string>
|
||||
<string name="settings_media">Mídia</string>
|
||||
<string name="settings_media_desc">Anexos recebidos pelo Relay, busca automática e limite do cache</string>
|
||||
<string name="settings_media_desc">Anexos do chat, downloads, privacidade e cache</string>
|
||||
<string name="settings_bridge_safety">Segurança do Bridge</string>
|
||||
<string name="settings_bridge_safety_desc">Lista de bloqueio, confirmação de verbos destrutivos e desativação automática</string>
|
||||
<string name="settings_sideload">Sideload</string>
|
||||
@@ -1162,8 +1162,8 @@
|
||||
<!-- P1: MediaSettingsScreen -->
|
||||
<string name="media_title">Mídia</string>
|
||||
<string name="media_back">Voltar</string>
|
||||
<string name="media_intro_1">Controla como o app lida com arquivos enviados pelos resultados de ferramentas (capturas de tela, PDFs etc.) pelo relay.</string>
|
||||
<string name="media_intro_2">Somente Relay — estas configurações não afetam as imagens que você anexa no chat nem nada em uma conexão padrão (sem Relay).</string>
|
||||
<string name="media_intro_1">Controla como o app baixa, protege e armazena em cache os arquivos enviados pelo Hermes no chat.</string>
|
||||
<string name="media_intro_2">A mídia padrão do Dashboard é priorizada. Quando pareado, o Relay pode acrescentar entrega de compatibilidade e metadados de sensibilidade.</string>
|
||||
<string name="media_max_inbound">Tamanho máximo dos anexos recebidos</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">Arquivos maiores que isso são rejeitados após o download.</string>
|
||||
@@ -2080,7 +2080,8 @@
|
||||
<string name="session_path_signin_for_gateway">Entre em Gerenciar para usar o Gateway com pensamento ao vivo.</string>
|
||||
<string name="session_path_gateway_api_server">Disponível no transporte do Gateway — esta sessão transmite pelo servidor API.</string>
|
||||
<string name="session_path_relay_not_connected">Relay pareado, mas desconectado.</string>
|
||||
<string name="session_path_pair_relay_media">Pareie o relay para enviar e receber mídia.</string>
|
||||
<string name="session_path_pair_relay_media">Pareie o Relay para compatibilidade de mídia em hosts Hermes mais antigos.</string>
|
||||
<string name="session_path_media_not_ready">Atualize o Hermes para entrega de mídia padrão ou pareie o Relay para compatibilidade.</string>
|
||||
<string name="session_path_pair_relay_terminal">Pareie o relay para acessar o terminal.</string>
|
||||
<string name="session_path_voice_not_ready">A voz não está pronta nesta conexão.</string>
|
||||
<string name="session_path_threads_pair_relay">Pareie o relay e ative \"Permitir que o Hermes me envie mensagens\" para o agente poder abrir Threads.</string>
|
||||
@@ -2678,6 +2679,8 @@
|
||||
<string name="inbound_attach_downloading">Baixando…%1$s</string>
|
||||
<string name="inbound_attach_failed">Falha no anexo</string>
|
||||
<string name="inbound_attach_tap_retry">Toque para tentar novamente</string>
|
||||
<string name="inbound_attach_host_only">O arquivo está no seu host Hermes</string>
|
||||
<string name="inbound_attach_host_only_help">Atualize o Hermes para downloads padrão ou pareie o Relay para compatibilidade.</string>
|
||||
<string name="inbound_attach_open">Abrir externamente</string>
|
||||
<string name="inbound_attach_share">Compartilhar</string>
|
||||
<string name="inbound_attach_save">Salvar no dispositivo</string>
|
||||
@@ -3151,6 +3154,8 @@
|
||||
<string name="diag_check_ready_with">Pronto com %s</string>
|
||||
<string name="diag_check_relay_active">Relay ativo</string>
|
||||
<string name="diag_check_relay_not_configured">Relay não configurado</string>
|
||||
<string name="diag_relay_tools_optional">Ferramentas do Relay (opcionais)</string>
|
||||
<string name="diag_relay_tools_not_paired">Não pareado</string>
|
||||
<string name="diag_check_relay_server">Verificar servidor relay</string>
|
||||
<string name="diag_check_relay_plugin">Plugin do Relay</string>
|
||||
<string name="diag_plugin_not_configured">O plugin opcional não está configurado</string>
|
||||
@@ -3180,8 +3185,8 @@
|
||||
<string name="inbound_attach_cd_cancel">Cancelar</string>
|
||||
<string name="inbound_attach_open_failed">Não foi possível abrir o anexo</string>
|
||||
<string name="inbound_attach_share_failed">Não foi possível compartilhar o anexo</string>
|
||||
<string name="injected_context_media_no_relay">A mídia exige uma conexão ativa com o Relay</string>
|
||||
<string name="injected_context_media_relay_active">Relay ativo para mídia</string>
|
||||
<string name="injected_context_media_no_relay">Nenhuma instrução extra de mídia — a entrega padrão continua sob responsabilidade do servidor</string>
|
||||
<string name="injected_context_media_relay_active">Aprimoramento de mídia do Relay disponível</string>
|
||||
<string name="injected_context_media_title">Compartilhamento de mídia</string>
|
||||
<string name="injected_context_persona_not_set">Nenhuma persona definida</string>
|
||||
<string name="injected_context_persona_server_side">Persona no servidor</string>
|
||||
@@ -4332,7 +4337,7 @@
|
||||
<string name="chat_git_deletions">%1$d exclusões</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="one">%1$d alteração</item><item quantity="other">%1$d alterações</item></plurals>
|
||||
<string name="settings_git_workspace">Espaço de trabalho Git</string>
|
||||
<string name="settings_git_workspace_desc">Revise alterações, branches, commits e remotos</string>
|
||||
<string name="settings_git_workspace_desc">Git da sessão atual primeiro, com descoberta opcional do host</string>
|
||||
<string name="current_chat_activity_title">Atividade atual do chat</string>
|
||||
<string name="current_chat_activity_subtitle">Detalhes ao vivo e somente leitura deste chat</string>
|
||||
<string name="current_chat_activity_open">Visualizar atividade atual do chat</string>
|
||||
@@ -4367,7 +4372,7 @@
|
||||
<string name="agent_activity_child_role_task">Tarefa</string>
|
||||
<string name="agent_activity_child_role_agent">Agente</string>
|
||||
<string name="agent_activity_child_role_system">Sistema</string>
|
||||
<string name="settings_git_workspace_off_desc">Desativado · A verificação de repositórios no host é opcional</string>
|
||||
<string name="settings_git_workspace_off_desc">Somente repositório da sessão · A descoberta do host é opcional</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -707,8 +707,8 @@
|
||||
<string name="settings_voice_mode">语音模式</string>
|
||||
<string name="settings_voice_mode_desc">仪表盘语音、实时 Relay 选项、提供商</string>
|
||||
<string name="settings_threads">话题</string>
|
||||
<string name="settings_threads_desc">允许代理主动与你对话(默认关闭)</string>
|
||||
<string name="settings_power_tools">高级工具</string>
|
||||
<string name="settings_threads_desc">由 Relay 发起的对话和主动推送(默认关闭)</string>
|
||||
<string name="settings_power_tools">Relay 工具</string>
|
||||
<string name="settings_terminal">终端</string>
|
||||
<string name="settings_terminal_desc">通过已配对的 Relay 会话访问服务器 shell</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -720,7 +720,7 @@
|
||||
<string name="settings_notification_companion">通知助手</string>
|
||||
<string name="settings_notification_companion_desc">为已配对的 Relay 工具共享手机通知</string>
|
||||
<string name="settings_media">媒体</string>
|
||||
<string name="settings_media_desc">Relay 入站附件、自动获取、缓存上限</string>
|
||||
<string name="settings_media_desc">聊天附件、下载行为、隐私和缓存</string>
|
||||
<string name="settings_bridge_safety">Bridge 安全</string>
|
||||
<string name="settings_bridge_safety_desc">黑名单、破坏性动词确认、自动禁用</string>
|
||||
<string name="settings_sideload">Sideload</string>
|
||||
@@ -1212,8 +1212,8 @@
|
||||
<!-- P1: MediaSettingsScreen -->
|
||||
<string name="media_title">媒体</string>
|
||||
<string name="media_back">返回</string>
|
||||
<string name="media_intro_1">控制应用如何处理通过 Relay 传来的工具结果文件(截图、PDF 等)。</string>
|
||||
<string name="media_intro_2">仅限 Relay——这些设置不影响你在聊天中附加的图片或标准(无 Relay)连接上的任何内容。</string>
|
||||
<string name="media_intro_1">控制应用如何下载、保护和缓存 Hermes 在聊天中发送的文件。</string>
|
||||
<string name="media_intro_2">优先使用标准 Dashboard 媒体。配对后,Relay 可补充兼容性传输和敏感度元数据。</string>
|
||||
<string name="media_max_inbound">最大入站附件大小</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">超过此大小的文件在下载后被拒绝。</string>
|
||||
@@ -2166,7 +2166,8 @@
|
||||
<string name="session_path_signin_for_gateway">请在管理页面登录以使用实时思考 Gateway。</string>
|
||||
<string name="session_path_gateway_api_server">Gateway 传输可用——此会话通过 API 服务器传输。</string>
|
||||
<string name="session_path_relay_not_connected">Relay 已配对但未连接。</string>
|
||||
<string name="session_path_pair_relay_media">配对 Relay 以发送和接收媒体。</string>
|
||||
<string name="session_path_pair_relay_media">配对 Relay,以兼容较旧 Hermes 主机上的媒体。</string>
|
||||
<string name="session_path_media_not_ready">更新 Hermes 以使用标准媒体传输,或配对 Relay 以获得兼容性。</string>
|
||||
<string name="session_path_pair_relay_terminal">配对 Relay 以使用终端。</string>
|
||||
<string name="session_path_voice_not_ready">此连接的语音未就绪。</string>
|
||||
<string name="session_path_threads_pair_relay">配对 Relay 并开启"让 Hermes 联系我",代理才能打开话题。</string>
|
||||
@@ -2791,6 +2792,8 @@
|
||||
<string name="inbound_attach_downloading">正在下载…%1$s</string>
|
||||
<string name="inbound_attach_failed">附件失败</string>
|
||||
<string name="inbound_attach_tap_retry">点击重试</string>
|
||||
<string name="inbound_attach_host_only">文件位于你的 Hermes 主机上</string>
|
||||
<string name="inbound_attach_host_only_help">更新 Hermes 以使用标准下载,或配对 Relay 以获得兼容性。</string>
|
||||
<string name="inbound_attach_open">外部打开</string>
|
||||
<string name="inbound_attach_share">分享</string>
|
||||
<string name="inbound_attach_save">保存到设备</string>
|
||||
@@ -3250,6 +3253,8 @@
|
||||
<string name="diag_check_ready_with">已就绪(%s)</string>
|
||||
<string name="diag_check_relay_active">Relay 活跃</string>
|
||||
<string name="diag_check_relay_not_configured">Relay 未配置</string>
|
||||
<string name="diag_relay_tools_optional">Relay 工具(可选)</string>
|
||||
<string name="diag_relay_tools_not_paired">未配对</string>
|
||||
<string name="diag_check_relay_server">检查 Relay 服务器</string>
|
||||
<string name="diag_check_relay_plugin">Relay 插件</string>
|
||||
<string name="diag_plugin_not_configured">未配置可选插件</string>
|
||||
@@ -3279,8 +3284,8 @@
|
||||
<string name="inbound_attach_cd_cancel">取消</string>
|
||||
<string name="inbound_attach_open_failed">无法打开附件</string>
|
||||
<string name="inbound_attach_share_failed">无法分享附件</string>
|
||||
<string name="injected_context_media_no_relay">媒体需要活跃的 Relay 连接</string>
|
||||
<string name="injected_context_media_relay_active">Relay 已为媒体激活</string>
|
||||
<string name="injected_context_media_no_relay">没有额外媒体指令——标准传输仍由服务器负责</string>
|
||||
<string name="injected_context_media_relay_active">Relay 媒体增强可用</string>
|
||||
<string name="injected_context_media_title">媒体共享</string>
|
||||
<string name="injected_context_persona_not_set">未设置角色</string>
|
||||
<string name="injected_context_persona_server_side">服务端角色</string>
|
||||
@@ -4413,7 +4418,7 @@
|
||||
<string name="chat_git_deletions">删除 %1$d 行</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="other">%1$d 个更改</item></plurals>
|
||||
<string name="settings_git_workspace">Git 工作区</string>
|
||||
<string name="settings_git_workspace_desc">查看更改、分支、提交和远程仓库</string>
|
||||
<string name="settings_git_workspace_desc">优先使用当前会话的 Git,可选择发现主机仓库</string>
|
||||
<string name="current_chat_activity_title">当前聊天活动</string>
|
||||
<string name="current_chat_activity_subtitle">此聊天中的只读实时详情</string>
|
||||
<string name="current_chat_activity_open">预览当前聊天活动</string>
|
||||
@@ -4448,7 +4453,7 @@
|
||||
<string name="agent_activity_child_role_task">任务</string>
|
||||
<string name="agent_activity_child_role_agent">代理</string>
|
||||
<string name="agent_activity_child_role_system">系统</string>
|
||||
<string name="settings_git_workspace_off_desc">关闭 · 主机仓库扫描需手动启用</string>
|
||||
<string name="settings_git_workspace_off_desc">仅会话仓库 · 主机发现需手动启用</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -710,8 +710,8 @@
|
||||
<string name="settings_voice_mode">Sprachmodus</string>
|
||||
<string name="settings_voice_mode_desc">Dashboard-Sprache, Echtzeit-Relay-Optionen, Anbieter</string>
|
||||
<string name="settings_threads">Threads</string>
|
||||
<string name="settings_threads_desc">Dem Agenten erlauben, Unterhaltungen mit dir zu beginnen (standardmäßig aus)</string>
|
||||
<string name="settings_power_tools">Profiwerkzeuge</string>
|
||||
<string name="settings_threads_desc">Vom Relay gestartete Unterhaltungen und proaktive Zustellung (standardmäßig aus)</string>
|
||||
<string name="settings_power_tools">Relay-Werkzeuge</string>
|
||||
<string name="settings_terminal">Terminal</string>
|
||||
<string name="settings_terminal_desc">Zugriff auf die Server-Shell über eine gekoppelte Relay-Sitzung</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -723,7 +723,7 @@
|
||||
<string name="settings_notification_companion">Benachrichtigungsassistent</string>
|
||||
<string name="settings_notification_companion_desc">Geteilte Smartphone-Benachrichtigungen für gekoppelte Relay-Werkzeuge</string>
|
||||
<string name="settings_media">Medien</string>
|
||||
<string name="settings_media_desc">Eingehende Relay-Anhänge, automatischer Abruf, Cache-Limit</string>
|
||||
<string name="settings_media_desc">Chat-Anhänge, Downloadverhalten, Datenschutz und Cache</string>
|
||||
<string name="settings_bridge_safety">Bridge-Sicherheit</string>
|
||||
<string name="settings_bridge_safety_desc">Sperrliste, Bestätigung destruktiver Verben, automatische Deaktivierung</string>
|
||||
<string name="settings_sideload">Sideload</string>
|
||||
@@ -1218,8 +1218,8 @@
|
||||
<!-- P1: MediaSettingsScreen -->
|
||||
<string name="media_title">Medien</string>
|
||||
<string name="media_back">Zurück</string>
|
||||
<string name="media_intro_1">Legt fest, wie die App über das Relay gesendete Dateien aus Werkzeugergebnissen (Screenshots, PDFs usw.) behandelt.</string>
|
||||
<string name="media_intro_2">Nur Relay — diese Einstellungen betreffen weder Bilder, die du im Chat anhängst, noch Inhalte einer Standardverbindung ohne Relay.</string>
|
||||
<string name="media_intro_1">Legt fest, wie die App von Hermes im Chat gesendete Dateien herunterlädt, schützt und zwischenspeichert.</string>
|
||||
<string name="media_intro_2">Standardmäßig werden Dashboard-Medien bevorzugt. Wenn Relay gekoppelt ist, kann es Kompatibilitätszustellung und Vertraulichkeitsmetadaten ergänzen.</string>
|
||||
<string name="media_max_inbound">Max. Größe eingehender Anhänge</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">Größere Dateien werden nach dem Download abgelehnt.</string>
|
||||
@@ -2172,7 +2172,8 @@
|
||||
<string name="session_path_signin_for_gateway">Melde dich unter Verwalten für das Live-Denken-Gateway an.</string>
|
||||
<string name="session_path_gateway_api_server">Auf dem Gateway-Transport verfügbar — diese Sitzung streamt über den API-Server.</string>
|
||||
<string name="session_path_relay_not_connected">Relay gekoppelt, aber nicht verbunden.</string>
|
||||
<string name="session_path_pair_relay_media">Kopple das Relay, um Medien zu senden und zu empfangen.</string>
|
||||
<string name="session_path_pair_relay_media">Kopple Relay für Medienkompatibilität mit älteren Hermes-Hosts.</string>
|
||||
<string name="session_path_media_not_ready">Aktualisiere Hermes für die standardmäßige Medienzustellung oder kopple Relay für Kompatibilität.</string>
|
||||
<string name="session_path_pair_relay_terminal">Kopple das Relay für Terminalzugriff.</string>
|
||||
<string name="session_path_voice_not_ready">Sprache ist bei dieser Verbindung nicht bereit.</string>
|
||||
<string name="session_path_threads_pair_relay">Kopple das Relay und aktiviere „Hermes darf mir schreiben“, damit der Agent Threads öffnen kann.</string>
|
||||
@@ -2797,6 +2798,8 @@
|
||||
<string name="inbound_attach_downloading">Download läuft…%1$s</string>
|
||||
<string name="inbound_attach_failed">Anhang fehlgeschlagen</string>
|
||||
<string name="inbound_attach_tap_retry">Zum erneuten Versuch tippen</string>
|
||||
<string name="inbound_attach_host_only">Datei befindet sich auf deinem Hermes-Host</string>
|
||||
<string name="inbound_attach_host_only_help">Aktualisiere Hermes für Standarddownloads oder kopple Relay für Kompatibilität.</string>
|
||||
<string name="inbound_attach_open">Extern öffnen</string>
|
||||
<string name="inbound_attach_share">Teilen</string>
|
||||
<string name="inbound_attach_save">Auf Gerät speichern</string>
|
||||
@@ -3319,6 +3322,8 @@
|
||||
<string name="diag_check_ready_with">Bereit mit %s</string>
|
||||
<string name="diag_check_relay_active">Relay aktiv</string>
|
||||
<string name="diag_check_relay_not_configured">Relay nicht konfiguriert</string>
|
||||
<string name="diag_relay_tools_optional">Relay-Werkzeuge (optional)</string>
|
||||
<string name="diag_relay_tools_not_paired">Nicht gekoppelt</string>
|
||||
<string name="diag_check_relay_server">Relay-Server prüfen</string>
|
||||
<string name="diag_check_relay_plugin">Relay-Plugin</string>
|
||||
<string name="diag_plugin_not_configured">Optionales Plugin ist nicht konfiguriert</string>
|
||||
@@ -3348,8 +3353,8 @@
|
||||
<string name="inbound_attach_cd_cancel">Abbrechen</string>
|
||||
<string name="inbound_attach_open_failed">Anhang konnte nicht geöffnet werden</string>
|
||||
<string name="inbound_attach_share_failed">Anhang konnte nicht geteilt werden</string>
|
||||
<string name="injected_context_media_no_relay">Medien erfordern eine aktive Relay-Verbindung</string>
|
||||
<string name="injected_context_media_relay_active">Relay für Medien aktiv</string>
|
||||
<string name="injected_context_media_no_relay">Keine zusätzliche Medienanweisung — die Standardzustellung bleibt Aufgabe des Servers</string>
|
||||
<string name="injected_context_media_relay_active">Relay-Medienerweiterung verfügbar</string>
|
||||
<string name="injected_context_media_title">Medienfreigabe</string>
|
||||
<string name="injected_context_persona_not_set">Keine Persona festgelegt</string>
|
||||
<string name="injected_context_persona_server_side">Serverseitige Persona</string>
|
||||
@@ -4489,7 +4494,7 @@
|
||||
<string name="chat_git_deletions">%1$d Löschungen</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="one">%1$d Änderung</item><item quantity="other">%1$d Änderungen</item></plurals>
|
||||
<string name="settings_git_workspace">Git-Arbeitsbereich</string>
|
||||
<string name="settings_git_workspace_desc">Änderungen, Branches, Commits und Remotes prüfen</string>
|
||||
<string name="settings_git_workspace_desc">Zuerst Git der aktuellen Sitzung, mit optionaler Host-Erkennung</string>
|
||||
<string name="current_chat_activity_title">Aktuelle Chat-Aktivität</string>
|
||||
<string name="current_chat_activity_subtitle">Schreibgeschützte Live-Details aus diesem Chat</string>
|
||||
<string name="current_chat_activity_open">Aktuelle Chat-Aktivität ansehen</string>
|
||||
@@ -4524,7 +4529,7 @@
|
||||
<string name="agent_activity_child_role_task">Aufgabe</string>
|
||||
<string name="agent_activity_child_role_agent">Agent</string>
|
||||
<string name="agent_activity_child_role_system">System</string>
|
||||
<string name="settings_git_workspace_off_desc">Aus · Repository-Scan auf dem Host ist optional</string>
|
||||
<string name="settings_git_workspace_off_desc">Nur Sitzungs-Repository · Host-Erkennung ist optional</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -637,8 +637,8 @@
|
||||
<string name="settings_voice_mode">Modo de voz</string>
|
||||
<string name="settings_voice_mode_desc">Panel de voz, opciones relay en tiempo real, proveedores</string>
|
||||
<string name="settings_threads">Threads</string>
|
||||
<string name="settings_threads_desc">Permita que el agente inicie conversaciones con usted (desactivado de forma predeterminada)</string>
|
||||
<string name="settings_power_tools">herramientas eléctricas</string>
|
||||
<string name="settings_threads_desc">Conversaciones iniciadas por Relay y entrega proactiva (desactivado de forma predeterminada)</string>
|
||||
<string name="settings_power_tools">Herramientas de Relay</string>
|
||||
<string name="settings_terminal">Terminal</string>
|
||||
<string name="settings_terminal_desc">Acceso al shell del servidor a través de una sesión relay emparejada</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -650,7 +650,7 @@
|
||||
<string name="settings_notification_companion">Compañero de notificación</string>
|
||||
<string name="settings_notification_companion_desc">Notificaciones telefónicas compartidas para herramientas relay emparejadas</string>
|
||||
<string name="settings_media">Medios de comunicación</string>
|
||||
<string name="settings_media_desc">Relay archivos adjuntos entrantes, búsqueda automática, límite de caché</string>
|
||||
<string name="settings_media_desc">Adjuntos del chat, descargas, privacidad y caché</string>
|
||||
<string name="settings_bridge_safety">seguridad Bridge</string>
|
||||
<string name="settings_bridge_safety_desc">Lista de bloqueo, confirmación de verbo destructivo, desactivación automática</string>
|
||||
<string name="settings_sideload">Carga lateral</string>
|
||||
@@ -1119,8 +1119,8 @@
|
||||
<string name="about_credits">Axiom Labs ❤️ Agente Hermes · Nous Research</string>
|
||||
<string name="media_title">Medios de comunicación</string>
|
||||
<string name="media_back">Atrás</string>
|
||||
<string name="media_intro_1">Controla cómo la aplicación maneja los archivos enviados por los resultados de la herramienta (capturas de pantalla, PDF, etc.) a través del relay.</string>
|
||||
<string name="media_intro_2">Solo Relay: esta configuración no afecta a las imágenes que adjunte en el chat ni a nada en una conexión estándar (no-Relay).</string>
|
||||
<string name="media_intro_1">Controla cómo la aplicación descarga, protege y almacena en caché los archivos que Hermes envía en el chat.</string>
|
||||
<string name="media_intro_2">Se priorizan los archivos multimedia del Dashboard estándar. Cuando está emparejado, Relay puede añadir entrega de compatibilidad y metadatos de confidencialidad.</string>
|
||||
<string name="media_max_inbound">Tamaño máximo del archivo adjunto entrante</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">Los archivos de mayor tamaño se rechazan después de la descarga.</string>
|
||||
@@ -1989,7 +1989,8 @@
|
||||
<string name="session_path_signin_for_gateway">Inicie sesión en Administrar para el gateway que piensa en vivo.</string>
|
||||
<string name="session_path_gateway_api_server">Disponible en el transporte gateway: esta sesión se transmite a través del servidor API.</string>
|
||||
<string name="session_path_relay_not_connected">Relay emparejado pero no conectado.</string>
|
||||
<string name="session_path_pair_relay_media">Empareje el relay para enviar y recibir medios.</string>
|
||||
<string name="session_path_pair_relay_media">Empareja Relay para obtener compatibilidad multimedia en hosts Hermes antiguos.</string>
|
||||
<string name="session_path_media_not_ready">Actualiza Hermes para la entrega multimedia estándar o empareja Relay por compatibilidad.</string>
|
||||
<string name="session_path_pair_relay_terminal">Empareje el relay para acceder al terminal.</string>
|
||||
<string name="session_path_voice_not_ready">La voz no está lista en esta conexión.</string>
|
||||
<string name="session_path_threads_pair_relay">Empareje el relay y active "Dejar que Hermes me envíe un mensaje" para que el agente pueda abrir Threads.</string>
|
||||
@@ -2556,6 +2557,8 @@
|
||||
<string name="inbound_attach_downloading">Descargando…%1$s</string>
|
||||
<string name="inbound_attach_failed">Error al adjuntar</string>
|
||||
<string name="inbound_attach_tap_retry">Toca para volver a intentarlo</string>
|
||||
<string name="inbound_attach_host_only">El archivo está en tu host de Hermes</string>
|
||||
<string name="inbound_attach_host_only_help">Actualiza Hermes para las descargas estándar o empareja Relay por compatibilidad.</string>
|
||||
<string name="inbound_attach_open">Abierto externamente</string>
|
||||
<string name="inbound_attach_share">Compartir</string>
|
||||
<string name="inbound_attach_save">Guardar en dispositivo</string>
|
||||
@@ -2983,6 +2986,8 @@
|
||||
<string name="diag_check_ready_with">Listo con %s</string>
|
||||
<string name="diag_check_relay_active">Relay activo</string>
|
||||
<string name="diag_check_relay_not_configured">Relay no configurado</string>
|
||||
<string name="diag_relay_tools_optional">Herramientas de Relay (opcionales)</string>
|
||||
<string name="diag_relay_tools_not_paired">Sin emparejar</string>
|
||||
<string name="diag_check_relay_server">Verifique el servidor relay</string>
|
||||
<string name="diag_check_relay_plugin">Plugin de Relay</string>
|
||||
<string name="diag_plugin_not_configured">El plugin opcional no está configurado</string>
|
||||
@@ -3012,8 +3017,8 @@
|
||||
<string name="inbound_attach_cd_cancel">Cancelar</string>
|
||||
<string name="inbound_attach_open_failed">No se pudo abrir el archivo adjunto</string>
|
||||
<string name="inbound_attach_share_failed">No se pudo compartir el archivo adjunto</string>
|
||||
<string name="injected_context_media_no_relay">Los medios requieren una conexión Relay activa</string>
|
||||
<string name="injected_context_media_relay_active">Relay activo para medios</string>
|
||||
<string name="injected_context_media_no_relay">Sin instrucciones multimedia adicionales: la entrega estándar sigue a cargo del servidor</string>
|
||||
<string name="injected_context_media_relay_active">Mejora multimedia de Relay disponible</string>
|
||||
<string name="injected_context_media_title">Compartir medios</string>
|
||||
<string name="injected_context_persona_not_set">No se ha definido ninguna persona</string>
|
||||
<string name="injected_context_persona_server_side">Persona del lado del servidor</string>
|
||||
@@ -4180,7 +4185,7 @@
|
||||
<string name="chat_git_deletions">%1$d eliminaciones</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="one">%1$d cambio</item><item quantity="other">%1$d cambios</item></plurals>
|
||||
<string name="settings_git_workspace">Espacio de Git</string>
|
||||
<string name="settings_git_workspace_desc">Revisa cambios, ramas, commits y remotos</string>
|
||||
<string name="settings_git_workspace_desc">Primero el Git de la sesión actual, con detección opcional del host</string>
|
||||
<string name="current_chat_activity_title">Actividad actual del chat</string>
|
||||
<string name="current_chat_activity_subtitle">Detalles en vivo de solo lectura de este chat</string>
|
||||
<string name="current_chat_activity_open">Ver la actividad actual del chat</string>
|
||||
@@ -4215,7 +4220,7 @@
|
||||
<string name="agent_activity_child_role_task">Tarea</string>
|
||||
<string name="agent_activity_child_role_agent">Agente</string>
|
||||
<string name="agent_activity_child_role_system">Sistema</string>
|
||||
<string name="settings_git_workspace_off_desc">Desactivado · El análisis de repositorios del host es opcional</string>
|
||||
<string name="settings_git_workspace_off_desc">Solo el repositorio de la sesión · La detección del host es opcional</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -707,8 +707,8 @@
|
||||
<string name="settings_voice_mode">ボイスモード</string>
|
||||
<string name="settings_voice_mode_desc">ダッシュボード音声、リアルタイムRelayオプション、プロバイダー</string>
|
||||
<string name="settings_threads">Threads</string>
|
||||
<string name="settings_threads_desc">エージェントがあなたと会話を開始できるようにします (デフォルトではオフ)</string>
|
||||
<string name="settings_power_tools">パワーツール</string>
|
||||
<string name="settings_threads_desc">Relay が開始する会話とプロアクティブ配信(デフォルトではオフ)</string>
|
||||
<string name="settings_power_tools">Relay ツール</string>
|
||||
<string name="settings_terminal">ターミナル</string>
|
||||
<string name="settings_terminal_desc">ペアリングされたRelayセッションを介したサーバーシェルアクセス</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -720,7 +720,7 @@
|
||||
<string name="settings_notification_companion">通知コンパニオン</string>
|
||||
<string name="settings_notification_companion_desc">ペアリングされたRelayツールの共有電話通知</string>
|
||||
<string name="settings_media">メディア</string>
|
||||
<string name="settings_media_desc">Relay 受信添付ファイル、自動取得、キャッシュキャップ</string>
|
||||
<string name="settings_media_desc">チャットの添付ファイル、ダウンロード動作、プライバシー、キャッシュ</string>
|
||||
<string name="settings_bridge_safety">Bridge 安全性</string>
|
||||
<string name="settings_bridge_safety_desc">ブロックリスト、破壊的な動詞の確認、自動無効化</string>
|
||||
<string name="settings_sideload">サイドロード</string>
|
||||
@@ -1228,8 +1228,8 @@
|
||||
<!-- P1: MediaSettingsScreen -->
|
||||
<string name="media_title">メディア</string>
|
||||
<string name="media_back">戻る</string>
|
||||
<string name="media_intro_1">ツールの結果 (スクリーンショット、PDF など) によってRelay経由で送信されたファイルをアプリが処理する方法を制御します。</string>
|
||||
<string name="media_intro_2">Relay のみ — これらの設定は、チャットに添付した画像や標準 (Relay なし) 接続上のものには影響しません。</string>
|
||||
<string name="media_intro_1">Hermes がチャットで送信したファイルのダウンロード、保護、キャッシュ方法を設定します。</string>
|
||||
<string name="media_intro_2">標準の Dashboard メディアが優先されます。Relay をペアリングすると、互換配信と機密性メタデータを追加できます。</string>
|
||||
<string name="media_max_inbound">受信添付ファイルの最大サイズ</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">これより大きいファイルはダウンロード後に拒否されます。</string>
|
||||
@@ -2182,7 +2182,8 @@
|
||||
<string name="session_path_signin_for_gateway">Live Thinking Gateway の [管理] でサインインします。</string>
|
||||
<string name="session_path_gateway_api_server">Gateway トランスポートで利用可能 — このセッションは API サーバー経由でストリーミングされます。</string>
|
||||
<string name="session_path_relay_not_connected">Relay はペアリングされていますが、接続されていません。</string>
|
||||
<string name="session_path_pair_relay_media">Relayをペアリングしてメディアを送受信します。</string>
|
||||
<string name="session_path_pair_relay_media">古い Hermes ホストとのメディア互換性のために Relay をペアリングしてください。</string>
|
||||
<string name="session_path_media_not_ready">標準メディア配信には Hermes を更新するか、互換性のために Relay をペアリングしてください。</string>
|
||||
<string name="session_path_pair_relay_terminal">ターミナルアクセス用にRelayをペアリングします。</string>
|
||||
<string name="session_path_voice_not_ready">この接続では音声の準備ができていません。</string>
|
||||
<string name="session_path_threads_pair_relay">Relayをペアリングし、「Hermes にメッセージを送信する」をオンにすると、エージェントが Threads を開けるようになります。</string>
|
||||
@@ -2805,6 +2806,8 @@
|
||||
<string name="inbound_attach_downloading">ダウンロード中…%1$s</string>
|
||||
<string name="inbound_attach_failed">添付に失敗しました</string>
|
||||
<string name="inbound_attach_tap_retry">タップして再試行してください</string>
|
||||
<string name="inbound_attach_host_only">ファイルは Hermes ホスト上にあります</string>
|
||||
<string name="inbound_attach_host_only_help">標準ダウンロードには Hermes を更新するか、互換性のために Relay をペアリングしてください。</string>
|
||||
<string name="inbound_attach_open">外部に開く</string>
|
||||
<string name="inbound_attach_share">共有</string>
|
||||
<string name="inbound_attach_save">デバイスに保存</string>
|
||||
@@ -3326,6 +3329,8 @@
|
||||
<string name="diag_check_ready_with">%s で準備完了</string>
|
||||
<string name="diag_check_relay_active">Relay アクティブ</string>
|
||||
<string name="diag_check_relay_not_configured">Relay が構成されていません</string>
|
||||
<string name="diag_relay_tools_optional">Relay ツール(オプション)</string>
|
||||
<string name="diag_relay_tools_not_paired">未ペアリング</string>
|
||||
<string name="diag_check_relay_server">中継サーバーを確認する</string>
|
||||
<string name="diag_check_relay_plugin">Relay プラグイン</string>
|
||||
<string name="diag_plugin_not_configured">オプションのプラグインが設定されていません</string>
|
||||
@@ -3355,8 +3360,8 @@
|
||||
<string name="inbound_attach_cd_cancel">キャンセル</string>
|
||||
<string name="inbound_attach_open_failed">添付ファイルを開けませんでした</string>
|
||||
<string name="inbound_attach_share_failed">添付ファイルを共有できませんでした</string>
|
||||
<string name="injected_context_media_no_relay">メディアにはアクティブな Relay 接続が必要です</string>
|
||||
<string name="injected_context_media_relay_active">Relay はメディア向けにアクティブです</string>
|
||||
<string name="injected_context_media_no_relay">追加のメディア指示なし — 標準配信は引き続きサーバーが担当します</string>
|
||||
<string name="injected_context_media_relay_active">Relay メディア拡張を利用できます</string>
|
||||
<string name="injected_context_media_title">メディア共有</string>
|
||||
<string name="injected_context_persona_not_set">ペルソナ設定なし</string>
|
||||
<string name="injected_context_persona_server_side">サーバー側のペルソナ</string>
|
||||
@@ -4484,7 +4489,7 @@
|
||||
<string name="chat_git_deletions">%1$d 件の削除</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="other">%1$d 件の変更</item></plurals>
|
||||
<string name="settings_git_workspace">Git ワークスペース</string>
|
||||
<string name="settings_git_workspace_desc">変更、ブランチ、コミット、リモートを確認</string>
|
||||
<string name="settings_git_workspace_desc">現在のセッションの Git を優先し、必要に応じてホストを検出</string>
|
||||
<string name="current_chat_activity_title">現在のチャットのアクティビティ</string>
|
||||
<string name="current_chat_activity_subtitle">このチャットからの読み取り専用ライブ詳細</string>
|
||||
<string name="current_chat_activity_open">現在のチャットのアクティビティを表示</string>
|
||||
@@ -4519,7 +4524,7 @@
|
||||
<string name="agent_activity_child_role_task">タスク</string>
|
||||
<string name="agent_activity_child_role_agent">エージェント</string>
|
||||
<string name="agent_activity_child_role_system">システム</string>
|
||||
<string name="settings_git_workspace_off_desc">オフ · ホストのリポジトリスキャンはオプトインです</string>
|
||||
<string name="settings_git_workspace_off_desc">セッションのリポジトリのみ · ホスト検出はオプトインです</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -686,8 +686,8 @@
|
||||
<string name="settings_voice_mode">Режим голоса</string>
|
||||
<string name="settings_voice_mode_desc">Голос панели управления, опции Relay в реальном времени, поставщики</string>
|
||||
<string name="settings_threads">Потоки</string>
|
||||
<string name="settings_threads_desc">Позволяет агенту начинать разговоры с вами (по умолчанию выключено)</string>
|
||||
<string name="settings_power_tools">Мощные инструменты</string>
|
||||
<string name="settings_threads_desc">Разговоры, начатые Relay, и проактивная доставка (по умолчанию выключено)</string>
|
||||
<string name="settings_power_tools">Инструменты Relay</string>
|
||||
<string name="settings_terminal">Терминал</string>
|
||||
<string name="settings_terminal_desc">Доступ к оболочке сервера через сопряженный сеанс Relay</string>
|
||||
<string name="settings_bridge">Мост</string>
|
||||
@@ -699,7 +699,7 @@
|
||||
<string name="settings_notification_companion">Сопровождение уведомлений</string>
|
||||
<string name="settings_notification_companion_desc">Общие уведомления телефона для сопряженных инструментов Relay</string>
|
||||
<string name="settings_media">Медиа</string>
|
||||
<string name="settings_media_desc">Передача входящих вложений, автозагрузка, кэш</string>
|
||||
<string name="settings_media_desc">Вложения чата, загрузка, конфиденциальность и кэш</string>
|
||||
<string name="settings_bridge_safety">Безопасность моста</string>
|
||||
<string name="settings_bridge_safety_desc">Черный список, подтверждение деструктивных действий, автоотключение</string>
|
||||
<string name="settings_sideload">Установка из APK</string>
|
||||
@@ -1233,8 +1233,8 @@
|
||||
<string name="about_credits">Axiom Labs ❤️ Агент Гермес · Nous Research</string>
|
||||
<string name="media_title">Медиа</string>
|
||||
<string name="media_back">Назад</string>
|
||||
<string name="media_intro_1">Управляет тем, как приложение обрабатывает файлы, отправленные результатами инструментов (скриншоты, PDF и т. д.) через Relay.</string>
|
||||
<string name="media_intro_2">Только Relay — эти настройки не влияют на изображения, которые вы прикрепляете в чате, или что-либо на стандартном (без Relay) соединении.</string>
|
||||
<string name="media_intro_1">Определяет, как приложение скачивает, защищает и кэширует файлы, отправленные Hermes в чате.</string>
|
||||
<string name="media_intro_2">Предпочтение отдаётся стандартным медиа Dashboard. После сопряжения Relay может добавить совместимую доставку и метаданные конфиденциальности.</string>
|
||||
<string name="media_max_inbound">Максимальный размер входящего вложения</string>
|
||||
<string name="media_max_inbound_value">%1$d МБ</string>
|
||||
<string name="media_max_inbound_desc">Файлы, превышающие этот размер, отклоняются после загрузки.</string>
|
||||
@@ -2185,7 +2185,8 @@
|
||||
<string name="session_path_signin_for_gateway">Войдите в систему под управлением для шлюза живого мышления.</string>
|
||||
<string name="session_path_gateway_api_server">Доступно на транспортном шлюзе — этот сеанс передается через сервер API.</string>
|
||||
<string name="session_path_relay_not_connected">Relay сопряжён, но не подключен.</string>
|
||||
<string name="session_path_pair_relay_media">Сопрягите Relay для отправки и получения медиа.</string>
|
||||
<string name="session_path_pair_relay_media">Сопрягите Relay для совместимости медиа со старыми хостами Hermes.</string>
|
||||
<string name="session_path_media_not_ready">Обновите Hermes для стандартной доставки медиа или сопрягите Relay для совместимости.</string>
|
||||
<string name="session_path_pair_relay_terminal">Сопрягите Relay для доступа к терминалу.</string>
|
||||
<string name="session_path_voice_not_ready">Голос не готов на этом подключении.</string>
|
||||
<string name="session_path_threads_pair_relay">Сопрягите Relay и включите "Позволить Гермесу отправлять мне сообщения", чтобы агент мог открывать потоки.</string>
|
||||
@@ -2782,6 +2783,8 @@
|
||||
<string name="inbound_attach_downloading">Скачивание\&#8230;%1$s</string>
|
||||
<string name="inbound_attach_failed">Ошибка вложения</string>
|
||||
<string name="inbound_attach_tap_retry">Нажмите для повторной попытки</string>
|
||||
<string name="inbound_attach_host_only">Файл находится на вашем хосте Hermes</string>
|
||||
<string name="inbound_attach_host_only_help">Обновите Hermes для стандартных загрузок или сопрягите Relay для совместимости.</string>
|
||||
<string name="inbound_attach_open">Открыть внешне</string>
|
||||
<string name="inbound_attach_share">Поделиться</string>
|
||||
<string name="inbound_attach_save">Сохранить на устройство</string>
|
||||
@@ -3187,6 +3190,8 @@
|
||||
<string name="diag_check_ready_with">Готово с %s</string>
|
||||
<string name="diag_check_relay_active">Relay активен</string>
|
||||
<string name="diag_check_relay_not_configured">Relay не настроен</string>
|
||||
<string name="diag_relay_tools_optional">Инструменты Relay (необязательно)</string>
|
||||
<string name="diag_relay_tools_not_paired">Не сопряжено</string>
|
||||
<string name="diag_check_relay_server">Проверить сервер Relay</string>
|
||||
<string name="diag_check_relay_plugin">Плагин Relay</string>
|
||||
<string name="diag_plugin_not_configured">Дополнительный плагин не настроен</string>
|
||||
@@ -3218,8 +3223,8 @@
|
||||
<string name="inbound_attach_cd_cancel">Отмена</string>
|
||||
<string name="inbound_attach_open_failed">Не удалось открыть вложение</string>
|
||||
<string name="inbound_attach_share_failed">Не удалось поделиться вложением</string>
|
||||
<string name="injected_context_media_no_relay">Для мультимедиа требуется активное подключение Relay</string>
|
||||
<string name="injected_context_media_relay_active">плагин Relay активен для мультимедиа</string>
|
||||
<string name="injected_context_media_no_relay">Нет дополнительных инструкций для медиа — стандартная доставка остаётся на стороне сервера</string>
|
||||
<string name="injected_context_media_relay_active">Доступно расширение Relay для медиа</string>
|
||||
<string name="injected_context_media_title">Обмен мультимедиа</string>
|
||||
<string name="injected_context_persona_not_set">Персона не установлена</string>
|
||||
<string name="injected_context_persona_server_side">Персона на стороне сервера</string>
|
||||
@@ -4228,7 +4233,7 @@
|
||||
<string name="chat_git_deletions">Удалено строк: %1$d</string>
|
||||
<plurals name="chat_git_change_count"><item quantity="one">%1$d изменение</item><item quantity="few">%1$d изменения</item><item quantity="many">%1$d изменений</item><item quantity="other">%1$d изменения</item></plurals>
|
||||
<string name="settings_git_workspace">Рабочая область Git</string>
|
||||
<string name="settings_git_workspace_desc">Изменения, ветки, коммиты и удалённые репозитории</string>
|
||||
<string name="settings_git_workspace_desc">Сначала Git текущего сеанса, с дополнительным обнаружением на хосте</string>
|
||||
<string name="current_chat_activity_title">Текущая активность чата</string>
|
||||
<string name="current_chat_activity_subtitle">Доступные только для чтения сведения в реальном времени из этого чата</string>
|
||||
<string name="current_chat_activity_open">Просмотреть текущую активность чата</string>
|
||||
@@ -4263,7 +4268,7 @@
|
||||
<string name="agent_activity_child_role_task">Задача</string>
|
||||
<string name="agent_activity_child_role_agent">Агент</string>
|
||||
<string name="agent_activity_child_role_system">Система</string>
|
||||
<string name="settings_git_workspace_off_desc">Выкл. · Сканирование репозиториев на хосте включается вручную</string>
|
||||
<string name="settings_git_workspace_off_desc">Только репозиторий сеанса · Обнаружение на хосте включается вручную</string>
|
||||
<string name="active_section_available_fallback">Available fallback</string>
|
||||
<string name="active_section_available_fallback_mechanism">Available fallback · %1$s</string>
|
||||
<string name="active_section_in_use">In use</string>
|
||||
|
||||
@@ -755,8 +755,8 @@
|
||||
<string name="settings_voice_mode">Voice mode</string>
|
||||
<string name="settings_voice_mode_desc">Dashboard voice, realtime relay options, providers</string>
|
||||
<string name="settings_threads">Threads</string>
|
||||
<string name="settings_threads_desc">Let the agent start conversations with you (off by default)</string>
|
||||
<string name="settings_power_tools">Power tools</string>
|
||||
<string name="settings_threads_desc">Relay-started conversations and proactive delivery (off by default)</string>
|
||||
<string name="settings_power_tools">Relay tools</string>
|
||||
<string name="settings_terminal">Terminal</string>
|
||||
<string name="settings_terminal_desc">Server shell access through a paired relay session</string>
|
||||
<string name="settings_bridge">Bridge</string>
|
||||
@@ -768,7 +768,7 @@
|
||||
<string name="settings_notification_companion">Notification companion</string>
|
||||
<string name="settings_notification_companion_desc">Shared phone notifications for paired relay tools</string>
|
||||
<string name="settings_media">Media</string>
|
||||
<string name="settings_media_desc">Relay inbound attachments, auto-fetch, cache cap</string>
|
||||
<string name="settings_media_desc">Chat attachments, download behavior, privacy, and cache</string>
|
||||
<string name="settings_bridge_safety">Bridge safety</string>
|
||||
<string name="settings_bridge_safety_desc">Blocklist, destructive-verb confirmation, auto-disable</string>
|
||||
<string name="settings_sideload">Sideload</string>
|
||||
@@ -1383,8 +1383,8 @@
|
||||
<!-- P1: MediaSettingsScreen -->
|
||||
<string name="media_title">Media</string>
|
||||
<string name="media_back">Back</string>
|
||||
<string name="media_intro_1">Controls how the app handles files sent by tool results (screenshots, PDFs, etc.) over the relay.</string>
|
||||
<string name="media_intro_2">Relay only — these settings don\'t affect images you attach in chat or anything on a standard (no-Relay) connection.</string>
|
||||
<string name="media_intro_1">Controls how the app downloads, protects, and caches files Hermes sends in chat.</string>
|
||||
<string name="media_intro_2">Standard Dashboard media is preferred. When paired, Relay can add compatibility delivery and sensitivity metadata.</string>
|
||||
<string name="media_max_inbound">Max inbound attachment size</string>
|
||||
<string name="media_max_inbound_value">%1$d MB</string>
|
||||
<string name="media_max_inbound_desc">Files larger than this are rejected after download.</string>
|
||||
@@ -2513,7 +2513,8 @@
|
||||
<string name="session_path_signin_for_gateway">Sign in under Manage for the live-thinking gateway.</string>
|
||||
<string name="session_path_gateway_api_server">Available on the gateway transport — this session streams over the API server.</string>
|
||||
<string name="session_path_relay_not_connected">Relay paired but not connected.</string>
|
||||
<string name="session_path_pair_relay_media">Pair the relay to send and receive media.</string>
|
||||
<string name="session_path_pair_relay_media">Pair Relay for media compatibility on older Hermes hosts.</string>
|
||||
<string name="session_path_media_not_ready">Update Hermes for standard media delivery, or pair Relay for compatibility.</string>
|
||||
<string name="session_path_pair_relay_terminal">Pair the relay for terminal access.</string>
|
||||
<string name="session_path_voice_not_ready">Voice not ready on this connection.</string>
|
||||
<string name="session_path_threads_pair_relay">Pair the relay and turn on "Let Hermes message me" so the agent can open Threads.</string>
|
||||
@@ -3161,6 +3162,8 @@
|
||||
<string name="inbound_attach_downloading">Downloading…%1$s</string>
|
||||
<string name="inbound_attach_failed">Attachment failed</string>
|
||||
<string name="inbound_attach_tap_retry">Tap to retry</string>
|
||||
<string name="inbound_attach_host_only">File is on your Hermes host</string>
|
||||
<string name="inbound_attach_host_only_help">Update Hermes for standard downloads, or pair Relay for compatibility.</string>
|
||||
<string name="inbound_attach_open">Open externally</string>
|
||||
<string name="inbound_attach_share">Share</string>
|
||||
<string name="inbound_attach_save">Save to device</string>
|
||||
@@ -3689,6 +3692,8 @@
|
||||
<string name="diag_check_ready_with">Ready with %s</string>
|
||||
<string name="diag_check_relay_active">Relay active</string>
|
||||
<string name="diag_check_relay_not_configured">Relay not configured</string>
|
||||
<string name="diag_relay_tools_optional">Relay tools (optional)</string>
|
||||
<string name="diag_relay_tools_not_paired">Not paired</string>
|
||||
<string name="diag_check_relay_server">Check relay server</string>
|
||||
<string name="diag_check_relay_plugin">Relay plugin</string>
|
||||
<string name="diag_plugin_not_configured">Optional plugin is not configured</string>
|
||||
@@ -3720,8 +3725,8 @@
|
||||
<string name="inbound_attach_cd_cancel">Cancel</string>
|
||||
<string name="inbound_attach_open_failed">Couldn\u0027t open attachment</string>
|
||||
<string name="inbound_attach_share_failed">Couldn\u0027t share attachment</string>
|
||||
<string name="injected_context_media_no_relay">Media requires an active Relay connection</string>
|
||||
<string name="injected_context_media_relay_active">Relay active for media</string>
|
||||
<string name="injected_context_media_no_relay">No extra media instruction — standard delivery stays server-owned</string>
|
||||
<string name="injected_context_media_relay_active">Relay media enhancement available</string>
|
||||
<string name="injected_context_media_title">Media sharing</string>
|
||||
<string name="injected_context_persona_not_set">No persona set</string>
|
||||
<string name="injected_context_persona_server_side">Server-side persona</string>
|
||||
@@ -4586,6 +4591,6 @@
|
||||
<string name="provider_usage_capability_basic_title">Basic usage from Hermes</string>
|
||||
<string name="provider_usage_capability_basic_body">Install or update the Relay plugin for credential pools, structured Nous balances, and OpenCode Go.</string>
|
||||
<string name="settings_git_workspace">Git workspace</string>
|
||||
<string name="settings_git_workspace_desc">Review changes, branches, commits, and remotes</string>
|
||||
<string name="settings_git_workspace_off_desc">Off · Host repository scanning is opt-in</string>
|
||||
<string name="settings_git_workspace_desc">Current-session Git first, with optional host discovery</string>
|
||||
<string name="settings_git_workspace_off_desc">Session repository only · Host discovery is opt-in</string>
|
||||
</resources>
|
||||
|
||||
@@ -97,6 +97,70 @@ class VoicePreferencesRepositoryTest {
|
||||
repository.setStopPhrases(emptyList())
|
||||
assertTrue(repository.settings.first().stopPhrases.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayRemoval_normalizesOnlyRelayOwnedSelectionsInExpectedScope() = runTest {
|
||||
repository.setActiveScope("connection-a", "coder")
|
||||
repository.setEngineMode(VoiceEngineMode.RealtimeAgent)
|
||||
repository.setAudioRoute(VoiceAudioRoute.Relay)
|
||||
val scope = repository.activeScope.value
|
||||
|
||||
assertTrue(repository.reconcileRelayRemoval(scope))
|
||||
|
||||
val settings = repository.settings.first()
|
||||
assertEquals(VoiceEngineMode.HermesVoiceOutput.storageValue, settings.engineMode)
|
||||
assertEquals(VoiceAudioRoute.Auto.storageValue, settings.audioRoute)
|
||||
assertFalse(repository.reconcileRelayRemoval(scope))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayRemoval_doesNotMutateAProfileThatNoLongerOwnsTheScope() = runTest {
|
||||
repository.setActiveScope("connection-a", "coder")
|
||||
repository.setEngineMode(VoiceEngineMode.RealtimeAgent)
|
||||
repository.setAudioRoute(VoiceAudioRoute.Relay)
|
||||
val staleScope = repository.activeScope.value
|
||||
|
||||
repository.setActiveScope("connection-a", "writer")
|
||||
assertFalse(repository.reconcileRelayRemoval(staleScope))
|
||||
|
||||
repository.setActiveScope("connection-a", "coder")
|
||||
val settings = repository.settings.first()
|
||||
assertEquals(VoiceEngineMode.RealtimeAgent.storageValue, settings.engineMode)
|
||||
assertEquals(VoiceAudioRoute.Relay.storageValue, settings.audioRoute)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayRemoval_doesNotRewriteGlobalDefaultSelectionSharedByAnotherConnection() = runTest {
|
||||
repository.setActiveScope("connection-a", null)
|
||||
repository.setEngineMode(VoiceEngineMode.RealtimeAgent)
|
||||
repository.setAudioRoute(VoiceAudioRoute.Relay)
|
||||
|
||||
assertFalse(repository.reconcileRelayRemoval(repository.activeScope.value))
|
||||
|
||||
repository.setActiveScope("connection-b", null)
|
||||
val settings = repository.settings.first()
|
||||
assertEquals(VoiceEngineMode.RealtimeAgent.storageValue, settings.engineMode)
|
||||
assertEquals(VoiceAudioRoute.Relay.storageValue, settings.audioRoute)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayRemoval_normalizesNamedProfileWithoutChangingSameProfileOnAnotherConnection() = runTest {
|
||||
repository.setActiveScope("connection-a", "coder")
|
||||
repository.setEngineMode(VoiceEngineMode.RealtimeAgent)
|
||||
repository.setAudioRoute(VoiceAudioRoute.Relay)
|
||||
|
||||
repository.setActiveScope("connection-b", "coder")
|
||||
repository.setEngineMode(VoiceEngineMode.RealtimeAgent)
|
||||
repository.setAudioRoute(VoiceAudioRoute.Relay)
|
||||
|
||||
repository.setActiveScope("connection-a", "coder")
|
||||
assertTrue(repository.reconcileRelayRemoval(repository.activeScope.value))
|
||||
|
||||
repository.setActiveScope("connection-b", "coder")
|
||||
val settings = repository.settings.first()
|
||||
assertEquals(VoiceEngineMode.RealtimeAgent.storageValue, settings.engineMode)
|
||||
assertEquals(VoiceAudioRoute.Relay.storageValue, settings.audioRoute)
|
||||
}
|
||||
}
|
||||
|
||||
private class InMemoryVoicePreferencesDataStore : DataStore<Preferences> {
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.hermesandroid.relay.network.relay
|
||||
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.mockwebserver.MockResponse
|
||||
import okhttp3.mockwebserver.MockWebServer
|
||||
import org.junit.After
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class RelayHttpClientMediaDownloadTest {
|
||||
private lateinit var server: MockWebServer
|
||||
|
||||
@Before
|
||||
fun setUp() {
|
||||
server = MockWebServer().apply { start() }
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
server.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fetchMediaByPathStopsChunkedResponseAtCallerLimit() = runTest {
|
||||
server.enqueue(
|
||||
MockResponse()
|
||||
.setHeader("Content-Type", "application/octet-stream")
|
||||
.setChunkedBody("x".repeat(64), 8),
|
||||
)
|
||||
val client = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
relayUrlProvider = {
|
||||
server.url("/").toString().replaceFirst("http://", "ws://").trimEnd('/')
|
||||
},
|
||||
sessionTokenProvider = { "paired-session" },
|
||||
)
|
||||
|
||||
val result = client.fetchMediaByPath("/tmp/large.bin", maxBytes = 16)
|
||||
|
||||
assertTrue(result.isFailure)
|
||||
assertTrue(result.exceptionOrNull()?.message.orEmpty().contains("download limit"))
|
||||
assertEquals("/media/by-path", server.takeRequest().requestUrl?.encodedPath)
|
||||
}
|
||||
}
|
||||
@@ -1530,6 +1530,42 @@ class ChatHandlerTest {
|
||||
assertTrue(handler.messages.value.single().attachments.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun loadMessageHistory_carriesHydratedMarkerAttachmentWithoutReloading() {
|
||||
var requestCount = 0
|
||||
val path = "/tmp/voice-note.mp3"
|
||||
handler.onMediaBarePathRequested = { messageId, requestedPath ->
|
||||
requestCount++
|
||||
handler.mutateMessage(messageId) { message ->
|
||||
message.copy(
|
||||
attachments = message.attachments + Attachment(
|
||||
contentType = "audio/mpeg",
|
||||
content = "",
|
||||
fileName = "voice-note.mp3",
|
||||
relayToken = requestedPath,
|
||||
cachedUri = "content://media/voice-note.mp3",
|
||||
state = AttachmentState.LOADED,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
val history = listOf(
|
||||
MessageItem(
|
||||
id = "assistant-media",
|
||||
role = "assistant",
|
||||
content = JsonPrimitive("Voice note\nMEDIA:$path"),
|
||||
),
|
||||
)
|
||||
|
||||
handler.loadMessageHistory(history)
|
||||
handler.loadMessageHistory(history)
|
||||
|
||||
val attachment = handler.messages.value.single().attachments.single()
|
||||
assertEquals(1, requestCount)
|
||||
assertEquals(AttachmentState.LOADED, attachment.state)
|
||||
assertEquals("content://media/voice-note.mp3", attachment.cachedUri)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun loadMessageHistory_preservesCompletedGeneratedImageUntilMarkerPersists() {
|
||||
handler.addPlaceholderMessage(
|
||||
|
||||
@@ -2032,6 +2032,80 @@ class DashboardApiClientTest {
|
||||
assertEquals("/api/messaging/whatsapp/onboarding/pair-1/apply", apply.requestUrl!!.encodedPath)
|
||||
assertTrue(apply.body.readUtf8().contains(""""profile":"worker""""))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun downloadManagedFile_usesUpstreamPathRouteAndPreservesMetadata() = runTest {
|
||||
server.enqueue(
|
||||
MockResponse()
|
||||
.setHeader("Content-Type", "audio/mpeg")
|
||||
.setHeader("Content-Disposition", "attachment; filename*=UTF-8''voice%20reply.mp3")
|
||||
.setBody("audio-bytes"),
|
||||
)
|
||||
|
||||
val output = ByteArrayOutputStream()
|
||||
val fetched = DashboardApiClient(baseUrl = server.url("/").toString())
|
||||
.downloadManagedFile("/tmp/Hermes audio/voice reply.mp3", 1024, output)
|
||||
.getOrThrow()
|
||||
|
||||
assertEquals("audio/mpeg", fetched.contentType)
|
||||
assertEquals("voice reply.mp3", fetched.fileName)
|
||||
assertEquals(11L, fetched.sizeBytes)
|
||||
assertEquals("audio-bytes", output.toString(Charsets.UTF_8.name()))
|
||||
val request = server.takeRequest()
|
||||
assertEquals("/api/files/download", request.requestUrl!!.encodedPath)
|
||||
assertEquals("/tmp/Hermes audio/voice reply.mp3", request.requestUrl!!.queryParameter("path"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun downloadManagedFile_rejectsDeclaredLengthAboveCallerCap() = runTest {
|
||||
server.enqueue(MockResponse().setHeader("Content-Length", 2048))
|
||||
|
||||
val result = DashboardApiClient(baseUrl = server.url("/").toString())
|
||||
.downloadManagedFile("/tmp/large.bin", 1024, ByteArrayOutputStream())
|
||||
|
||||
assertTrue(result.isFailure)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun downloadManagedFile_rejectsChunkedBodyAfterStreamingCap() = runTest {
|
||||
server.enqueue(
|
||||
MockResponse()
|
||||
.setHeader("Content-Type", "application/octet-stream")
|
||||
.setChunkedBody("seventeen-byte-doc", 3),
|
||||
)
|
||||
val output = ByteArrayOutputStream()
|
||||
|
||||
val result = DashboardApiClient(baseUrl = server.url("/").toString())
|
||||
.downloadManagedFile("/tmp/growing.bin", 16, output)
|
||||
|
||||
assertTrue(result.isFailure)
|
||||
assertTrue(result.exceptionOrNull()?.message.orEmpty().contains("configured download limit"))
|
||||
assertTrue(output.size() <= 16)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun managedFileFallbackClassificationDistinguishesMissingRouteFromMissingFile() {
|
||||
assertTrue(
|
||||
DashboardHttpException(
|
||||
404,
|
||||
"Dashboard media download failed - HTTP 404: {\"detail\":\"Not Found\"}",
|
||||
).isDashboardManagedFilesUnsupported(),
|
||||
)
|
||||
assertFalse(
|
||||
DashboardHttpException(
|
||||
404,
|
||||
"Dashboard media download failed - HTTP 404: {\"detail\":\"File not found\"}",
|
||||
).isDashboardManagedFilesUnsupported(),
|
||||
)
|
||||
assertFalse(
|
||||
DashboardHttpException(403, "Access to sensitive files is not allowed")
|
||||
.isDashboardManagedFilesUnsupported(),
|
||||
)
|
||||
assertFalse(
|
||||
DashboardHttpException(500, "Managed file read failed")
|
||||
.isDashboardManagedFilesUnsupported(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun messagePageResponse(
|
||||
|
||||
@@ -133,6 +133,9 @@ class GatewayClientHarness(
|
||||
@Volatile
|
||||
var createdSessionProfileName: String? = null
|
||||
|
||||
@Volatile
|
||||
var createdSessionLazy = false
|
||||
|
||||
/** Config keys rejected with the older-gateway unknown-key response. */
|
||||
val unsupportedConfigKeys: MutableSet<String> = ConcurrentHashMap.newKeySet()
|
||||
|
||||
@@ -227,6 +230,13 @@ class GatewayClientHarness(
|
||||
@Volatile
|
||||
var profileGetAssetPayload: JsonObject = buildJsonObject { put("found", false) }
|
||||
|
||||
@Volatile
|
||||
var usageBarsPayload: JsonObject = buildJsonObject {
|
||||
put("ok", true)
|
||||
put("available", true)
|
||||
put("plan_name", "Pro")
|
||||
}
|
||||
|
||||
/** Methods answered with JSON-RPC -32601 — exercises the legacy-name fallback. */
|
||||
val methodNotFound: MutableSet<String> = ConcurrentHashMap.newKeySet()
|
||||
|
||||
@@ -322,6 +332,7 @@ class GatewayClientHarness(
|
||||
?: (params["profile"] as? JsonPrimitive)?.contentOrNull
|
||||
?: "default",
|
||||
)
|
||||
if (createdSessionLazy) put("lazy", true)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -436,6 +447,7 @@ class GatewayClientHarness(
|
||||
"profiles.list" -> profilesListPayload
|
||||
"profiles.create" -> profileCreatePayload
|
||||
"profiles.get_asset" -> profileGetAssetPayload
|
||||
"usage.bars" -> usageBarsPayload
|
||||
"profiles.set_asset" -> buildJsonObject {
|
||||
put("ok", true)
|
||||
put("asset", "avatar")
|
||||
@@ -760,6 +772,7 @@ class GatewayChatClientTest {
|
||||
val thinkingDeltas = ConcurrentLinkedQueue<String>()
|
||||
val sessionIds = ConcurrentLinkedQueue<String>()
|
||||
val errors = ConcurrentLinkedQueue<String>()
|
||||
val submitRejections = ConcurrentLinkedQueue<String>()
|
||||
val resumeFailures = ConcurrentLinkedQueue<String>()
|
||||
val interactions = ConcurrentLinkedQueue<GatewayAsk>()
|
||||
val interactionExpiries = ConcurrentLinkedQueue<GatewayAskExpiry>()
|
||||
@@ -772,6 +785,7 @@ class GatewayChatClientTest {
|
||||
val moaReferences = ConcurrentLinkedQueue<GatewayMoaReference>()
|
||||
val usages = ConcurrentLinkedQueue<UsageInfo>()
|
||||
val reconcileRequests = AtomicInteger(0)
|
||||
val completions = AtomicInteger(0)
|
||||
val completeLatch = CountDownLatch(1)
|
||||
val preflightFailures = ConcurrentLinkedQueue<String>()
|
||||
|
||||
@@ -785,7 +799,7 @@ class GatewayChatClientTest {
|
||||
onToolCallFailed = { _, _ -> },
|
||||
onTurnComplete = { },
|
||||
onReconcileRequired = { reconcileRequests.incrementAndGet() },
|
||||
onComplete = { completeLatch.countDown() },
|
||||
onComplete = { completions.incrementAndGet(); completeLatch.countDown() },
|
||||
onUsage = { it?.let(usages::add) },
|
||||
onError = { errors += it; completeLatch.countDown() },
|
||||
onToolGenerating = { toolGenerating += it ?: "" },
|
||||
@@ -796,6 +810,7 @@ class GatewayChatClientTest {
|
||||
onResumeFailure = { resumeFailures += it; completeLatch.countDown() },
|
||||
onStatusUpdate = { _, _ -> },
|
||||
onStatusClear = { },
|
||||
onSubmitRejected = { submitRejections += it; completeLatch.countDown() },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -803,6 +818,7 @@ class GatewayChatClientTest {
|
||||
rpcTimeoutMs: Long = 15_000L,
|
||||
promptSubmitTimeoutMs: Long = 1_800_000L,
|
||||
turnIdleTimeoutMs: Long = 180_000L,
|
||||
sessionReadyTimeoutMs: Long = 300_000L,
|
||||
compactingTimeoutMs: Long = 600_000L,
|
||||
callbackDispatcher: (block: () -> Unit) -> Unit = { it() },
|
||||
ticketTimeoutMs: Long = 8_000L,
|
||||
@@ -825,6 +841,7 @@ class GatewayChatClientTest {
|
||||
rpcTimeoutMs = rpcTimeoutMs,
|
||||
promptSubmitTimeoutMs = promptSubmitTimeoutMs,
|
||||
turnIdleTimeoutMs = turnIdleTimeoutMs,
|
||||
sessionReadyTimeoutMs = sessionReadyTimeoutMs,
|
||||
compactingTimeoutMs = compactingTimeoutMs,
|
||||
)
|
||||
|
||||
@@ -839,6 +856,21 @@ class GatewayChatClientTest {
|
||||
assertTrue("condition did not settle within ${timeoutMs}ms", condition())
|
||||
}
|
||||
|
||||
private fun exactActiveSessionPayload(
|
||||
status: String,
|
||||
liveSessionId: String = "live-1",
|
||||
storedSessionId: String = "20260612_120000_abc123",
|
||||
): JsonObject = buildJsonObject {
|
||||
put("sessions", buildJsonArray {
|
||||
add(buildJsonObject {
|
||||
put("id", liveSessionId)
|
||||
put("session_key", storedSessionId)
|
||||
put("status", status)
|
||||
put("last_active", 1_777_000_000.0)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap in a client with shortened timeout seams. Mints a FRESH scope:
|
||||
* shutdown() cancels the scope's Job, and the replacement client must
|
||||
@@ -848,6 +880,7 @@ class GatewayChatClientTest {
|
||||
rpcTimeoutMs: Long = 15_000L,
|
||||
promptSubmitTimeoutMs: Long = 1_800_000L,
|
||||
turnIdleTimeoutMs: Long = 180_000L,
|
||||
sessionReadyTimeoutMs: Long = 300_000L,
|
||||
compactingTimeoutMs: Long = 600_000L,
|
||||
ticketTimeoutMs: Long = 8_000L,
|
||||
) {
|
||||
@@ -857,6 +890,7 @@ class GatewayChatClientTest {
|
||||
rpcTimeoutMs = rpcTimeoutMs,
|
||||
promptSubmitTimeoutMs = promptSubmitTimeoutMs,
|
||||
turnIdleTimeoutMs = turnIdleTimeoutMs,
|
||||
sessionReadyTimeoutMs = sessionReadyTimeoutMs,
|
||||
compactingTimeoutMs = compactingTimeoutMs,
|
||||
ticketTimeoutMs = ticketTimeoutMs,
|
||||
)
|
||||
@@ -888,6 +922,21 @@ class GatewayChatClientTest {
|
||||
harness.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `provider usage calls official upstream usage bars method`() = runBlocking {
|
||||
harness.usageBarsPayload = buildJsonObject {
|
||||
put("ok", true)
|
||||
put("available", true)
|
||||
put("plan_name", "Pro")
|
||||
}
|
||||
|
||||
val response = client.usageBars().getOrThrow()
|
||||
|
||||
assertEquals("Pro", (response["plan_name"] as? JsonPrimitive)?.contentOrNull)
|
||||
assertEquals("usage.bars", harness.rpcLog.last().first)
|
||||
assertTrue(harness.rpcLog.none { it.first == "account.usage" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `profile editor describes exact profile and maps upstream shape`() = runBlocking {
|
||||
val description = client.describeProfile("operator").getOrThrow()
|
||||
@@ -3449,6 +3498,42 @@ class GatewayChatClientTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `session info exposes exact model callable tool catalog`() {
|
||||
val recorder = Recorder()
|
||||
client.sendTurn("stored-1", "hi", null, recorder.callbacks) {
|
||||
recorder.preflightFailures += it
|
||||
}
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
harness.awaitRpc("session.resume")
|
||||
harness.awaitRpc("prompt.submit")
|
||||
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"session.info",
|
||||
buildJsonObject {
|
||||
put("tools", buildJsonObject {
|
||||
put("android", buildJsonArray {
|
||||
add(JsonPrimitive("android_phone_status"))
|
||||
add(JsonPrimitive("android_tap"))
|
||||
})
|
||||
put("terminal", buildJsonArray { add(JsonPrimitive("terminal")) })
|
||||
})
|
||||
},
|
||||
"live-resumed",
|
||||
),
|
||||
)
|
||||
|
||||
waitUntil { client.serverTools.value?.size == 3 }
|
||||
assertEquals(
|
||||
setOf("android_phone_status", "android_tap", "terminal"),
|
||||
client.serverTools.value,
|
||||
)
|
||||
|
||||
client.clearSession()
|
||||
assertNull(client.serverTools.value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `session info without provider clears prior session identity`() {
|
||||
val recorder = Recorder()
|
||||
@@ -3869,6 +3954,42 @@ class GatewayChatClientTest {
|
||||
assertEquals(true, (submit["queued"] as? JsonPrimitive)?.booleanOrNull)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `lazy fresh session waits for authoritative ready edge before submit`() {
|
||||
harness.createdSessionLazy = true
|
||||
val r = Recorder()
|
||||
|
||||
client.sendTurn(null, "hello", null, r.callbacks) { r.preflightFailures += it }
|
||||
harness.awaitRpc("session.create")
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
Thread.sleep(100)
|
||||
assertEquals(0, harness.rpcLog.count { it.first == "prompt.submit" })
|
||||
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"session.info",
|
||||
buildJsonObject { put("lazy", false) },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
|
||||
harness.awaitRpc("prompt.submit")
|
||||
assertTrue(r.preflightFailures.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `lazy fresh session readiness timeout never submits`() {
|
||||
rebuildClient(sessionReadyTimeoutMs = 50L)
|
||||
harness.createdSessionLazy = true
|
||||
val r = Recorder()
|
||||
|
||||
client.sendTurn(null, "hello", null, r.callbacks) { r.preflightFailures += it }
|
||||
harness.awaitRpc("session.create")
|
||||
|
||||
waitUntil { r.preflightFailures.isNotEmpty() }
|
||||
assertEquals(0, harness.rpcLog.count { it.first == "prompt.submit" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `authoritative prompt rejections surface server message without preflight fallback`() {
|
||||
val cases = listOf(
|
||||
@@ -3889,8 +4010,9 @@ class GatewayChatClientTest {
|
||||
client.sendTurn(null, "hello-$code", null, r.callbacks) { r.preflightFailures += it }
|
||||
harness.awaitRpc("prompt.submit")
|
||||
|
||||
waitUntil { r.errors.isNotEmpty() }
|
||||
assertEquals(listOf(message), r.errors.toList())
|
||||
waitUntil { r.submitRejections.isNotEmpty() }
|
||||
assertEquals(listOf(message), r.submitRejections.toList())
|
||||
assertTrue(r.errors.isEmpty())
|
||||
assertTrue("$code must not trigger SSE fallback", r.preflightFailures.isEmpty())
|
||||
assertEquals(index + 1, harness.rpcLog.count { it.first == "prompt.submit" })
|
||||
}
|
||||
@@ -4714,6 +4836,180 @@ class GatewayChatClientTest {
|
||||
assertTrue(harness.ticketMints.get() >= 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `active session idle settles exact Android turn without interrupt`() = runBlocking {
|
||||
val recorder = Recorder()
|
||||
client.sendTurn(null, "finish without terminal", null, recorder.callbacks) {
|
||||
recorder.preflightFailures += it
|
||||
}
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
harness.awaitRpc("prompt.submit")
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-1"))
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.delta",
|
||||
buildJsonObject { put("text", "durable partial") },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
awaitCondition { recorder.textDeltas.isNotEmpty() }
|
||||
harness.activeSessionListPayload = exactActiveSessionPayload("idle")
|
||||
|
||||
assertTrue(client.listActiveSessions() is GatewayActiveSessionsResult.Success)
|
||||
assertTrue("idle snapshot did not settle turn", recorder.completeLatch.await(5, TimeUnit.SECONDS))
|
||||
assertEquals(1, recorder.completions.get())
|
||||
assertEquals(1, recorder.reconcileRequests.get())
|
||||
assertTrue(recorder.errors.isEmpty())
|
||||
assertTrue(harness.rpcLog.none { it.first == "session.interrupt" })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `active session idle never settles passively observed turn`() = runBlocking {
|
||||
val recorder = Recorder()
|
||||
client.setUnsolicitedTurnProvider {
|
||||
GatewayInboundTurnRegistration(recorder.callbacks) { true }
|
||||
}
|
||||
assertTrue(client.prewarmAwait("stored-session"))
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-resumed"))
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.delta",
|
||||
buildJsonObject { put("text", "desktop-owned") },
|
||||
"live-resumed",
|
||||
),
|
||||
)
|
||||
awaitCondition { recorder.textDeltas.isNotEmpty() }
|
||||
harness.activeSessionListPayload = exactActiveSessionPayload(
|
||||
status = "idle",
|
||||
liveSessionId = "live-resumed",
|
||||
storedSessionId = "stored-session",
|
||||
)
|
||||
|
||||
client.listActiveSessions()
|
||||
assertFalse(recorder.completeLatch.await(250, TimeUnit.MILLISECONDS))
|
||||
assertTrue(harness.rpcLog.none { it.first == "session.interrupt" })
|
||||
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.complete",
|
||||
buildJsonObject { put("text", "desktop-owned") },
|
||||
"live-resumed",
|
||||
),
|
||||
)
|
||||
assertTrue(recorder.completeLatch.await(5, TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `stale active session snapshot cannot settle newer turn generation`() = runBlocking {
|
||||
val first = Recorder()
|
||||
client.sendTurn(null, "first", null, first.callbacks) { first.preflightFailures += it }
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
harness.awaitRpc("prompt.submit")
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-1"))
|
||||
serverWs.send(
|
||||
harness.eventFrame("message.delta", buildJsonObject { put("text", "first") }, "live-1"),
|
||||
)
|
||||
awaitCondition { first.textDeltas.isNotEmpty() }
|
||||
|
||||
harness.suppressAckMethods += "session.active_list"
|
||||
val staleSnapshot = scope.async { client.listActiveSessions() }
|
||||
val staleAck = harness.awaitPendingAck()
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.complete",
|
||||
buildJsonObject { put("text", "first") },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
assertTrue(first.completeLatch.await(5, TimeUnit.SECONDS))
|
||||
|
||||
val second = Recorder()
|
||||
client.sendTurn(
|
||||
"20260612_120000_abc123",
|
||||
"second",
|
||||
null,
|
||||
second.callbacks,
|
||||
) { second.preflightFailures += it }
|
||||
harness.awaitRpcCount("prompt.submit", 2)
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-1"))
|
||||
serverWs.send(
|
||||
harness.eventFrame("message.delta", buildJsonObject { put("text", "second") }, "live-1"),
|
||||
)
|
||||
awaitCondition { second.textDeltas.isNotEmpty() }
|
||||
|
||||
harness.releaseAck(staleAck, exactActiveSessionPayload("idle"))
|
||||
assertTrue(staleSnapshot.await() is GatewayActiveSessionsResult.Success)
|
||||
assertFalse(second.completeLatch.await(250, TimeUnit.MILLISECONDS))
|
||||
assertEquals(0, second.reconcileRequests.get())
|
||||
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.complete",
|
||||
buildJsonObject { put("text", "second") },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
assertTrue(second.completeLatch.await(5, TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `cancellation wins over delayed active session idle snapshot`() = runBlocking {
|
||||
val recorder = Recorder()
|
||||
val handle = client.sendTurn(null, "cancel me", null, recorder.callbacks) {
|
||||
recorder.preflightFailures += it
|
||||
}
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
harness.awaitRpc("prompt.submit")
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-1"))
|
||||
serverWs.send(
|
||||
harness.eventFrame("message.delta", buildJsonObject { put("text", "partial") }, "live-1"),
|
||||
)
|
||||
awaitCondition { recorder.textDeltas.isNotEmpty() }
|
||||
|
||||
harness.suppressAckMethods += "session.active_list"
|
||||
val delayedSnapshot = scope.async { client.listActiveSessions() }
|
||||
val delayedAck = harness.awaitPendingAck()
|
||||
handle.cancel()
|
||||
harness.awaitRpc("session.interrupt")
|
||||
harness.releaseAck(delayedAck, exactActiveSessionPayload("idle"))
|
||||
|
||||
assertTrue(delayedSnapshot.await() is GatewayActiveSessionsResult.Success)
|
||||
assertEquals(0, recorder.completions.get())
|
||||
assertEquals(0, recorder.reconcileRequests.get())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `late terminal after active session settle is consumed once`() = runBlocking {
|
||||
val recorder = Recorder()
|
||||
val unmatched = ConcurrentLinkedQueue<GatewayBackgroundTurnCompletion>()
|
||||
client.setUnmatchedTurnCompleteListener(unmatched::add)
|
||||
client.sendTurn(null, "late terminal", null, recorder.callbacks) {
|
||||
recorder.preflightFailures += it
|
||||
}
|
||||
val serverWs = harness.awaitServerSocket()
|
||||
harness.awaitRpc("prompt.submit")
|
||||
serverWs.send(harness.eventFrame("message.start", null, "live-1"))
|
||||
serverWs.send(
|
||||
harness.eventFrame("message.delta", buildJsonObject { put("text", "done") }, "live-1"),
|
||||
)
|
||||
awaitCondition { recorder.textDeltas.isNotEmpty() }
|
||||
harness.activeSessionListPayload = exactActiveSessionPayload("idle")
|
||||
client.listActiveSessions()
|
||||
assertTrue(recorder.completeLatch.await(5, TimeUnit.SECONDS))
|
||||
|
||||
serverWs.send(
|
||||
harness.eventFrame(
|
||||
"message.complete",
|
||||
buildJsonObject { put("text", "done") },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
Thread.sleep(150)
|
||||
assertEquals(1, recorder.completions.get())
|
||||
assertTrue(unmatched.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `idle watchdog does not fire while events keep arriving slowly`() {
|
||||
rebuildClient(turnIdleTimeoutMs = 1_000L)
|
||||
|
||||
@@ -34,6 +34,8 @@ class GatewayEventMapperTest {
|
||||
val failures = mutableListOf<GatewayTurnFailure>()
|
||||
val statusUpdates = mutableListOf<Pair<String?, String>>()
|
||||
val statusClears = mutableListOf<String>()
|
||||
val notices = mutableListOf<GatewayAgentNotice>()
|
||||
val noticeClears = mutableListOf<String>()
|
||||
val sessionIds = mutableListOf<String>()
|
||||
var starts = 0
|
||||
var turnCompletes = 0
|
||||
@@ -42,6 +44,7 @@ class GatewayEventMapperTest {
|
||||
var usage: UsageInfo? = null
|
||||
var usageCalls = 0
|
||||
val errors = mutableListOf<String>()
|
||||
val submitRejections = mutableListOf<String>()
|
||||
|
||||
val callbacks = GatewayTurnCallbacks(
|
||||
onSessionId = { sessionIds += it },
|
||||
@@ -70,6 +73,9 @@ class GatewayEventMapperTest {
|
||||
onFailure = { failures += it },
|
||||
onStatusUpdate = { kind, text -> statusUpdates += kind to text },
|
||||
onStatusClear = { statusClears += it },
|
||||
onNoticeShow = { notices += it },
|
||||
onNoticeClear = { noticeClears += it },
|
||||
onSubmitRejected = { submitRejections += it },
|
||||
)
|
||||
}
|
||||
|
||||
@@ -123,6 +129,45 @@ class GatewayEventMapperTest {
|
||||
assertTrue(r.statusUpdates.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `official notice show and clear preserve exact keyed contract`() {
|
||||
val r = Recorder()
|
||||
val mapper = mapperWith(r)
|
||||
|
||||
mapper.onEvent(
|
||||
"notification.show",
|
||||
obj(
|
||||
"""{"text":"⚠ Credits depleted","level":"warn","kind":"sticky","ttl_ms":null,"key":"credits.depleted","id":"notice-1"}""",
|
||||
),
|
||||
)
|
||||
mapper.onEvent("notification.clear", obj("""{"key":"credits.depleted"}"""))
|
||||
|
||||
assertEquals(
|
||||
GatewayAgentNotice(
|
||||
text = "⚠ Credits depleted",
|
||||
level = "warn",
|
||||
kind = "sticky",
|
||||
ttlMs = null,
|
||||
key = "credits.depleted",
|
||||
id = "notice-1",
|
||||
),
|
||||
r.notices.single(),
|
||||
)
|
||||
assertEquals(listOf("credits.depleted"), r.noticeClears)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `malformed official notices remain forward compatible no ops`() {
|
||||
val r = Recorder()
|
||||
val mapper = mapperWith(r)
|
||||
|
||||
mapper.onEvent("notification.show", obj("""{"level":"info"}"""))
|
||||
mapper.onEvent("notification.clear", obj("""{"key":" "}"""))
|
||||
|
||||
assertTrue(r.notices.isEmpty())
|
||||
assertTrue(r.noticeClears.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `compaction status clears on resumed model tool and MoA activity only`() {
|
||||
listOf(
|
||||
@@ -440,10 +485,31 @@ class GatewayEventMapperTest {
|
||||
val mapper = mapperWith(r)
|
||||
mapper.onEvent("error", obj("""{"message":"model exploded"}"""))
|
||||
assertEquals(listOf("model exploded"), r.errors)
|
||||
assertTrue(r.submitRejections.isEmpty())
|
||||
assertTrue(mapper.turnEnded)
|
||||
assertEquals(0, r.completes)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `session ownership error is an authoritative submit rejection`() {
|
||||
val r = Recorder()
|
||||
val mapper = mapperWith(r)
|
||||
val message =
|
||||
"Session fresh-1 already has a live owner (webui, pid 42, running 0m). " +
|
||||
"Only one surface at a time may run a session, because a second one would reason from stale history."
|
||||
|
||||
mapper.onEvent(
|
||||
"error",
|
||||
obj(
|
||||
"""{"message":"Session fresh-1 already has a live owner (webui, pid 42, running 0m). Only one surface at a time may run a session, because a second one would reason from stale history."}""",
|
||||
),
|
||||
)
|
||||
|
||||
assertEquals(listOf(message), r.submitRejections)
|
||||
assertTrue(r.errors.isEmpty())
|
||||
assertTrue(mapper.turnEnded)
|
||||
}
|
||||
|
||||
// --- Tools ---
|
||||
|
||||
@Test
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.hermesandroid.relay.network.usage
|
||||
|
||||
import kotlinx.serialization.json.buildJsonObject
|
||||
import kotlinx.serialization.json.put
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class ProviderUsageRepositoryTest {
|
||||
@Test
|
||||
fun mapsOfficialUpstreamUsageBars() {
|
||||
val response = providerUsageFromUpstreamBars(buildJsonObject {
|
||||
put("ok", true)
|
||||
put("available", true)
|
||||
put("plan_name", "Pro")
|
||||
put("renews_at", "2026-09-15T00:00:00Z")
|
||||
put("subscription_remaining_display", "\$12.50")
|
||||
put("topup_remaining_display", "\$3.00")
|
||||
put("total_spendable_display", "\$15.50")
|
||||
put("plan_bar", buildJsonObject {
|
||||
put("remaining_display", "\$12.50")
|
||||
put("total_display", "\$20.00")
|
||||
put("pct_used", 37.5)
|
||||
})
|
||||
put("topup_bar", buildJsonObject {
|
||||
put("remaining_display", "\$3.00")
|
||||
put("total_display", "\$5.00")
|
||||
put("pct_used", 40.0)
|
||||
})
|
||||
})!!
|
||||
|
||||
val nous = response.providers.single()
|
||||
assertEquals("nous", nous.id)
|
||||
assertEquals("upstream:usage.bars", nous.source)
|
||||
assertEquals("Pro", nous.plan)
|
||||
assertEquals("2026-09-15T00:00:00Z", nous.renewsAt)
|
||||
assertEquals(37.5, nous.windows.first().usedPercent!!, 0.001)
|
||||
assertEquals("\$12.50 remaining of \$20.00", nous.windows.first().detail)
|
||||
assertEquals(3, nous.details.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun unavailableUpstreamUsageIsCapabilityAbsence() {
|
||||
assertNull(providerUsageFromUpstreamBars(buildJsonObject {
|
||||
put("ok", true)
|
||||
put("available", false)
|
||||
}))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayEnhancementAddsProvidersAndEnrichesNous() {
|
||||
val upstream = ProviderUsageResponse(
|
||||
providers = listOf(
|
||||
ProviderUsageProvider(
|
||||
id = "nous",
|
||||
displayName = "Nous",
|
||||
status = ProviderUsageProvider.STATUS_AVAILABLE,
|
||||
source = "upstream:usage.bars",
|
||||
plan = "Pro",
|
||||
windows = listOf(ProviderUsageWindow("plan", "Plan", usedPercent = 25.0)),
|
||||
details = listOf("Total spendable: \$10.00"),
|
||||
),
|
||||
),
|
||||
)
|
||||
val enhanced = ProviderUsageResponse(
|
||||
schemaVersion = 2,
|
||||
capabilities = ProviderUsageResponse.RELAY_ENHANCED_CAPABILITIES,
|
||||
providers = listOf(
|
||||
ProviderUsageProvider(
|
||||
id = "nous",
|
||||
displayName = "Nous",
|
||||
status = ProviderUsageProvider.STATUS_AVAILABLE,
|
||||
source = "relay",
|
||||
balances = listOf(ProviderUsageBalance("total", "Total usable", 10.0)),
|
||||
),
|
||||
ProviderUsageProvider(
|
||||
id = "openai-codex",
|
||||
displayName = "Codex",
|
||||
status = ProviderUsageProvider.STATUS_AVAILABLE,
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val merged = mergeProviderUsage(upstream, enhanced)!!
|
||||
|
||||
assertTrue(merged.relayEnhanced)
|
||||
assertEquals(listOf("nous", "openai-codex"), merged.providers.map { it.id })
|
||||
val nous = merged.providers.first()
|
||||
assertEquals("Pro", nous.plan)
|
||||
assertEquals(25.0, nous.windows.single().usedPercent!!, 0.001)
|
||||
assertEquals(10.0, nous.balances.single().amount, 0.001)
|
||||
assertEquals(listOf("Total spendable: \$10.00"), nous.details)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun unavailableEnhancementDoesNotReplaceAvailableUpstream() {
|
||||
val upstreamProvider = ProviderUsageProvider(
|
||||
id = "nous",
|
||||
displayName = "Nous",
|
||||
status = ProviderUsageProvider.STATUS_AVAILABLE,
|
||||
source = "upstream:usage.bars",
|
||||
)
|
||||
val merged = mergeProviderUsage(
|
||||
ProviderUsageResponse(providers = listOf(upstreamProvider)),
|
||||
ProviderUsageResponse(providers = listOf(
|
||||
upstreamProvider.copy(
|
||||
status = ProviderUsageProvider.STATUS_UNAVAILABLE,
|
||||
source = "relay",
|
||||
),
|
||||
)),
|
||||
)!!
|
||||
|
||||
assertEquals("upstream:usage.bars", merged.providers.single().source)
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ class HermesRuntimeReadinessTest {
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = false,
|
||||
relayConfigured = false,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
@@ -32,6 +33,7 @@ class HermesRuntimeReadinessTest {
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.SignInRequired,
|
||||
relayReady = true,
|
||||
relayConfigured = true,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
@@ -45,6 +47,7 @@ class HermesRuntimeReadinessTest {
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = true,
|
||||
relayConfigured = true,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
@@ -61,6 +64,7 @@ class HermesRuntimeReadinessTest {
|
||||
chatReady = false,
|
||||
standardAvailability = StandardVoiceAvailability.Unknown,
|
||||
relayReady = true,
|
||||
relayConfigured = true,
|
||||
profileSettled = false,
|
||||
)
|
||||
val ready = resolveVoiceActivationReadiness(
|
||||
@@ -68,6 +72,7 @@ class HermesRuntimeReadinessTest {
|
||||
chatReady = false,
|
||||
standardAvailability = StandardVoiceAvailability.Unknown,
|
||||
relayReady = true,
|
||||
relayConfigured = true,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
@@ -77,4 +82,62 @@ class HermesRuntimeReadinessTest {
|
||||
ready,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun relayOnlySelections_fallBackToStandardWhenRelayWasRemoved() {
|
||||
val realtime = resolveVoiceActivationReadiness(
|
||||
settings = VoiceSettings(engineMode = VoiceEngineMode.RealtimeAgent.storageValue),
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = false,
|
||||
relayConfigured = false,
|
||||
profileSettled = true,
|
||||
)
|
||||
val relayAudio = resolveVoiceActivationReadiness(
|
||||
settings = VoiceSettings(audioRoute = VoiceAudioRoute.Relay.storageValue),
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = false,
|
||||
relayConfigured = false,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
HermesVoiceActivationReadiness.Ready(HermesVoiceActivationRoute.Standard),
|
||||
realtime,
|
||||
)
|
||||
assertEquals(
|
||||
HermesVoiceActivationReadiness.Ready(HermesVoiceActivationRoute.Standard),
|
||||
relayAudio,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun configuredRelayOutage_preservesRelayOnlySelections() {
|
||||
val realtime = resolveVoiceActivationReadiness(
|
||||
settings = VoiceSettings(engineMode = VoiceEngineMode.RealtimeAgent.storageValue),
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = false,
|
||||
relayConfigured = true,
|
||||
profileSettled = true,
|
||||
)
|
||||
val relayAudio = resolveVoiceActivationReadiness(
|
||||
settings = VoiceSettings(audioRoute = VoiceAudioRoute.Relay.storageValue),
|
||||
chatReady = true,
|
||||
standardAvailability = StandardVoiceAvailability.Ready,
|
||||
relayReady = false,
|
||||
relayConfigured = true,
|
||||
profileSettled = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
HermesVoiceActivationReadiness.Waiting("Waiting for the Relay realtime route"),
|
||||
realtime,
|
||||
)
|
||||
assertEquals(
|
||||
HermesVoiceActivationReadiness.Waiting("Waiting for Relay voice"),
|
||||
relayAudio,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import androidx.compose.ui.test.onNodeWithText
|
||||
import androidx.compose.ui.test.onRoot
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.github.takahirom.roborazzi.captureRoboImage
|
||||
import com.hermesandroid.relay.ui.components.ChangelogStore
|
||||
import com.hermesandroid.relay.ui.components.ChangelogVersion
|
||||
import com.hermesandroid.relay.ui.screens.ChangelogScreen
|
||||
import com.hermesandroid.relay.ui.theme.HermesRelayTheme
|
||||
import org.junit.Rule
|
||||
@@ -20,15 +22,19 @@ class ChangelogHistoryScreenshotTest {
|
||||
@get:Rule val compose = createComposeRule()
|
||||
|
||||
@Test fun latestReleaseShowsHighlightsAndCompleteDetails() {
|
||||
lateinit var latest: ChangelogVersion
|
||||
compose.setContent {
|
||||
latest = ChangelogStore.load(androidx.compose.ui.platform.LocalContext.current).versions.first()
|
||||
HermesRelayTheme(appThemeId = "hermes-relay", themePreference = "dark") {
|
||||
ChangelogScreen(onClose = {})
|
||||
}
|
||||
}
|
||||
compose.onNodeWithText("v1.14.0 — Connections, delegated work, Git, and voice").assertExists()
|
||||
compose.onNodeWithText("v${latest.version} — ${requireNotNull(latest.title)}").assertExists()
|
||||
compose.onNodeWithText("Highlights").assertExists()
|
||||
compose.onNodeWithText("Fixed").assertExists()
|
||||
compose.onNodeWithText("Wake-word detection starts reliably").assertExists()
|
||||
latest.remainingChangesOfKind("fixed").firstOrNull()?.let { fixed ->
|
||||
compose.onNodeWithText("Fixed").assertExists()
|
||||
compose.onNodeWithText(fixed.title).assertExists()
|
||||
}
|
||||
compose.onNodeWithText("Compatibility").assertExists()
|
||||
compose.onNodeWithText("Installed").assertExists()
|
||||
compose.onRoot().captureRoboImage("build/ui-regression/changelog-history.png")
|
||||
|
||||
@@ -96,6 +96,40 @@ class GitWorkspaceScreenshotTest {
|
||||
compose.onRoot().captureRoboImage("build/store-shots/15_git_workspace.png")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun standardSessionWorkspaceRendersWithRelayDiscoveryOff() {
|
||||
enqueue("""{"branch":"main","changed":1,"staged":0,"unstaged":1,"untracked":0,"added":3,"removed":1,"files":[{"path":"app.kt","unstaged":true}]}""")
|
||||
enqueue("""{"branch":"main","changed":1,"staged":0,"unstaged":1,"untracked":0,"added":3,"removed":1,"files":[{"path":"app.kt","unstaged":true}]}""")
|
||||
enqueue("""{"files":[{"path":"app.kt","added":3,"removed":1,"staged":false}]}""")
|
||||
enqueue("""{"branches":[{"name":"main","checkedOut":true}]}""")
|
||||
val app = ApplicationProvider.getApplicationContext<Application>()
|
||||
val viewModel = GitStateViewModel(app)
|
||||
viewModel.configure(
|
||||
DashboardApiClient(server.url("/").toString()),
|
||||
"standard-owner",
|
||||
scanningEnabled = false,
|
||||
)
|
||||
viewModel.setSessionWorkspace("/srv/projects/standard", null)
|
||||
|
||||
compose.setContent {
|
||||
HermesRelayTheme(appThemeId = "hermes-relay", themePreference = "dark") {
|
||||
GitStateScreen(
|
||||
viewModel = viewModel,
|
||||
onScanningEnabledChange = {},
|
||||
onBack = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compose.waitUntil(5_000) {
|
||||
runCatching { compose.onNodeWithText("1 changes").assertExists() }.isSuccess
|
||||
}
|
||||
val paths = buildList {
|
||||
repeat(4) { add(server.takeRequest().path.orEmpty()) }
|
||||
}
|
||||
org.junit.Assert.assertTrue(paths.none { it.contains("/api/plugins/") })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun chatRailMatchesApprovedCompactTreatment() {
|
||||
compose.setContent {
|
||||
|
||||
@@ -21,6 +21,7 @@ import androidx.compose.ui.unit.dp
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.github.takahirom.roborazzi.captureRoboImage
|
||||
import com.hermesandroid.relay.ui.components.ChangelogStore
|
||||
import com.hermesandroid.relay.ui.components.ChangelogVersion
|
||||
import com.hermesandroid.relay.ui.components.WhatsNewToast
|
||||
import com.hermesandroid.relay.ui.components.WhatsNewToastContent
|
||||
import com.hermesandroid.relay.ui.theme.HermesRelayTheme
|
||||
@@ -38,10 +39,12 @@ class WhatsNewToastScreenshotTest {
|
||||
@get:Rule val compose = createComposeRule()
|
||||
|
||||
@Test fun compactNoticeRemainsClearAtLargeText() {
|
||||
lateinit var latest: ChangelogVersion
|
||||
compose.setContent {
|
||||
val context = LocalContext.current
|
||||
val density = LocalDensity.current
|
||||
val entry = ChangelogStore.load(context).versions.first()
|
||||
latest = entry
|
||||
CompositionLocalProvider(LocalDensity provides Density(density.density, 1.35f)) {
|
||||
HermesRelayTheme(appThemeId = "hermes-relay", themePreference = "dark") {
|
||||
Box(
|
||||
@@ -61,12 +64,12 @@ class WhatsNewToastScreenshotTest {
|
||||
}
|
||||
}
|
||||
}
|
||||
compose.onNodeWithText("Connections, delegated work, Git, and voice").assertExists()
|
||||
compose.onNodeWithText("Also: 2 improvements · 10 fixes").assertExists()
|
||||
compose.onNodeWithText(
|
||||
"Release notes stay out of your way, Chat uses one consistent presentation…",
|
||||
).assertExists()
|
||||
compose.onNodeWithText("View all").assertExists()
|
||||
compose.onNodeWithText(requireNotNull(latest.title)).assertExists()
|
||||
latest.visibleDigest()?.let { digest ->
|
||||
compose.onNodeWithText("Also: ${digest.countText()}").assertExists()
|
||||
compose.onNodeWithText(digest.preview.joinToString(", ") + "…").assertExists()
|
||||
compose.onNodeWithText("View all").assertExists()
|
||||
}
|
||||
compose.onNodeWithContentDescription("Close").assertExists()
|
||||
compose.onRoot().captureRoboImage("build/ui-regression/whats-new-toast-large-text.png")
|
||||
}
|
||||
@@ -74,8 +77,10 @@ class WhatsNewToastScreenshotTest {
|
||||
@Test fun exposesExpandAndCloseActions() {
|
||||
var expanded = false
|
||||
var dismissed = false
|
||||
lateinit var latest: ChangelogVersion
|
||||
compose.setContent {
|
||||
val entry = ChangelogStore.load(LocalContext.current).versions.first()
|
||||
latest = entry
|
||||
HermesRelayTheme(appThemeId = "hermes-relay", themePreference = "dark") {
|
||||
WhatsNewToastContent(
|
||||
entry = entry,
|
||||
@@ -86,9 +91,12 @@ class WhatsNewToastScreenshotTest {
|
||||
}
|
||||
}
|
||||
|
||||
compose.onNodeWithText("Connections, delegated work, Git, and voice").performClick()
|
||||
expanded = false
|
||||
compose.onNodeWithText("View all").performClick()
|
||||
compose.onNodeWithText(requireNotNull(latest.title)).performClick()
|
||||
assertTrue(expanded)
|
||||
latest.visibleDigest()?.let {
|
||||
expanded = false
|
||||
compose.onNodeWithText("View all").performClick()
|
||||
}
|
||||
compose.onNodeWithContentDescription("Close").performClick()
|
||||
|
||||
assertTrue(expanded)
|
||||
@@ -97,8 +105,10 @@ class WhatsNewToastScreenshotTest {
|
||||
|
||||
@Test fun horizontalSwipeDismissesTheNotice() {
|
||||
var dismissed = false
|
||||
lateinit var latest: ChangelogVersion
|
||||
compose.mainClock.autoAdvance = false
|
||||
compose.setContent {
|
||||
latest = ChangelogStore.load(LocalContext.current).versions.first()
|
||||
HermesRelayTheme(appThemeId = "hermes-relay", themePreference = "dark") {
|
||||
WhatsNewToast(
|
||||
onDismiss = { dismissed = true },
|
||||
@@ -108,10 +118,29 @@ class WhatsNewToastScreenshotTest {
|
||||
}
|
||||
}
|
||||
compose.mainClock.advanceTimeBy(300L)
|
||||
compose.onNodeWithText("Connections, delegated work, Git, and voice")
|
||||
compose.onNodeWithText(requireNotNull(latest.title))
|
||||
.performTouchInput { swipeLeft(durationMillis = 300L) }
|
||||
compose.mainClock.advanceTimeBy(300L)
|
||||
|
||||
assertTrue(dismissed)
|
||||
}
|
||||
|
||||
private fun com.hermesandroid.relay.ui.components.ChangelogToastDigest.countText(): String =
|
||||
buildList {
|
||||
if (additionalFeatureCount > 0) {
|
||||
add("$additionalFeatureCount additional ${if (additionalFeatureCount == 1) "feature" else "features"}")
|
||||
}
|
||||
if (improvementCount > 0) {
|
||||
add("$improvementCount ${if (improvementCount == 1) "improvement" else "improvements"}")
|
||||
}
|
||||
if (fixCount > 0) {
|
||||
add("$fixCount ${if (fixCount == 1) "fix" else "fixes"}")
|
||||
}
|
||||
}.joinToString(" · ")
|
||||
|
||||
private fun ChangelogVersion.visibleDigest():
|
||||
com.hermesandroid.relay.ui.components.ChangelogToastDigest? =
|
||||
resolvedToastDigest()?.takeIf {
|
||||
it.additionalFeatureCount > 0 || it.improvementCount > 0 || it.fixCount > 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.hermesandroid.relay.ui
|
||||
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class ChatResponsiveLayoutTest {
|
||||
@Test
|
||||
fun compactPhonesKeepExistingUnboundedLayout() {
|
||||
val layout = chatResponsiveLayout(screenWidthDp = 599)
|
||||
|
||||
assertNull(layout.introMaxWidth)
|
||||
assertNull(layout.avatarSize)
|
||||
assertNull(layout.chromeMaxWidth)
|
||||
assertNull(layout.transcriptMaxWidth)
|
||||
assertNull(layout.focusVoiceMaxWidth)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mediumWindowsUseBoundedChatSurfaces() {
|
||||
val layout = chatResponsiveLayout(screenWidthDp = 600)
|
||||
|
||||
assertEquals(600.dp, layout.introMaxWidth)
|
||||
assertEquals(300.dp, layout.avatarSize)
|
||||
assertEquals(760.dp, layout.chromeMaxWidth)
|
||||
assertEquals(760.dp, layout.transcriptMaxWidth)
|
||||
assertEquals(760.dp, layout.focusVoiceMaxWidth)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun expandedTabletsUseReadableCenteredRails() {
|
||||
val layout = chatResponsiveLayout(screenWidthDp = 1280)
|
||||
|
||||
assertEquals(720.dp, layout.introMaxWidth)
|
||||
assertEquals(360.dp, layout.avatarSize)
|
||||
assertEquals(960.dp, layout.chromeMaxWidth)
|
||||
assertEquals(960.dp, layout.transcriptMaxWidth)
|
||||
assertEquals(1120.dp, layout.focusVoiceMaxWidth)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun focusVoiceSplitsOnlyOnExpandedLandscapeWindows() {
|
||||
assertTrue(useSplitVoiceLayout(screenWidthDp = 1280, screenHeightDp = 800))
|
||||
assertFalse(useSplitVoiceLayout(screenWidthDp = 800, screenHeightDp = 1280))
|
||||
assertFalse(useSplitVoiceLayout(screenWidthDp = 839, screenHeightDp = 600))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.hermesandroid.relay.ui
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class UiMessageBusTest {
|
||||
@Test
|
||||
fun keyedShowReplacesInPlaceAndClearRemovesOnlyExactOwner() {
|
||||
val unrelated = message(1, "Network ready", key = "network")
|
||||
val first = message(2, "Half used", key = "credits.usage")
|
||||
val replacement = message(3, "Almost used", key = "credits.usage")
|
||||
|
||||
val replaced = reduceUiMessages(
|
||||
listOf(unrelated, first),
|
||||
UiMessageEvent.Show(replacement),
|
||||
maxRetained = 6,
|
||||
)
|
||||
val cleared = reduceUiMessages(
|
||||
replaced,
|
||||
UiMessageEvent.Clear("credits.usage"),
|
||||
maxRetained = 6,
|
||||
)
|
||||
|
||||
assertEquals(listOf(unrelated, replacement), replaced)
|
||||
assertEquals(listOf(unrelated), cleared)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun unkeyedMessagesStillCoalesceByTextAndRespectBound() {
|
||||
var state = emptyList<UiMessage>()
|
||||
repeat(8) { index ->
|
||||
state = reduceUiMessages(
|
||||
state,
|
||||
UiMessageEvent.Show(message(index.toLong(), "message-$index")),
|
||||
maxRetained = 6,
|
||||
)
|
||||
}
|
||||
state = reduceUiMessages(
|
||||
state,
|
||||
UiMessageEvent.Show(message(99, "message-7")),
|
||||
maxRetained = 6,
|
||||
)
|
||||
|
||||
assertEquals(6, state.size)
|
||||
assertEquals(99L, state.last().id)
|
||||
assertEquals(1, state.count { it.text == "message-7" })
|
||||
assertTrue(state.none { it.text == "message-0" })
|
||||
}
|
||||
|
||||
private fun message(id: Long, text: String, key: String? = null) = UiMessage(
|
||||
id = id,
|
||||
text = text,
|
||||
severity = UiMessageSeverity.Info,
|
||||
ttlMillis = UiMessageBus.DEFAULT_TTL_MS,
|
||||
key = key,
|
||||
)
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
package com.hermesandroid.relay.ui.components
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.media.ExifInterface
|
||||
import android.net.Uri
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertNotNull
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import java.io.File
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class OrientedBitmapDecoderTest {
|
||||
@@ -36,4 +41,26 @@ class OrientedBitmapDecoderTest {
|
||||
imageOrientationTransform(ExifInterface.ORIENTATION_TRANSVERSE),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `content uri decoder reads encoded image without byte array handoff`() {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val source = File.createTempFile("oriented-bitmap-", ".png", context.cacheDir)
|
||||
val bitmap = Bitmap.createBitmap(3, 2, Bitmap.Config.ARGB_8888)
|
||||
try {
|
||||
source.outputStream().use { output ->
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, output)
|
||||
}
|
||||
} finally {
|
||||
bitmap.recycle()
|
||||
}
|
||||
|
||||
val decoded = decodeOrientedBitmap(context, Uri.fromFile(source))
|
||||
|
||||
assertNotNull(decoded)
|
||||
assertEquals(3, decoded?.width)
|
||||
assertEquals(2, decoded?.height)
|
||||
decoded?.recycle()
|
||||
source.delete()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,35 @@ class VoiceModeOverlayInteractionTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(qualifiers = "w1280dp-h800dp-xhdpi")
|
||||
fun expandedLandscape_usesSplitLayoutAndKeepsMicSemanticAction() {
|
||||
var micTaps = 0
|
||||
compose.mainClock.autoAdvance = false
|
||||
|
||||
compose.setContent {
|
||||
MaterialTheme {
|
||||
VoiceModeOverlay(
|
||||
uiState = idleVoiceState(),
|
||||
onMicTap = { micTaps += 1 },
|
||||
onMicRelease = {},
|
||||
onInterrupt = {},
|
||||
onDismiss = {},
|
||||
onModeChange = {},
|
||||
onClearError = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compose.onNodeWithTag(VOICE_FOCUS_SPLIT_LAYOUT_TEST_TAG).assertExists()
|
||||
compose.onNodeWithTag(VOICE_FOCUS_STACKED_LAYOUT_TEST_TAG).assertDoesNotExist()
|
||||
compose.onNodeWithTag(VOICE_MODE_MIC_TEST_TAG)
|
||||
.assertHasClickAction()
|
||||
.performSemanticsAction(SemanticsActions.OnClick)
|
||||
|
||||
compose.runOnIdle { assertEquals(1, micTaps) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun focusMode_emptySpaceDoesNotClickThroughToChat() {
|
||||
var backgroundTaps = 0
|
||||
|
||||
@@ -60,9 +60,20 @@ class DiagnosticsScreenTest {
|
||||
assertEquals(
|
||||
CheckStatus.Unknown,
|
||||
checks.single {
|
||||
it.name == context.getString(R.string.active_section_optional_relay)
|
||||
it.name == context.getString(R.string.diag_relay_tools_optional)
|
||||
}.status,
|
||||
)
|
||||
assertEquals(
|
||||
context.getString(R.string.diag_relay_tools_not_paired),
|
||||
checks.single { it.name == context.getString(R.string.diag_relay_tools_optional) }.reason,
|
||||
)
|
||||
assertFalse(
|
||||
checks.any {
|
||||
it.name == context.getString(R.string.diag_check_pairing_auth) ||
|
||||
it.name == context.getString(R.string.active_section_optional_relay) ||
|
||||
it.name == context.getString(R.string.diag_check_relay_plugin)
|
||||
},
|
||||
)
|
||||
assertFalse(
|
||||
"Absent optional API/Relay surfaces must not make chat fail",
|
||||
checks.any {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.hermesandroid.relay.util
|
||||
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34])
|
||||
class MediaCacheWriterTest {
|
||||
|
||||
@Test
|
||||
fun cacheFile_promotesStreamedFileWithoutByteArrayHandoff() = runTest {
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val source = File.createTempFile("hermes-media-test-", ".part", context.cacheDir)
|
||||
.apply { writeText("streamed-media") }
|
||||
val writer = MediaCacheWriter(context) { 32 }
|
||||
|
||||
val cached = writer.cacheFile(source, "audio/mpeg", "voice reply.mp3")
|
||||
|
||||
assertFalse(source.exists())
|
||||
assertEquals("streamed-media", cached.readText())
|
||||
writer.clear()
|
||||
}
|
||||
}
|
||||
@@ -27,12 +27,62 @@ import org.junit.Test
|
||||
class PhoneStatusPromptBuilderTest {
|
||||
|
||||
private val defaultSettings = AppContextSettings()
|
||||
private val phoneTools = setOf("android_phone_status", "android_tap")
|
||||
|
||||
@Test
|
||||
fun missingToolCatalog_keepsNeutralMobileContextWithoutRelayClaims() {
|
||||
val output = buildPromptBlock(
|
||||
defaultSettings,
|
||||
PhoneSnapshot(
|
||||
bridgeBound = true,
|
||||
masterEnabled = true,
|
||||
blocklistCount = 4,
|
||||
),
|
||||
availableTools = null,
|
||||
)
|
||||
|
||||
assertNotNull(output)
|
||||
assertTrue(output!!.contains("Hermes-Relay Android app"))
|
||||
assertFalse(output.contains("Phone bridge:"))
|
||||
assertFalse(output.contains("android_phone_status"))
|
||||
assertFalse(output.contains("Safety rails:"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun settingsPreviewFixture_keepsBridgeAndSafetyToggleExamplesVisible() {
|
||||
val output = buildPromptBlock(
|
||||
defaultSettings,
|
||||
PhoneSnapshot(
|
||||
blocklistCount = 3,
|
||||
destructiveVerbCount = 5,
|
||||
autoDisableMinutes = 15,
|
||||
),
|
||||
availableTools = PHONE_CONTEXT_PREVIEW_TOOLS,
|
||||
)
|
||||
|
||||
assertNotNull(output)
|
||||
assertTrue(output!!.contains("Phone bridge: not connected"))
|
||||
assertTrue(output.contains("Safety rails: 3 blocked apps, 5 destructive verbs, 15m auto-disable."))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setupOnlyCatalog_doesNotAdvertisePhoneControl() {
|
||||
val output = buildPromptBlock(
|
||||
defaultSettings,
|
||||
PhoneSnapshot(bridgeBound = true, masterEnabled = true),
|
||||
availableTools = setOf("android_setup"),
|
||||
)
|
||||
|
||||
assertNotNull(output)
|
||||
assertFalse(output!!.contains("Phone bridge:"))
|
||||
assertFalse(output.contains("android_phone_status"))
|
||||
}
|
||||
|
||||
// --- Case 1: bridge not bound, all defaults off ---
|
||||
|
||||
@Test
|
||||
fun defaultSnapshot_bridgeNotBound_saysNotConnected() {
|
||||
val output = buildPromptBlock(defaultSettings, PhoneSnapshot())
|
||||
val output = buildPromptBlock(defaultSettings, PhoneSnapshot(), phoneTools)
|
||||
assertNotNull(
|
||||
"master defaults to true so the block should render",
|
||||
output,
|
||||
@@ -63,7 +113,7 @@ class PhoneStatusPromptBuilderTest {
|
||||
credentialLockDetected = true,
|
||||
screenOn = true,
|
||||
)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot, phoneTools)
|
||||
assertNotNull(output)
|
||||
assertTrue(
|
||||
"expected the disabled-by-user line; got: $output",
|
||||
@@ -91,7 +141,7 @@ class PhoneStatusPromptBuilderTest {
|
||||
credentialLockDetected = false,
|
||||
screenOn = true,
|
||||
)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot, phoneTools)
|
||||
assertNotNull(output)
|
||||
assertTrue(
|
||||
"expected 'Unattended access: off' advisory; got: $output",
|
||||
@@ -123,7 +173,7 @@ class PhoneStatusPromptBuilderTest {
|
||||
credentialLockDetected = false,
|
||||
screenOn = false,
|
||||
)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot, phoneTools)
|
||||
assertNotNull(output)
|
||||
assertTrue(
|
||||
"expected the 'Unattended access: on — the screen will wake' advisory; got: $output",
|
||||
@@ -155,7 +205,7 @@ class PhoneStatusPromptBuilderTest {
|
||||
credentialLockDetected = true,
|
||||
screenOn = true,
|
||||
)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot, phoneTools)
|
||||
assertNotNull(output)
|
||||
assertTrue(
|
||||
"agent MUST see the credential-lock warning string; got: $output",
|
||||
@@ -188,6 +238,7 @@ class PhoneStatusPromptBuilderTest {
|
||||
unattendedEnabled = true,
|
||||
screenOn = true,
|
||||
),
|
||||
phoneTools,
|
||||
)
|
||||
assertNull(
|
||||
"master=false must omit the system message entirely " +
|
||||
@@ -213,11 +264,29 @@ class PhoneStatusPromptBuilderTest {
|
||||
credentialLockDetected = false,
|
||||
screenOn = true,
|
||||
)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot)
|
||||
val output = buildPromptBlock(defaultSettings, snapshot, phoneTools)
|
||||
assertNotNull(output)
|
||||
assertTrue(
|
||||
"expected permissions list; got: $output",
|
||||
output!!.contains("Permissions: accessibility, screen capture, overlay, notifications"),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun bridgeToolWithoutStatusTool_omitsUnavailableStatusToolAdvice() {
|
||||
val output = buildPromptBlock(
|
||||
defaultSettings,
|
||||
PhoneSnapshot(
|
||||
bridgeBound = true,
|
||||
masterEnabled = true,
|
||||
accessibilityGranted = true,
|
||||
screenOn = true,
|
||||
),
|
||||
availableTools = setOf("android_tap"),
|
||||
)
|
||||
|
||||
assertNotNull(output)
|
||||
assertTrue(output!!.contains("Phone bridge: enabled"))
|
||||
assertFalse(output.contains("android_phone_status"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.hermesandroid.relay.viewmodel
|
||||
|
||||
import com.hermesandroid.relay.network.upstream.ToolsetInfo
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
|
||||
class ChatContextCapabilityTest {
|
||||
@Test
|
||||
fun mediaHint_prefersUpstreamAndFramesRelayAsEnhancement() {
|
||||
val hint = buildMediaCapabilityHint(
|
||||
upstreamAvailable = true,
|
||||
relayAvailable = true,
|
||||
)
|
||||
|
||||
assertTrue(hint!!.startsWith("Media display: this client supports standard upstream Hermes"))
|
||||
assertTrue(hint.contains("Relay enhancement:"))
|
||||
assertTrue(hint.contains("Relay is not required"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mediaHint_supportsStandardUpstreamWithoutRelay() {
|
||||
val hint = buildMediaCapabilityHint(
|
||||
upstreamAvailable = true,
|
||||
relayAvailable = false,
|
||||
)
|
||||
|
||||
assertTrue(hint!!.contains("authenticated upstream Dashboard file routes"))
|
||||
assertFalse(hint.contains("Relay enhancement:"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mediaHint_isAbsentWithoutAnyDeliveryRoute() {
|
||||
assertNull(
|
||||
buildMediaCapabilityHint(
|
||||
upstreamAvailable = false,
|
||||
relayAvailable = false,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sseToolCatalog_includesOnlyEnabledConfiguredToolsets() {
|
||||
val names = eligibleSseToolNames(
|
||||
listOf(
|
||||
ToolsetInfo(
|
||||
name = "android",
|
||||
enabled = true,
|
||||
configured = true,
|
||||
tools = listOf("android_phone_status", "android_tap"),
|
||||
),
|
||||
ToolsetInfo(
|
||||
name = "desktop",
|
||||
enabled = true,
|
||||
configured = false,
|
||||
tools = listOf("desktop_screenshot"),
|
||||
),
|
||||
ToolsetInfo(
|
||||
name = "terminal",
|
||||
enabled = false,
|
||||
configured = true,
|
||||
tools = listOf("terminal"),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
assertTrue(names == setOf("android_phone_status", "android_tap"))
|
||||
}
|
||||
}
|
||||
@@ -517,6 +517,40 @@ class ChatViewModelGatewayInboundTurnTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ownershipErrorAfterFreshSubmitStaysVisibleWithoutHistoryRecovery() {
|
||||
val ownershipError =
|
||||
"Session 20260612_120000_abc123 already has a live owner (webui, pid 42, running 0m). " +
|
||||
"Only one surface at a time may run a session, because a second one would reason from stale history."
|
||||
val historyReads = AtomicInteger(0)
|
||||
viewModel.setProfileMessageLoader {
|
||||
historyReads.incrementAndGet()
|
||||
Result.success(emptyList())
|
||||
}
|
||||
viewModel.createNewChat()
|
||||
|
||||
viewModel.sendMessage("Keep this retryable")
|
||||
gatewayHarness.awaitRpc("prompt.submit")
|
||||
serverWs.send(
|
||||
gatewayHarness.eventFrame(
|
||||
"error",
|
||||
buildJsonObject { put("message", ownershipError) },
|
||||
"live-1",
|
||||
),
|
||||
)
|
||||
|
||||
awaitCondition { viewModel.chatFailure.value?.rawError == ownershipError }
|
||||
assertFalse(handler.isStreaming.value)
|
||||
assertFalse(viewModel.recoveringAnswer.value)
|
||||
assertEquals(0, historyReads.get())
|
||||
assertTrue(handler.messages.value.any { it.content == "Keep this retryable" })
|
||||
assertFalse(
|
||||
handler.messages.value.any {
|
||||
it.content.contains("unfinished message was not found", ignoreCase = true)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
@After
|
||||
fun tearDown() {
|
||||
DiagnosticsLog.clear()
|
||||
@@ -3014,6 +3048,51 @@ class ChatViewModelGatewayInboundTurnTest {
|
||||
assertTrue(viewModel.queuedMessages.value.isEmpty())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun queuedCorrectionDrainsOnceAfterOwnedTurnSettlesFromActiveSessionIdle() = runBlocking {
|
||||
viewModel.switchProfileContext(PROFILE_CONTEXT, STORED_SESSION_ID)
|
||||
gatewayHarness.redirectStatus = "rejected"
|
||||
viewModel.sendMessage("Original Android turn")
|
||||
gatewayHarness.awaitRpc("prompt.submit")
|
||||
serverWs.send(gatewayHarness.eventFrame("message.start", null, "live-resumed"))
|
||||
serverWs.send(
|
||||
gatewayHarness.eventFrame(
|
||||
"message.delta",
|
||||
buildJsonObject { put("text", "Answer without terminal") },
|
||||
"live-resumed",
|
||||
),
|
||||
)
|
||||
awaitCondition { handler.isStreaming.value }
|
||||
|
||||
viewModel.sendMessage("Queued correction")
|
||||
gatewayHarness.awaitRpc("session.redirect")
|
||||
awaitCondition { viewModel.queuedMessages.value == listOf("Queued correction") }
|
||||
persistedHistory = persistedAnswerHistory("Answer without terminal", "settled-answer")
|
||||
gatewayHarness.activeSessionListPayload = buildJsonObject {
|
||||
put("sessions", buildJsonArray {
|
||||
add(buildJsonObject {
|
||||
put("id", "live-resumed")
|
||||
put("session_key", STORED_SESSION_ID)
|
||||
put("status", "idle")
|
||||
put("last_active", 1_777_000_000.0)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
gatewayClient.listActiveSessions()
|
||||
shadowOf(Looper.getMainLooper()).idle()
|
||||
|
||||
awaitCondition {
|
||||
gatewayHarness.rpcLog.count { (method, params) ->
|
||||
method == "prompt.submit" &&
|
||||
params["text"] == JsonPrimitive("Queued correction") &&
|
||||
params["queued"] == JsonPrimitive(true)
|
||||
} == 1
|
||||
}
|
||||
assertTrue(viewModel.queuedMessages.value.isEmpty())
|
||||
assertTrue(viewModel.steerableTurn.value)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun multipleQueuedMessagesDrainAsAnOwnedRunChain() {
|
||||
viewModel.switchProfileContext(
|
||||
|
||||
@@ -7,9 +7,11 @@ import com.hermesandroid.relay.data.ChatMessage
|
||||
import com.hermesandroid.relay.data.MediaSettingsRepository
|
||||
import com.hermesandroid.relay.network.relay.RelayHttpClient
|
||||
import com.hermesandroid.relay.network.upstream.ChatHandler
|
||||
import com.hermesandroid.relay.network.upstream.DashboardApiClient
|
||||
import com.hermesandroid.relay.network.upstream.models.MessageItem
|
||||
import com.hermesandroid.relay.util.MediaCacheWriter
|
||||
import io.mockk.coEvery
|
||||
import io.mockk.coVerify
|
||||
import io.mockk.mockk
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
import okhttp3.OkHttpClient
|
||||
@@ -24,12 +26,14 @@ import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.Shadows.shadowOf
|
||||
import org.robolectric.annotation.Config
|
||||
import java.io.File
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [34])
|
||||
class ChatViewModelMediaStateTest {
|
||||
|
||||
private lateinit var server: MockWebServer
|
||||
private lateinit var dashboardServer: MockWebServer
|
||||
private lateinit var handler: ChatHandler
|
||||
private lateinit var viewModel: ChatViewModel
|
||||
private lateinit var cache: MediaCacheWriter
|
||||
@@ -37,6 +41,7 @@ class ChatViewModelMediaStateTest {
|
||||
@Before
|
||||
fun setUp() {
|
||||
server = MockWebServer().apply { start() }
|
||||
dashboardServer = MockWebServer().apply { start() }
|
||||
val context = RuntimeEnvironment.getApplication()
|
||||
val relay = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
@@ -46,9 +51,12 @@ class ChatViewModelMediaStateTest {
|
||||
.trimEnd('/')
|
||||
},
|
||||
sessionTokenProvider = { "paired-session" },
|
||||
pairedTokenSnapshot = { "paired-session" },
|
||||
)
|
||||
cache = mockk()
|
||||
coEvery { cache.cache(any(), any(), any()) } returns
|
||||
coEvery { cache.cache(any<ByteArray>(), any(), any()) } returns
|
||||
Uri.parse("content://com.axiomlabs.hermesrelay.fileprovider/hermes-media/photo.jpg")
|
||||
coEvery { cache.cache(any<File>(), any(), any()) } returns
|
||||
Uri.parse("content://com.axiomlabs.hermesrelay.fileprovider/hermes-media/photo.jpg")
|
||||
handler = ChatHandler()
|
||||
viewModel = ChatViewModel().also {
|
||||
@@ -66,6 +74,7 @@ class ChatViewModelMediaStateTest {
|
||||
@After
|
||||
fun tearDown() {
|
||||
server.shutdown()
|
||||
dashboardServer.shutdown()
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -151,6 +160,177 @@ class ChatViewModelMediaStateTest {
|
||||
assertEquals(windowsPath, request.requestUrl?.queryParameter("path"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun assistantBarePathPrefersAuthenticatedUpstreamDashboardDownload() {
|
||||
val path = "/tmp/test-voice-message.mp3"
|
||||
dashboardServer.enqueue(
|
||||
MockResponse()
|
||||
.setResponseCode(200)
|
||||
.setHeader("Content-Type", "audio/mpeg")
|
||||
.setHeader("Content-Disposition", "attachment; filename=\"test-voice-message.mp3\"")
|
||||
.setBody("voice-bytes"),
|
||||
)
|
||||
viewModel.cellularNetworkOverride = false
|
||||
viewModel.initializeMedia(
|
||||
context = RuntimeEnvironment.getApplication(),
|
||||
relayHttpClient = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
relayUrlProvider = { server.url("/").toString().replaceFirst("http://", "ws://").trimEnd('/') },
|
||||
sessionTokenProvider = { "paired-session" },
|
||||
pairedTokenSnapshot = { "paired-session" },
|
||||
),
|
||||
mediaSettingsRepo = MediaSettingsRepository(RuntimeEnvironment.getApplication()),
|
||||
mediaCacheWriter = cache,
|
||||
dashboardMediaClientProvider = {
|
||||
DashboardApiClient(baseUrl = dashboardServer.url("/").toString())
|
||||
},
|
||||
)
|
||||
|
||||
handler.loadMessageHistory(
|
||||
listOf(
|
||||
MessageItem(
|
||||
id = "assistant-audio-upstream",
|
||||
role = "assistant",
|
||||
content = JsonPrimitive("Voice reply\nMEDIA:$path"),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val loaded = awaitMessage {
|
||||
it.attachments.singleOrNull()?.state == AttachmentState.LOADED
|
||||
}.attachments.single()
|
||||
assertEquals("audio/mpeg", loaded.contentType)
|
||||
assertEquals("test-voice-message.mp3", loaded.fileName)
|
||||
coVerify(exactly = 1) { cache.cache(any<File>(), "audio/mpeg", "test-voice-message.mp3") }
|
||||
coVerify(exactly = 0) { cache.cache(any<ByteArray>(), any(), any()) }
|
||||
val request = dashboardServer.takeRequest()
|
||||
assertEquals("/api/files/download", request.requestUrl?.encodedPath)
|
||||
assertEquals(path, request.requestUrl?.queryParameter("path"))
|
||||
assertEquals(0, server.requestCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun assistantBarePathWithoutUpstreamOrRelaySettlesAsNeutralHostFile() {
|
||||
viewModel.cellularNetworkOverride = false
|
||||
viewModel.initializeMedia(
|
||||
context = RuntimeEnvironment.getApplication(),
|
||||
relayHttpClient = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
relayUrlProvider = { null },
|
||||
sessionTokenProvider = { null },
|
||||
),
|
||||
mediaSettingsRepo = MediaSettingsRepository(RuntimeEnvironment.getApplication()),
|
||||
mediaCacheWriter = cache,
|
||||
)
|
||||
|
||||
handler.loadMessageHistory(
|
||||
listOf(
|
||||
MessageItem(
|
||||
id = "assistant-file-unavailable",
|
||||
role = "assistant",
|
||||
content = JsonPrimitive("MEDIA:/tmp/result.zip"),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val unavailable = awaitMessage {
|
||||
it.attachments.singleOrNull()?.errorMessage == ChatViewModel.MEDIA_HOST_ONLY
|
||||
}.attachments.single()
|
||||
assertEquals(AttachmentState.FAILED, unavailable.state)
|
||||
assertEquals("result.zip", unavailable.fileName)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun assistantBarePathFallsBackToRelayWhenUpstreamRouteIsUnavailable() {
|
||||
val path = "/tmp/legacy-host-image.png"
|
||||
dashboardServer.enqueue(MockResponse().setResponseCode(404).setBody("not found"))
|
||||
server.enqueue(
|
||||
MockResponse()
|
||||
.setResponseCode(200)
|
||||
.setHeader("Content-Type", "image/png")
|
||||
.setHeader("Content-Disposition", "inline; filename=\"legacy-host-image.png\"")
|
||||
.setBody("image-bytes"),
|
||||
)
|
||||
viewModel.cellularNetworkOverride = false
|
||||
viewModel.initializeMedia(
|
||||
context = RuntimeEnvironment.getApplication(),
|
||||
relayHttpClient = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
relayUrlProvider = { server.url("/").toString().replaceFirst("http://", "ws://").trimEnd('/') },
|
||||
sessionTokenProvider = { "paired-session" },
|
||||
pairedTokenSnapshot = { "paired-session" },
|
||||
),
|
||||
mediaSettingsRepo = MediaSettingsRepository(RuntimeEnvironment.getApplication()),
|
||||
mediaCacheWriter = cache,
|
||||
dashboardMediaClientProvider = {
|
||||
DashboardApiClient(baseUrl = dashboardServer.url("/").toString())
|
||||
},
|
||||
)
|
||||
|
||||
handler.loadMessageHistory(
|
||||
listOf(
|
||||
MessageItem(
|
||||
id = "assistant-image-fallback",
|
||||
role = "assistant",
|
||||
content = JsonPrimitive("MEDIA:$path"),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val loaded = awaitMessage {
|
||||
it.attachments.singleOrNull()?.state == AttachmentState.LOADED
|
||||
}.attachments.single()
|
||||
assertEquals("image/png", loaded.contentType)
|
||||
assertEquals("/api/files/download", dashboardServer.takeRequest().requestUrl?.encodedPath)
|
||||
assertEquals("/media/by-path", server.takeRequest().requestUrl?.encodedPath)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun assistantBarePathDoesNotBypassUpstreamSensitiveFileDenial() {
|
||||
val path = "/home/user/.ssh/id_ed25519"
|
||||
dashboardServer.enqueue(MockResponse().setResponseCode(403).setBody("sensitive file"))
|
||||
server.enqueue(
|
||||
MockResponse()
|
||||
.setResponseCode(200)
|
||||
.setHeader("Content-Type", "application/octet-stream")
|
||||
.setBody("must-not-be-fetched"),
|
||||
)
|
||||
viewModel.cellularNetworkOverride = false
|
||||
viewModel.initializeMedia(
|
||||
context = RuntimeEnvironment.getApplication(),
|
||||
relayHttpClient = RelayHttpClient(
|
||||
okHttpClient = OkHttpClient(),
|
||||
relayUrlProvider = { server.url("/").toString().replaceFirst("http://", "ws://").trimEnd('/') },
|
||||
sessionTokenProvider = { "paired-session" },
|
||||
pairedTokenSnapshot = { "paired-session" },
|
||||
),
|
||||
mediaSettingsRepo = MediaSettingsRepository(RuntimeEnvironment.getApplication()),
|
||||
mediaCacheWriter = cache,
|
||||
dashboardMediaClientProvider = {
|
||||
DashboardApiClient(baseUrl = dashboardServer.url("/").toString())
|
||||
},
|
||||
)
|
||||
|
||||
handler.loadMessageHistory(
|
||||
listOf(
|
||||
MessageItem(
|
||||
id = "assistant-sensitive-denied",
|
||||
role = "assistant",
|
||||
content = JsonPrimitive("MEDIA:$path"),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
val denied = awaitMessage {
|
||||
it.attachments.singleOrNull()?.let { attachment ->
|
||||
attachment.state == AttachmentState.FAILED && attachment.errorMessage != null
|
||||
} == true
|
||||
}.attachments.single()
|
||||
assertEquals(AttachmentState.FAILED, denied.state)
|
||||
assertEquals(1, dashboardServer.requestCount)
|
||||
assertEquals(0, server.requestCount)
|
||||
}
|
||||
|
||||
private fun awaitMessage(predicate: (ChatMessage) -> Boolean): ChatMessage {
|
||||
val deadline = System.nanoTime() + 5_000_000_000L
|
||||
while (System.nanoTime() < deadline) {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.hermesandroid.relay.viewmodel
|
||||
|
||||
import com.hermesandroid.relay.network.upstream.GatewayAgentNotice
|
||||
import com.hermesandroid.relay.ui.UiMessageBus
|
||||
import com.hermesandroid.relay.ui.UiMessageSeverity
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
class GatewayNoticePresentationTest {
|
||||
@Test
|
||||
fun stickyWarningStripsDuplicateGlyphAndKeepsKey() {
|
||||
val presentation = gatewayNoticePresentation(
|
||||
GatewayAgentNotice(
|
||||
text = "⚠ Credits depleted",
|
||||
level = "warn",
|
||||
kind = "sticky",
|
||||
key = "credits.depleted",
|
||||
),
|
||||
)
|
||||
|
||||
assertEquals("Credits depleted", presentation.text)
|
||||
assertEquals(UiMessageSeverity.Warning, presentation.severity)
|
||||
assertEquals(0L, presentation.ttlMillis)
|
||||
assertEquals("credits.depleted", presentation.key)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ttlNoticeUsesIdFallbackAndBoundsLifetime() {
|
||||
val presentation = gatewayNoticePresentation(
|
||||
GatewayAgentNotice(
|
||||
text = " ✓ Credits restored ",
|
||||
level = "success",
|
||||
kind = "ttl",
|
||||
ttlMs = 600_000L,
|
||||
id = "notice-2",
|
||||
),
|
||||
)
|
||||
|
||||
assertEquals("Credits restored", presentation.text)
|
||||
assertEquals(UiMessageSeverity.Success, presentation.severity)
|
||||
assertEquals(60_000L, presentation.ttlMillis)
|
||||
assertEquals("notice-2", presentation.key)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ttlWithoutDurationUsesExistingBannerDefault() {
|
||||
val presentation = gatewayNoticePresentation(
|
||||
GatewayAgentNotice(text = "Account update", kind = "ttl"),
|
||||
)
|
||||
|
||||
assertEquals(UiMessageBus.DEFAULT_TTL_MS, presentation.ttlMillis)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun agentNoticePersistsUntilGatewayClearsItsKey() {
|
||||
val presentation = gatewayNoticePresentation(
|
||||
GatewayAgentNotice(
|
||||
text = "Still starting agent",
|
||||
kind = "agent",
|
||||
key = "agent-startup",
|
||||
),
|
||||
)
|
||||
|
||||
assertEquals(0L, presentation.ttlMillis)
|
||||
assertEquals("agent-startup", presentation.key)
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.hermesandroid.relay.viewmodel
|
||||
|
||||
import android.app.Application
|
||||
import androidx.test.core.app.ApplicationProvider
|
||||
import com.hermesandroid.relay.data.GitRepositoryRoute
|
||||
import com.hermesandroid.relay.network.upstream.DashboardApiClient
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
@@ -56,21 +57,29 @@ class GitStateViewModelTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `disabled configuration does not discover repositories until enabled`() = runBlocking {
|
||||
enqueueJson("""{"repos":[]}""")
|
||||
fun `disabled Relay discovery still loads standard session repository`() = runBlocking {
|
||||
enqueueJson("""{"branch":"main","changed":0,"staged":0,"unstaged":0,"untracked":0,"files":[]}""")
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(
|
||||
DashboardApiClient(server.url("/").toString()),
|
||||
ownerKey,
|
||||
scanningEnabled = false,
|
||||
)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = null)
|
||||
|
||||
vm.loadRepos()
|
||||
assertEquals(0, server.requestCount)
|
||||
val standard = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Ready>().first()
|
||||
}
|
||||
assertEquals(GitRepositoryRoute.UPSTREAM, standard.repos.single().route)
|
||||
assertEquals("/api/git/status?path=%2Fworkspace%2Frepo", server.takeRequest().path)
|
||||
assertEquals(1, server.requestCount)
|
||||
|
||||
enqueueJson("""{"branch":"main","changed":0,"staged":0,"unstaged":0,"untracked":0,"files":[]}""")
|
||||
enqueueJson("""{"repos":[]}""")
|
||||
vm.setScanningEnabled(true)
|
||||
vm.loadRepos()
|
||||
withTimeout(5_000) { vm.repos.filterIsInstance<GitStateUiState.Ready>().first() }
|
||||
assertEquals("/api/git/status?path=%2Fworkspace%2Frepo", server.takeRequest().path)
|
||||
assertEquals("/api/plugins/hermes-relay/git/repos", server.takeRequest().path)
|
||||
}
|
||||
|
||||
@@ -203,4 +212,141 @@ class GitStateViewModelTest {
|
||||
}
|
||||
assertTrue(error.message.contains("unknown repository"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `active session repository uses upstream Git without Relay`() = runBlocking {
|
||||
enqueueJson(
|
||||
"""{"branch":"main","changed":2,"staged":0,"unstaged":1,"untracked":1,"added":7,"removed":2,"files":[]}""",
|
||||
)
|
||||
server.enqueue(
|
||||
MockResponse().setResponseCode(404).setBody("""{"detail":"No such API endpoint"}"""),
|
||||
)
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(DashboardApiClient(server.url("/").toString()), ownerKey, scanningEnabled = true)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = "/workspace/repo/src")
|
||||
vm.loadRepos()
|
||||
|
||||
val ready = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Ready>().first()
|
||||
}
|
||||
assertEquals(1, ready.repos.size)
|
||||
assertEquals(GitRepositoryRoute.UPSTREAM, ready.repos.single().route)
|
||||
assertEquals("/workspace/repo", ready.repos.single().root)
|
||||
assertEquals("/api/git/status?path=%2Fworkspace%2Frepo", server.takeRequest().path)
|
||||
assertEquals("/api/plugins/hermes-relay/git/repos", server.takeRequest().path)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `standard session repository can be selected while Relay discovery is off`() = runBlocking {
|
||||
enqueueJson(
|
||||
"""{"branch":"main","changed":1,"staged":0,"unstaged":1,"untracked":0,"added":2,"removed":0,"files":[{"path":"a.kt","unstaged":true}]}""",
|
||||
)
|
||||
enqueueJson(
|
||||
"""{"branch":"main","changed":1,"staged":0,"unstaged":1,"untracked":0,"added":2,"removed":0,"files":[{"path":"a.kt","unstaged":true}]}""",
|
||||
)
|
||||
enqueueJson("""{"files":[{"path":"a.kt","added":2,"removed":0,"staged":false}]}""")
|
||||
enqueueJson("""{"branches":[{"name":"main","checkedOut":true}]}""")
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(DashboardApiClient(server.url("/").toString()), ownerKey, scanningEnabled = false)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = null)
|
||||
vm.loadRepos()
|
||||
val repos = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Ready>().first()
|
||||
}
|
||||
|
||||
vm.selectRepo(repos.repos.single().id)
|
||||
val detail = withTimeout(5_000) {
|
||||
vm.detail.filterIsInstance<GitRepoDetailState.Ready>().first()
|
||||
}
|
||||
assertEquals("a.kt", detail.status.modified.single().path)
|
||||
assertNotNull(vm.currentTarget())
|
||||
assertEquals(4, server.requestCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `upstream operational failure does not downgrade to Relay`() = runBlocking {
|
||||
server.enqueue(MockResponse().setResponseCode(500).setBody("""{"detail":"git crashed"}"""))
|
||||
enqueueJson(
|
||||
"""{"repos":[{"id":"alpha","name":"alpha","root":"/workspace/repo"}]}""",
|
||||
)
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(DashboardApiClient(server.url("/").toString()), ownerKey, scanningEnabled = true)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = null)
|
||||
vm.loadRepos()
|
||||
|
||||
val error = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Error>().first()
|
||||
}
|
||||
assertTrue(error.message.contains("HTTP 500"))
|
||||
assertEquals(1, server.requestCount)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `upstream session status maps official review and branch shapes`() = runBlocking {
|
||||
enqueueJson(
|
||||
"""{"branch":"feature/x","changed":2,"staged":1,"unstaged":1,"untracked":0,"added":9,"removed":3,"files":[{"path":"a.kt","staged":true},{"path":"b.kt","unstaged":true}]}""",
|
||||
)
|
||||
server.enqueue(MockResponse().setResponseCode(404).setBody("""{"detail":"plugin absent"}"""))
|
||||
enqueueJson(
|
||||
"""{"branch":"feature/x","changed":2,"staged":1,"unstaged":1,"untracked":0,"added":9,"removed":3,"files":[{"path":"a.kt","staged":true},{"path":"b.kt","unstaged":true}]}""",
|
||||
)
|
||||
enqueueJson(
|
||||
"""{"files":[{"path":"a.kt","added":5,"removed":1,"staged":true},{"path":"b.kt","added":4,"removed":2,"staged":false}],"base":null}""",
|
||||
)
|
||||
enqueueJson(
|
||||
"""{"branches":[{"name":"feature/x","checkedOut":true,"isDefault":false,"isRemote":false,"worktreePath":"/workspace/repo"}]}""",
|
||||
)
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(DashboardApiClient(server.url("/").toString()), ownerKey, scanningEnabled = true)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = null)
|
||||
vm.loadRepos()
|
||||
val repos = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Ready>().first()
|
||||
}
|
||||
|
||||
vm.selectRepo(repos.repos.single().id)
|
||||
val detail = withTimeout(5_000) {
|
||||
vm.detail.filterIsInstance<GitRepoDetailState.Ready>().first()
|
||||
}
|
||||
assertEquals(2, detail.status.counts.changes)
|
||||
assertEquals(9, detail.status.counts.additions)
|
||||
assertEquals(3, detail.status.counts.deletions)
|
||||
assertEquals("a.kt", detail.status.staged.single().path)
|
||||
assertEquals("b.kt", detail.status.modified.single().path)
|
||||
assertTrue(detail.branches.single().isCurrent)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `missing upstream read route falls back to matching Relay repository`() = runBlocking {
|
||||
enqueueJson(
|
||||
"""{"branch":"main","changed":1,"staged":0,"unstaged":1,"untracked":0,"files":[]}""",
|
||||
)
|
||||
enqueueJson(
|
||||
"""{"repos":[{"id":"relay-alpha","name":"repo","root":"/workspace/repo","current_branch":"main","dirty":true}]}""",
|
||||
)
|
||||
server.enqueue(MockResponse().setResponseCode(404).setBody("""{"detail":"route unavailable"}"""))
|
||||
enqueueJson(
|
||||
"""{"counts":{"staged":0,"modified":1,"untracked":0},"staged":[],"modified":[{"path":"a.kt"}],"untracked":[],"truncated":false}""",
|
||||
)
|
||||
enqueueJson(
|
||||
"""{"branches":[{"name":"main","checkedOut":true,"isDefault":true,"isRemote":false,"worktreePath":"/workspace/repo"}]}""",
|
||||
)
|
||||
val vm = GitStateViewModel(application)
|
||||
vm.configure(DashboardApiClient(server.url("/").toString()), ownerKey, scanningEnabled = true)
|
||||
vm.setSessionWorkspace(repoRoot = "/workspace/repo", workingDirectory = null)
|
||||
vm.loadRepos()
|
||||
val repos = withTimeout(5_000) {
|
||||
vm.repos.filterIsInstance<GitStateUiState.Ready>().first()
|
||||
}
|
||||
|
||||
vm.selectRepo(repos.repos.single().id)
|
||||
val detail = withTimeout(5_000) {
|
||||
vm.detail.filterIsInstance<GitRepoDetailState.Ready>().first()
|
||||
}
|
||||
assertEquals("a.kt", detail.status.modified.single().path)
|
||||
val paths = buildList {
|
||||
repeat(5) { add(server.takeRequest().path.orEmpty()) }
|
||||
}
|
||||
assertTrue(paths.contains("/api/plugins/hermes-relay/git/status?repo=relay-alpha"))
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 662 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 201 KiB |
@@ -1,26 +1,11 @@
|
||||
import { spawn } from 'node:child_process'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { homedir } from 'node:os'
|
||||
import { basename, dirname, join, win32 } from 'node:path'
|
||||
|
||||
import type { ParsedArgs } from '../cli.js'
|
||||
import { uiExecutablePath } from '../windowsBundle.js'
|
||||
import { updateCommand } from './update.js'
|
||||
|
||||
export function uiExecutablePath(env = process.env, executable = process.execPath): string {
|
||||
if (env.HERMES_RELAY_UI_PATH) return env.HERMES_RELAY_UI_PATH
|
||||
if (env.HERMES_RELAY_INSTALL_DIR) {
|
||||
const pathApi = win32.isAbsolute(env.HERMES_RELAY_INSTALL_DIR) ? win32 : { join }
|
||||
return pathApi.join(env.HERMES_RELAY_INSTALL_DIR, 'hermes-relay-tray.exe')
|
||||
}
|
||||
const executableName = win32.basename(executable).toLowerCase()
|
||||
if (executableName === 'hermes-relay.exe') {
|
||||
return win32.join(win32.dirname(executable), 'hermes-relay-tray.exe')
|
||||
}
|
||||
if (basename(executable).toLowerCase() === 'hermes-relay') {
|
||||
return join(dirname(executable), 'hermes-relay-tray.exe')
|
||||
}
|
||||
return join(homedir(), '.hermes', 'bin', 'hermes-relay-tray.exe')
|
||||
}
|
||||
export { uiExecutablePath }
|
||||
|
||||
function printHelp(): void {
|
||||
process.stdout.write(`Usage: hermes-relay ui [open|status|install]\n\n`)
|
||||
|
||||
@@ -29,8 +29,23 @@ import {
|
||||
} from '../updater.js'
|
||||
import { VERSION } from '../version.js'
|
||||
import { scheduleWindowsInstaller } from '../windowsInstaller.js'
|
||||
import { detectWindowsBundle, type WindowsBundleState } from '../windowsBundle.js'
|
||||
import { isDaemonProcessAlive, readDaemonStatus } from '../lib/daemonStatus.js'
|
||||
|
||||
export interface UpdateCommandOptions {
|
||||
platform?: NodeJS.Platform
|
||||
arch?: string
|
||||
bundle?: WindowsBundleState
|
||||
}
|
||||
|
||||
export function installerRunsSilently(
|
||||
bundleInstalled: boolean,
|
||||
autoYes: boolean,
|
||||
wantJson: boolean
|
||||
): boolean {
|
||||
return bundleInstalled || autoYes || wantJson
|
||||
}
|
||||
|
||||
function humanBytes(n: number | null): string {
|
||||
if (n === null) return '?'
|
||||
if (n < 1024) return `${n} B`
|
||||
@@ -80,6 +95,10 @@ function renderProgressBar(bytes: number, total: number, width = 28): string {
|
||||
|
||||
interface JsonReport {
|
||||
current: string
|
||||
target: 'cli' | 'cli_ui'
|
||||
ui_installed: boolean
|
||||
ui_version: string | null
|
||||
versions_in_sync: boolean
|
||||
up_to_date: boolean
|
||||
ahead_of_latest: boolean
|
||||
latest_tag: string | null
|
||||
@@ -96,9 +115,13 @@ interface JsonReport {
|
||||
error: string | null
|
||||
}
|
||||
|
||||
function emptyReport(): JsonReport {
|
||||
function emptyReport(target: 'cli' | 'cli_ui', bundle: WindowsBundleState): JsonReport {
|
||||
return {
|
||||
current: VERSION,
|
||||
target,
|
||||
ui_installed: bundle.installed,
|
||||
ui_version: bundle.version,
|
||||
versions_in_sync: !bundle.installed || bundle.version === VERSION,
|
||||
up_to_date: true,
|
||||
ahead_of_latest: false,
|
||||
latest_tag: null,
|
||||
@@ -116,11 +139,22 @@ function emptyReport(): JsonReport {
|
||||
}
|
||||
}
|
||||
|
||||
function reportFromInfo(info: UpdateInfo): JsonReport {
|
||||
function reportFromInfo(
|
||||
info: UpdateInfo,
|
||||
target: 'cli' | 'cli_ui',
|
||||
bundle: WindowsBundleState
|
||||
): JsonReport {
|
||||
const versionsInSync = !bundle.installed || bundle.version === VERSION
|
||||
const bundleNeedsRepair = target === 'cli_ui' && bundle.installed && !versionsInSync
|
||||
const uiAhead = bundle.version !== null && compareVersions(bundle.version, info.latest_version) > 0
|
||||
return {
|
||||
current: info.current,
|
||||
up_to_date: !info.is_upgrade,
|
||||
ahead_of_latest: compareVersions(info.current, info.latest_version) > 0,
|
||||
target,
|
||||
ui_installed: bundle.installed,
|
||||
ui_version: bundle.version,
|
||||
versions_in_sync: versionsInSync,
|
||||
up_to_date: !info.is_upgrade && !bundleNeedsRepair,
|
||||
ahead_of_latest: compareVersions(info.current, info.latest_version) > 0 || uiAhead,
|
||||
latest_tag: info.latest_tag,
|
||||
latest_version: info.latest_version,
|
||||
is_prerelease: info.is_prerelease,
|
||||
@@ -136,27 +170,38 @@ function reportFromInfo(info: UpdateInfo): JsonReport {
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
export async function updateCommand(
|
||||
args: ParsedArgs,
|
||||
options: UpdateCommandOptions = {}
|
||||
): Promise<number> {
|
||||
const wantJson = !!args.flags.json
|
||||
const checkOnly = !!args.flags.check
|
||||
const autoYes = !!args.flags.yes
|
||||
const installer = !!args.flags.installer
|
||||
const installerRequested = !!args.flags.installer
|
||||
const downloadOnly = !!args.flags['download-only']
|
||||
const force = !!args.flags.force
|
||||
|
||||
const repo = typeof args.flags.repo === 'string' ? args.flags.repo : undefined
|
||||
const platform = options.platform ?? process.platform
|
||||
const arch = options.arch ?? process.arch
|
||||
const bundle = options.bundle ?? detectWindowsBundle({ platform })
|
||||
const installer = installerRequested || (platform === 'win32' && bundle.installed)
|
||||
const target = installer ? 'cli_ui' : 'cli'
|
||||
const selectedAssetName = installer
|
||||
? 'hermes-relay-windows-x64-setup.exe'
|
||||
: assetNameForPlatform(platform, arch)
|
||||
|
||||
let info: UpdateInfo | null = null
|
||||
try {
|
||||
const checkOpts = {
|
||||
...(repo !== undefined ? { repo } : {}),
|
||||
...(installer ? { assetName: 'hermes-relay-windows-x64-setup.exe' } : {})
|
||||
...(selectedAssetName !== null ? { assetName: selectedAssetName } : {})
|
||||
}
|
||||
info = await checkForUpdate(checkOpts)
|
||||
} catch (err) {
|
||||
const msg = err instanceof Error ? err.message : String(err)
|
||||
if (wantJson) {
|
||||
const report = emptyReport()
|
||||
const report = emptyReport(target, bundle)
|
||||
report.error = msg
|
||||
process.stdout.write(JSON.stringify(report, null, 2) + '\n')
|
||||
return 1
|
||||
@@ -168,7 +213,7 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
if (!info) {
|
||||
// No CLI release-track rows at all — surface truthfully, don't crash.
|
||||
if (wantJson) {
|
||||
process.stdout.write(JSON.stringify(emptyReport(), null, 2) + '\n')
|
||||
process.stdout.write(JSON.stringify(emptyReport(target, bundle), null, 2) + '\n')
|
||||
return 0
|
||||
}
|
||||
process.stdout.write(`Current version: ${VERSION}\n`)
|
||||
@@ -176,7 +221,7 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
return 0
|
||||
}
|
||||
|
||||
const report = reportFromInfo(info)
|
||||
const report = reportFromInfo(info, target, bundle)
|
||||
|
||||
if (wantJson && checkOnly) {
|
||||
process.stdout.write(JSON.stringify(report, null, 2) + '\n')
|
||||
@@ -184,7 +229,10 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
}
|
||||
|
||||
if (installer && report.ahead_of_latest && !force) {
|
||||
const msg = `latest UI bundle (${info.latest_version}) is older than this CLI (${VERSION}); pass --force to downgrade explicitly`
|
||||
const installedVersions = bundle.version === null
|
||||
? `CLI ${VERSION}`
|
||||
: `CLI ${VERSION}, UI ${bundle.version}`
|
||||
const msg = `latest CLI+UI bundle (${info.latest_version}) is older than the installed ${installedVersions}; pass --force to downgrade explicitly`
|
||||
if (wantJson) {
|
||||
report.error = msg
|
||||
process.stdout.write(JSON.stringify(report, null, 2) + '\n')
|
||||
@@ -195,28 +243,45 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
}
|
||||
|
||||
if (!wantJson) {
|
||||
process.stdout.write(`Current version: ${info.current}\n`)
|
||||
if (installer && bundle.installed) {
|
||||
process.stdout.write(`Installed versions: CLI ${info.current}, UI ${bundle.version ?? 'unknown'}\n`)
|
||||
if (!report.versions_in_sync) {
|
||||
process.stdout.write('CLI/UI drift detected; the verified Windows bundle will repair both surfaces together.\n')
|
||||
}
|
||||
} else {
|
||||
process.stdout.write(`Current version: ${info.current}\n`)
|
||||
}
|
||||
process.stdout.write(`Checking GitHub Releases...\n`)
|
||||
}
|
||||
|
||||
// The full Windows installer is also how a CLI-only installation adds the
|
||||
// optional UI. Do not suppress that operation merely because the bundled
|
||||
// CLI version is already current.
|
||||
if (!info.is_upgrade && !installer) {
|
||||
if (report.up_to_date && !installerRequested) {
|
||||
if (wantJson) {
|
||||
process.stdout.write(JSON.stringify(report, null, 2) + '\n')
|
||||
return 0
|
||||
}
|
||||
process.stdout.write(`Up to date — you're on the latest CLI release.\n`)
|
||||
process.stdout.write(
|
||||
target === 'cli_ui'
|
||||
? `Up to date — the installed CLI and UI match the latest release.\n`
|
||||
: `Up to date — you're on the latest CLI release.\n`
|
||||
)
|
||||
return 0
|
||||
}
|
||||
|
||||
// Upgrade available.
|
||||
if (!wantJson) {
|
||||
const pre = info.is_prerelease ? ' (prerelease)' : ''
|
||||
process.stdout.write(
|
||||
`Upgrade available: ${info.current} → ${info.latest_version}${pre}\n`
|
||||
)
|
||||
if (info.is_upgrade) {
|
||||
process.stdout.write(
|
||||
`Upgrade available: ${info.current} → ${info.latest_version}${pre}\n`
|
||||
)
|
||||
} else if (!report.versions_in_sync) {
|
||||
process.stdout.write(`Bundle repair available: align CLI and UI on ${info.latest_version}${pre}\n`)
|
||||
} else if (installerRequested && !bundle.installed) {
|
||||
process.stdout.write(`CLI+UI bundle ready: ${info.latest_version}${pre}\n`)
|
||||
}
|
||||
process.stdout.write(` published: ${humanDate(info.published_at)}\n`)
|
||||
process.stdout.write(
|
||||
` asset: ${info.asset_name} (${humanBytes(info.asset_size)})\n`
|
||||
@@ -232,7 +297,7 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
}
|
||||
|
||||
// Refuse to proceed if this platform has no matching asset.
|
||||
const wantAsset = installer ? 'hermes-relay-windows-x64-setup.exe' : assetNameForPlatform()
|
||||
const wantAsset = selectedAssetName
|
||||
if (!wantAsset || !info.asset_url) {
|
||||
const msg = `no binary available for ${process.platform}/${process.arch}`
|
||||
if (wantJson) {
|
||||
@@ -278,29 +343,35 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
: undefined
|
||||
|
||||
try {
|
||||
const downloadOpts: DownloadOptions = onProgress ? { onProgress } : {}
|
||||
if (installer) {
|
||||
downloadOpts.targetPath = join(
|
||||
tmpdir(),
|
||||
`hermes-relay-${info.latest_version}-${process.pid}-${Date.now()}-setup.exe`
|
||||
)
|
||||
downloadOpts.cooperative = false
|
||||
}
|
||||
const downloadOpts: DownloadOptions = onProgress ? { onProgress } : {}
|
||||
if (installer) {
|
||||
downloadOpts.targetPath = join(
|
||||
tmpdir(),
|
||||
`hermes-relay-${info.latest_version}-${process.pid}-${Date.now()}-setup.exe`
|
||||
)
|
||||
downloadOpts.cooperative = false
|
||||
}
|
||||
const result = await downloadAndInstall(info, downloadOpts)
|
||||
if (installer && !downloadOnly) {
|
||||
if (process.platform !== 'win32') {
|
||||
if (platform !== 'win32') {
|
||||
throw new Error('the Hermes-Relay CLI UI installer is Windows-only')
|
||||
}
|
||||
const daemon = await readDaemonStatus()
|
||||
const installDir = process.execPath.toLowerCase().endsWith('hermes-relay.exe')
|
||||
? dirname(process.execPath)
|
||||
: join(homedir(), '.hermes', 'bin')
|
||||
const installDir = bundle.installed
|
||||
? dirname(bundle.path)
|
||||
: process.execPath.toLowerCase().endsWith('hermes-relay.exe')
|
||||
? dirname(process.execPath)
|
||||
: join(homedir(), '.hermes', 'bin')
|
||||
scheduleWindowsInstaller(result.installedPath, {
|
||||
silent: autoYes || wantJson,
|
||||
// An existing bundle update already received CLI confirmation. Run
|
||||
// setup silently so its finish-page checkbox cannot start a tray that
|
||||
// was stopped before the update; the helper restores exact state.
|
||||
silent: installerRunsSilently(bundle.installed, autoYes, wantJson),
|
||||
restartDaemon: daemon ? isDaemonProcessAlive(daemon) : false,
|
||||
installDir,
|
||||
cliPath: join(installDir, 'hermes-relay.exe'),
|
||||
trayPath: join(installDir, 'hermes-relay-tray.exe')
|
||||
trayPath: join(installDir, 'hermes-relay-tray.exe'),
|
||||
restartTray: bundle.installed ? bundle.running : true
|
||||
})
|
||||
}
|
||||
if (useTtyProgress) process.stdout.write('\n')
|
||||
@@ -315,7 +386,11 @@ export async function updateCommand(args: ParsedArgs): Promise<number> {
|
||||
: `-> installed at ${result.installedPath}\n`
|
||||
)
|
||||
if (installer && !downloadOnly) {
|
||||
process.stdout.write(' The installer updates the CLI and lets you enable the optional tray at sign-in.\n')
|
||||
process.stdout.write(
|
||||
bundle.installed
|
||||
? ' The installer updates the CLI and UI together and restores their prior running state.\n'
|
||||
: ' The installer adds the CLI and optional UI and lets you enable the tray at sign-in.\n'
|
||||
)
|
||||
} else if (result.needsRestart) {
|
||||
process.stdout.write(
|
||||
` On next \`hermes-relay\` invocation, the CLI will swap this in automatically.\n`
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { existsSync } from 'node:fs'
|
||||
import { homedir } from 'node:os'
|
||||
import { basename, dirname, join, win32 } from 'node:path'
|
||||
|
||||
export interface WindowsBundleState {
|
||||
installed: boolean
|
||||
path: string
|
||||
version: string | null
|
||||
running: boolean
|
||||
}
|
||||
|
||||
interface BundleProbe {
|
||||
version: string | null
|
||||
running: boolean
|
||||
}
|
||||
|
||||
export function uiExecutablePath(env = process.env, executable = process.execPath): string {
|
||||
if (env.HERMES_RELAY_UI_PATH) return env.HERMES_RELAY_UI_PATH
|
||||
if (env.HERMES_RELAY_INSTALL_DIR) {
|
||||
const pathApi = win32.isAbsolute(env.HERMES_RELAY_INSTALL_DIR) ? win32 : { join }
|
||||
return pathApi.join(env.HERMES_RELAY_INSTALL_DIR, 'hermes-relay-tray.exe')
|
||||
}
|
||||
const executableName = win32.basename(executable).toLowerCase()
|
||||
if (executableName === 'hermes-relay.exe') {
|
||||
return win32.join(win32.dirname(executable), 'hermes-relay-tray.exe')
|
||||
}
|
||||
if (basename(executable).toLowerCase() === 'hermes-relay') {
|
||||
return join(dirname(executable), 'hermes-relay-tray.exe')
|
||||
}
|
||||
return join(homedir(), '.hermes', 'bin', 'hermes-relay-tray.exe')
|
||||
}
|
||||
|
||||
function probeWindowsBundle(path: string): BundleProbe | null {
|
||||
const script = [
|
||||
"$item = Get-Item -LiteralPath $env:HERMES_RELAY_UI_PROBE_PATH -ErrorAction Stop",
|
||||
"$running = @(Get-Process -Name 'hermes-relay-tray' -ErrorAction SilentlyContinue | Where-Object { $_.Path -eq $item.FullName }).Count -gt 0",
|
||||
'[pscustomobject]@{ version = $item.VersionInfo.ProductVersion; running = $running } | ConvertTo-Json -Compress'
|
||||
].join('; ')
|
||||
const result = spawnSync('powershell.exe', [
|
||||
'-NoProfile',
|
||||
'-NonInteractive',
|
||||
'-ExecutionPolicy',
|
||||
'Bypass',
|
||||
'-Command',
|
||||
script
|
||||
], {
|
||||
encoding: 'utf8',
|
||||
timeout: 5_000,
|
||||
windowsHide: true,
|
||||
env: { ...process.env, HERMES_RELAY_UI_PROBE_PATH: path }
|
||||
})
|
||||
if (result.status !== 0 || !result.stdout.trim()) return null
|
||||
try {
|
||||
const value = JSON.parse(result.stdout) as { version?: unknown; running?: unknown }
|
||||
return {
|
||||
version: typeof value.version === 'string' && value.version.trim()
|
||||
? value.version.trim()
|
||||
: null,
|
||||
running: value.running === true
|
||||
}
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function detectWindowsBundle(options: {
|
||||
platform?: NodeJS.Platform
|
||||
env?: NodeJS.ProcessEnv
|
||||
executable?: string
|
||||
exists?: (path: string) => boolean
|
||||
probe?: (path: string) => BundleProbe | null
|
||||
} = {}): WindowsBundleState {
|
||||
const path = uiExecutablePath(options.env, options.executable)
|
||||
const installed = (options.platform ?? process.platform) === 'win32' &&
|
||||
(options.exists ?? existsSync)(path)
|
||||
if (!installed) return { installed: false, path, version: null, running: false }
|
||||
|
||||
const probe = (options.probe ?? probeWindowsBundle)(path)
|
||||
return {
|
||||
installed: true,
|
||||
path,
|
||||
version: probe?.version ?? null,
|
||||
// If the process probe fails, restarting is safer than leaving a UI that
|
||||
// was running before setup permanently stopped.
|
||||
running: probe?.running ?? true
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export interface WindowsInstallerLaunchOptions {
|
||||
installDir?: string
|
||||
cliPath?: string
|
||||
trayPath?: string
|
||||
restartTray?: boolean
|
||||
delayMs?: number
|
||||
callerPid?: number
|
||||
}
|
||||
@@ -31,6 +32,7 @@ export function windowsInstallerLaunchPlan(
|
||||
installDir = '',
|
||||
cliPath = '',
|
||||
trayPath = '',
|
||||
restartTray = true,
|
||||
delayMs = 1200,
|
||||
callerPid = process.pid
|
||||
} = options
|
||||
@@ -44,7 +46,7 @@ export function windowsInstallerLaunchPlan(
|
||||
'$process = Start-Process -FilePath $installer -ArgumentList $installerArgs -PassThru',
|
||||
'$process.WaitForExit()',
|
||||
"if ($process.ExitCode -eq 0 -and $env:HERMES_RELAY_SETUP_RESTART_DAEMON -eq '1') { Start-Process -FilePath $env:HERMES_RELAY_SETUP_CLI -ArgumentList @('daemon','start') -WindowStyle Hidden | Out-Null }",
|
||||
"if ($process.ExitCode -eq 0 -and $env:HERMES_RELAY_SETUP_TRAY) { Start-Process -FilePath $env:HERMES_RELAY_SETUP_TRAY -ArgumentList '--show' | Out-Null }",
|
||||
"if ($process.ExitCode -eq 0 -and $env:HERMES_RELAY_SETUP_RESTART_TRAY -eq '1' -and $env:HERMES_RELAY_SETUP_TRAY) { Start-Process -FilePath $env:HERMES_RELAY_SETUP_TRAY -ArgumentList '--show' | Out-Null }",
|
||||
'Remove-Item -LiteralPath $installer -Force -ErrorAction SilentlyContinue',
|
||||
'exit $process.ExitCode'
|
||||
].join('; ')
|
||||
@@ -73,7 +75,8 @@ export function windowsInstallerLaunchPlan(
|
||||
HERMES_RELAY_SETUP_RESTART_DAEMON: restartDaemon ? '1' : '0',
|
||||
HERMES_RELAY_SETUP_INSTALL_DIR: installDir,
|
||||
HERMES_RELAY_SETUP_CLI: cliPath,
|
||||
HERMES_RELAY_SETUP_TRAY: trayPath
|
||||
HERMES_RELAY_SETUP_TRAY: trayPath,
|
||||
HERMES_RELAY_SETUP_RESTART_TRAY: restartTray ? '1' : '0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import { tmpdir } from 'node:os'
|
||||
import test from 'node:test'
|
||||
|
||||
import { uiExecutablePath } from '../src/commands/ui.js'
|
||||
import { detectWindowsBundle } from '../src/windowsBundle.js'
|
||||
import { windowsInstallerLaunchPlan } from '../src/windowsInstaller.js'
|
||||
|
||||
test('UI executable follows an explicit install directory', () => {
|
||||
@@ -31,6 +32,7 @@ test('installer launch is delayed until the running CLI can exit', () => {
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_PATH, 'C:\\Temp\\hermes setup.exe')
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_SILENT, '1')
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_INSTALL_DIR, 'C:\\Hermes custom')
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_RESTART_TRAY, '1')
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_CALLER_PID, String(process.pid))
|
||||
assert.match(plan.args.join(' '), /Wait-Process -Id \$callerPid/)
|
||||
assert.match(plan.args.join(' '), /Start-Sleep/)
|
||||
@@ -39,6 +41,35 @@ test('installer launch is delayed until the running CLI can exit', () => {
|
||||
assert.equal(plan.options.detached, true)
|
||||
})
|
||||
|
||||
test('Windows bundle detection reads the installed UI version and running state', () => {
|
||||
const state = detectWindowsBundle({
|
||||
platform: 'win32',
|
||||
executable: 'C:\\Hermes\\hermes-relay.exe',
|
||||
exists: () => true,
|
||||
probe: path => ({
|
||||
version: path.endsWith('hermes-relay-tray.exe') ? '0.4.0-beta.4' : null,
|
||||
running: true
|
||||
})
|
||||
})
|
||||
assert.deepEqual(state, {
|
||||
installed: true,
|
||||
path: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
version: '0.4.0-beta.4',
|
||||
running: true
|
||||
})
|
||||
})
|
||||
|
||||
test('installer helper preserves a stopped tray state during a bundle update', () => {
|
||||
const plan = windowsInstallerLaunchPlan('C:\\Temp\\hermes setup.exe', {
|
||||
silent: true,
|
||||
installDir: 'C:\\Hermes',
|
||||
trayPath: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
restartTray: false
|
||||
})
|
||||
assert.equal(plan.options.env?.HERMES_RELAY_SETUP_RESTART_TRAY, '0')
|
||||
assert.match(plan.args.join(' '), /HERMES_RELAY_SETUP_RESTART_TRAY/)
|
||||
})
|
||||
|
||||
test('PowerShell launches an installer whose path contains spaces via environment transport', {
|
||||
skip: process.platform !== 'win32'
|
||||
}, async () => {
|
||||
@@ -129,6 +160,7 @@ test('POSIX installer only advertises artifacts produced by the release workflow
|
||||
assert.match(workflow, /if \[ "\$exit_code" -ne 0 \]/)
|
||||
assert.match(workflow, /Smoke exact macOS CLI release asset/)
|
||||
assert.match(workflow, /release-assets\/\$native_asset" --version/)
|
||||
assert.match(workflow, /installed UI version mismatch/)
|
||||
})
|
||||
|
||||
test('bootstrap installers paginate release discovery beyond the first API page', async () => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import test from 'node:test'
|
||||
|
||||
import { updateCommand } from '../src/commands/update.js'
|
||||
import { installerRunsSilently, updateCommand } from '../src/commands/update.js'
|
||||
import {
|
||||
assetNameForPlatform,
|
||||
checkForUpdate,
|
||||
@@ -147,6 +147,14 @@ test('installer check reports a newer local preview without treating it as an er
|
||||
command: 'update',
|
||||
positional: [],
|
||||
flags: { installer: true, check: true, json: true, repo: 'example/hermes-relay' }
|
||||
}, {
|
||||
platform: 'win32',
|
||||
bundle: {
|
||||
installed: false,
|
||||
path: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
version: null,
|
||||
running: false
|
||||
}
|
||||
}))
|
||||
assert.equal(check.code, 0)
|
||||
const report = JSON.parse(check.output)
|
||||
@@ -160,10 +168,110 @@ test('installer check reports a newer local preview without treating it as an er
|
||||
command: 'update',
|
||||
positional: [],
|
||||
flags: { installer: true, yes: true, json: true, repo: 'example/hermes-relay' }
|
||||
}, {
|
||||
platform: 'win32',
|
||||
bundle: {
|
||||
installed: false,
|
||||
path: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
version: null,
|
||||
running: false
|
||||
}
|
||||
}))
|
||||
assert.equal(install.code, 2)
|
||||
assert.match(JSON.parse(install.output).error, /older than this CLI/)
|
||||
assert.match(JSON.parse(install.output).error, /older than the installed CLI/)
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch
|
||||
}
|
||||
})
|
||||
|
||||
test('default Windows update targets the installer when an older UI is installed', async () => {
|
||||
const originalFetch = globalThis.fetch
|
||||
globalThis.fetch = async () => new Response(JSON.stringify([{
|
||||
tag_name: `desktop-v${VERSION}`,
|
||||
prerelease: VERSION.includes('-'),
|
||||
published_at: '2026-09-01T00:00:00Z',
|
||||
assets: [
|
||||
{
|
||||
name: 'hermes-relay-win-x64.exe',
|
||||
browser_download_url: 'https://download.test/hermes-relay.exe',
|
||||
size: 10
|
||||
},
|
||||
{
|
||||
name: 'hermes-relay-windows-x64-setup.exe',
|
||||
browser_download_url: 'https://download.test/setup.exe',
|
||||
size: 20
|
||||
}
|
||||
]
|
||||
}]), { status: 200, headers: { 'content-type': 'application/json' } })
|
||||
|
||||
try {
|
||||
const check = await captureStdout(() => updateCommand({
|
||||
command: 'update',
|
||||
positional: [],
|
||||
flags: { check: true, json: true, repo: 'example/hermes-relay' }
|
||||
}, {
|
||||
platform: 'win32',
|
||||
bundle: {
|
||||
installed: true,
|
||||
path: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
version: '0.4.0-beta.4',
|
||||
running: true
|
||||
}
|
||||
}))
|
||||
assert.equal(check.code, 0)
|
||||
const report = JSON.parse(check.output)
|
||||
assert.equal(report.target, 'cli_ui')
|
||||
assert.equal(report.asset_name, 'hermes-relay-windows-x64-setup.exe')
|
||||
assert.equal(report.ui_installed, true)
|
||||
assert.equal(report.ui_version, '0.4.0-beta.4')
|
||||
assert.equal(report.versions_in_sync, false)
|
||||
assert.equal(report.up_to_date, false)
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch
|
||||
}
|
||||
})
|
||||
|
||||
test('default Windows update preserves a headless CLI-only installation', async () => {
|
||||
const originalFetch = globalThis.fetch
|
||||
globalThis.fetch = async () => new Response(JSON.stringify([{
|
||||
tag_name: `desktop-v${VERSION}`,
|
||||
prerelease: VERSION.includes('-'),
|
||||
published_at: '2026-09-01T00:00:00Z',
|
||||
assets: [{
|
||||
name: 'hermes-relay-win-x64.exe',
|
||||
browser_download_url: 'https://download.test/hermes-relay.exe',
|
||||
size: 10
|
||||
}]
|
||||
}]), { status: 200, headers: { 'content-type': 'application/json' } })
|
||||
|
||||
try {
|
||||
const check = await captureStdout(() => updateCommand({
|
||||
command: 'update',
|
||||
positional: [],
|
||||
flags: { check: true, json: true, repo: 'example/hermes-relay' }
|
||||
}, {
|
||||
platform: 'win32',
|
||||
bundle: {
|
||||
installed: false,
|
||||
path: 'C:\\Hermes\\hermes-relay-tray.exe',
|
||||
version: null,
|
||||
running: false
|
||||
}
|
||||
}))
|
||||
assert.equal(check.code, 0)
|
||||
const report = JSON.parse(check.output)
|
||||
assert.equal(report.target, 'cli')
|
||||
assert.equal(report.asset_name, 'hermes-relay-win-x64.exe')
|
||||
assert.equal(report.ui_installed, false)
|
||||
assert.equal(report.versions_in_sync, true)
|
||||
assert.equal(report.up_to_date, true)
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch
|
||||
}
|
||||
})
|
||||
|
||||
test('existing bundle updates suppress the installer finish-page restart choice', () => {
|
||||
assert.equal(installerRunsSilently(true, false, false), true)
|
||||
assert.equal(installerRunsSilently(false, false, false), false)
|
||||
assert.equal(installerRunsSilently(false, true, false), true)
|
||||
})
|
||||
|
||||
@@ -74,6 +74,16 @@ Check the lane without starting work:
|
||||
`status` exits 0 when idle and 1 when busy. It intentionally does not expose the
|
||||
owning process's arguments because Gradle properties can contain credentials.
|
||||
|
||||
For Android release-note/version iteration, use the narrow release-prep lane:
|
||||
|
||||
```powershell
|
||||
python scripts/android-prepush.py --release-prep
|
||||
```
|
||||
|
||||
It runs repository metadata checks plus the rendered Changelog and What's New
|
||||
tests. It intentionally omits lint and assembly; after the exact commit is
|
||||
pushed, required CI and Play preflight provide those expensive proofs.
|
||||
|
||||
Use `exec` for a connected/device workflow that must exclude every
|
||||
wrapper-managed Gradle lane, including explicit APK installation:
|
||||
|
||||
|
||||
@@ -378,6 +378,14 @@ Key data classes: `MessageEvent` (inbound), `SendResult` (outbound), `SessionSou
|
||||
|
||||
### 14. Inbound Media via Plugin-Owned Relay Endpoint, Not Upstream Gateway (2026-04-11)
|
||||
|
||||
**Status (2026-08-31): Superseded for ordinary media.** Current upstream
|
||||
Hermes Dashboard/Desktop provides authenticated file download, streaming, and
|
||||
bounded preview routes. Android now prefers those upstream routes for ordinary
|
||||
`MEDIA:` paths and file references. The token registry remains valid for
|
||||
explicit Relay tokens, phone-control screenshots, sensitivity metadata, and
|
||||
older-host compatibility; it is no longer a prerequisite for standard inbound
|
||||
attachments. See [`upstream-surface-matrix.md`](upstream-surface-matrix.md).
|
||||
|
||||
**Decision:** Agent-initiated media (screenshots, and any future file-producing tool) is delivered to the phone via a new loopback-register + bearer-fetch pair of routes on our own relay server (`POST /media/register` → `GET /media/{token}`), not by relying on hermes-agent's upstream `extract_media()` / `send_document()` machinery. Tools emit a `MEDIA:hermes-relay://<token>` marker in their chat response text; the phone parses the marker out of the SSE stream and fetches bytes out-of-band over authenticated HTTPS.
|
||||
|
||||
**Why:**
|
||||
@@ -3710,15 +3718,20 @@ live even when upstream had already persisted the final answer. The earlier
|
||||
visible-chat Idle reattach fix covered a socket that closed after foreground
|
||||
prewarm; it did not cover this already-active turn state.
|
||||
|
||||
**Decision.** A Gateway turn may settle from `session.activate` or exact-session
|
||||
`session.info` only when the turn has already received turn-scoped activity and
|
||||
upstream reports `running=false`. Pre-start idle snapshots are ignored because
|
||||
they can race prompt admission. This backstop is a successful server-owned
|
||||
settle, not cancellation or transport failure: Android completes the local
|
||||
stream, keeps the durable session identity, performs bounded identity-fenced
|
||||
history reconciliation, and never resubmits through API fallback. Cold open
|
||||
continues to use `session.resume`; an authoritative resume rejection remains
|
||||
visible and cannot create or switch to a replacement context.
|
||||
**Decision.** A Gateway turn may settle from `session.activate`, exact-session
|
||||
`session.info`, or an exact live/durable `session.active_list` row only when the
|
||||
turn is Android-owned, has already received turn-scoped activity, and upstream
|
||||
reports `running=false` or Idle. The active-list request captures the exact turn
|
||||
and its progress generation; a session/profile switch, cancellation, newer turn,
|
||||
or intervening live event rejects the delayed snapshot. Pre-start idle snapshots
|
||||
and passively observed Desktop/TUI turns are never eligible. This backstop is a
|
||||
successful server-owned settle, not cancellation or transport failure: Android
|
||||
completes the local stream, keeps the durable session identity, performs bounded
|
||||
identity-fenced history reconciliation, consumes one late terminal without
|
||||
double-completion, and never resubmits through API fallback. A locally queued
|
||||
correction drains once through its existing owner chain after settlement. Cold
|
||||
open continues to use `session.resume`; an authoritative resume rejection
|
||||
remains visible and cannot create or switch to a replacement context.
|
||||
|
||||
The recovery writes one bounded content-free diagnostic containing only route,
|
||||
missing-terminal phase, and reconciliation action. It records no prompt or
|
||||
@@ -4291,3 +4304,95 @@ API-only/headless clients, compatibility testing, and existing API records, but
|
||||
they are no longer automatic recovery for standard Chat. Users retry or sign in
|
||||
without losing local work, named profiles cannot cross databases silently, and
|
||||
readiness reflects the conversation that will actually receive the next turn.
|
||||
|
||||
---
|
||||
|
||||
## ADR 72 — Plugin and CLI+UI release tags are approval-created
|
||||
|
||||
**Status:** Accepted (2026-09-01).
|
||||
|
||||
**Context.** Plugin and CLI+UI tag workflows correctly rejected stable tags
|
||||
outside `main` and prerelease tags outside `dev`, but that validation occurred
|
||||
only after an operator pushed the tag. The CLI+UI release recipe also told
|
||||
operators to tag a prerelease from `main`, contradicting the canonical branch
|
||||
contract. A rejected tag therefore left a failed check on an otherwise healthy
|
||||
release commit and required destructive tag recovery before publication.
|
||||
|
||||
**Decision.** The normal Plugin and CLI+UI release path validates first and
|
||||
creates the tag second. A single manual approval workflow:
|
||||
|
||||
- always runs the trusted workflow definition from `main`, then selects the
|
||||
exact `origin/main` tip for stable versions or `origin/dev` for prereleases;
|
||||
- verifies the surface-owned version metadata and matching changelog heading;
|
||||
- refuses an existing tag, then creates the exact `server-v*` or `desktop-v*`
|
||||
ref at the validated commit; and
|
||||
- dispatches the trusted release workflow from `main`, whose jobs explicitly
|
||||
check out and revalidate that immutable tag.
|
||||
|
||||
Direct tag pushes remain a recovery path and retain the same fail-closed
|
||||
metadata and branch-containment checks. Approval does not weaken release tests,
|
||||
change stable/prerelease source branches, or combine the independently
|
||||
versioned Plugin and CLI+UI artifacts.
|
||||
|
||||
**Consequences.** Routine releases cannot create a known-invalid tag before
|
||||
discovering a branch mismatch. A tag created with `GITHUB_TOKEN` does not
|
||||
recursively trigger Actions, so approval explicitly dispatches the release
|
||||
workflow and the release workflow supports both tag-push and approved-dispatch
|
||||
events. The workflow must exist on `main` before the approval surface is used.
|
||||
|
||||
**Key files:**
|
||||
|
||||
- `.github/workflows/approve-release-extensions.yml`
|
||||
- `.github/workflows/release-plugin.yml`
|
||||
- `.github/workflows/release-cli.yml`
|
||||
- `RELEASE.md`
|
||||
|
||||
---
|
||||
|
||||
## ADR 73 — Release promotion reuses immutable exact-tree evidence
|
||||
|
||||
**Status:** Accepted (2026-09-01).
|
||||
|
||||
**Context.** A coordinated release previously compiled Android up to four
|
||||
times: local release verification, release-prep PR CI, private Play preflight,
|
||||
and public tag publication. The canonical `dev` to `main` PR also repeated the
|
||||
same path-aware matrix even when its synthetic merge produced the exact Git
|
||||
tree already tested before integration. Rebuilding identical source increased
|
||||
elapsed time without adding byte-level provenance.
|
||||
|
||||
**Decision.** Release evidence is content-addressed by Git tree and promoted
|
||||
only through immutable GitHub Actions artifacts.
|
||||
|
||||
- Play preflight is the one stable Android signing/build authority. It stores
|
||||
the exact signed sideload APK, Play AAB, both R8 mappings, a manifest with
|
||||
version/commit/tree/size/hash metadata, and checksums for public assets.
|
||||
- Stable Android publication downloads that artifact by immutable ID, verifies
|
||||
its successful trusted workflow run and full manifest, reruns package-level
|
||||
DEX/native checks, promotes the existing Play draft, and publishes the same
|
||||
APK/AAB bytes. Prerelease candidates retain their independent build path.
|
||||
- Every successful Required-checks run stores a small tree-keyed proof after
|
||||
all selected jobs pass. A canonical `dev` to `main` PR may reuse it only when
|
||||
the simulated merge tree equals the `dev` tree exactly. Missing proof or any
|
||||
content change automatically runs the ordinary matrix.
|
||||
- Local Android release iteration runs metadata and release-presentation tests;
|
||||
exact pushed commits still require CI and Play preflight.
|
||||
- A coordinated approval workflow dispatches independently validated surface
|
||||
approvals concurrently; it does not combine tags or artifact contracts.
|
||||
- Trusted desktop CI and the CLI+UI release workflow share a lockfile- and
|
||||
exact-source-keyed Rust/Tauri target cache. Release tags may restore the
|
||||
default branch's exact build state; cache misses retain the full build path.
|
||||
|
||||
**Consequences.** Stable Android bytes are built once, evidence reuse fails
|
||||
closed on tree or hash drift, and release PRs avoid duplicate work without
|
||||
weakening branch protection. Actions artifact retention becomes part of the
|
||||
release window: expired evidence causes a safe rebuild/fallback, never an
|
||||
approval bypass.
|
||||
|
||||
**Key files:**
|
||||
|
||||
- `.github/workflows/play-preflight-android.yml`
|
||||
- `.github/workflows/release-android.yml`
|
||||
- `.github/workflows/ci-required.yml`
|
||||
- `.github/workflows/approve-release-train.yml`
|
||||
- `scripts/android_release_artifacts.py`
|
||||
- `scripts/android-prepush.py`
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "t_sub", "x": 120, "y": 88, "width": 960, "height": 22,
|
||||
"text": "Chat, Manage & Voice run on a plain Hermes agent. The optional Relay plugin adds Terminal, Bridge & desktop tools.",
|
||||
"originalText": "Chat, Manage & Voice run on a plain Hermes agent. The optional Relay plugin adds Terminal, Bridge & desktop tools.",
|
||||
"text": "One standard path. Optional extensions when you want more.",
|
||||
"originalText": "One standard path. Optional extensions when you want more.",
|
||||
"fontSize": 14, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
{
|
||||
"type": "text", "id": "z_machine", "x": 120, "y": 168, "width": 220, "height": 18,
|
||||
"text": "YOUR MACHINE", "originalText": "YOUR MACHINE",
|
||||
"text": "YOUR HERMES HOST", "originalText": "YOUR HERMES HOST",
|
||||
"fontSize": 13, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#94a3b8", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -46,23 +46,23 @@
|
||||
|
||||
{
|
||||
"type": "rectangle", "id": "r_hermes", "x": 110, "y": 200, "width": 290, "height": 132,
|
||||
"strokeColor": "#334155", "backgroundColor": "#eef2f7", "fillStyle": "solid",
|
||||
"strokeColor": "#1e3a5f", "backgroundColor": "#dbeafe", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100010, "version": 1, "versionNonce": 10, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "roundness": { "type": 3 }
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_hermes1", "x": 132, "y": 240, "width": 250, "height": 28,
|
||||
"text": "Hermes agent", "originalText": "Hermes agent",
|
||||
"fontSize": 22, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"type": "text", "id": "tx_hermes1", "x": 132, "y": 230, "width": 250, "height": 50,
|
||||
"text": "Hermes Dashboard\n+ Gateway", "originalText": "Hermes Dashboard\n+ Gateway",
|
||||
"fontSize": 18, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#1e293b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100011, "version": 1, "versionNonce": 11, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_hermes2", "x": 132, "y": 278, "width": 250, "height": 18,
|
||||
"text": "the platform on your machine", "originalText": "the platform on your machine",
|
||||
"type": "text", "id": "tx_hermes2", "x": 132, "y": 294, "width": 250, "height": 18,
|
||||
"text": "standard upstream connection", "originalText": "standard upstream connection",
|
||||
"fontSize": 13, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -72,23 +72,23 @@
|
||||
|
||||
{
|
||||
"type": "rectangle", "id": "r_plugin", "x": 110, "y": 404, "width": 290, "height": 120,
|
||||
"strokeColor": "#6b4fb0", "backgroundColor": "#efeafb", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "#ddd6fe", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "dashed", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100020, "version": 1, "versionNonce": 20, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "roundness": { "type": 3 }
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_plugin1", "x": 132, "y": 430, "width": 250, "height": 24,
|
||||
"text": "+ Relay plugin", "originalText": "+ Relay plugin",
|
||||
"text": "Relay plugin", "originalText": "Relay plugin",
|
||||
"fontSize": 18, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#5b3fa0", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100021, "version": 1, "versionNonce": 21, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_plugin2", "x": 132, "y": 464, "width": 250, "height": 16,
|
||||
"text": "optional · install on your", "originalText": "optional · install on your",
|
||||
"text": "optional extensions +", "originalText": "optional extensions +",
|
||||
"fontSize": 12, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -97,7 +97,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_plugin3", "x": 132, "y": 484, "width": 250, "height": 16,
|
||||
"text": "Hermes host, then pair", "originalText": "Hermes host, then pair",
|
||||
"text": "paired tools", "originalText": "paired tools",
|
||||
"fontSize": 12, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -107,15 +107,15 @@
|
||||
|
||||
{
|
||||
"type": "rectangle", "id": "r_app", "x": 1010, "y": 298, "width": 300, "height": 150,
|
||||
"strokeColor": "#334155", "backgroundColor": "#eef2f7", "fillStyle": "solid",
|
||||
"strokeColor": "#1e3a5f", "backgroundColor": "#dbeafe", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100030, "version": 1, "versionNonce": 30, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "roundness": { "type": 3 }
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_app1", "x": 1032, "y": 346, "width": 260, "height": 28,
|
||||
"text": "Hermes-Relay app", "originalText": "Hermes-Relay app",
|
||||
"fontSize": 22, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"text": "Hermes-Relay Android", "originalText": "Hermes-Relay Android",
|
||||
"fontSize": 18, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#1e293b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100031, "version": 1, "versionNonce": 31, "isDeleted": false, "groupIds": [],
|
||||
@@ -123,7 +123,7 @@
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_app2", "x": 1032, "y": 384, "width": 260, "height": 18,
|
||||
"text": "your Android phone", "originalText": "your Android phone",
|
||||
"text": "Google Play or sideload APK", "originalText": "Google Play or sideload APK",
|
||||
"fontSize": 13, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -133,16 +133,16 @@
|
||||
|
||||
{
|
||||
"type": "rectangle", "id": "r_sideload", "x": 1010, "y": 460, "width": 300, "height": 40,
|
||||
"strokeColor": "#c2820c", "backgroundColor": "#fdf3e0", "fillStyle": "solid",
|
||||
"strokeColor": "#c2410c", "backgroundColor": "#fed7aa", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100040, "version": 1, "versionNonce": 40, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "roundness": { "type": 3 }
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_sideload", "x": 1022, "y": 472, "width": 276, "height": 16,
|
||||
"text": "Device Control needs the sideload build", "originalText": "Device Control needs the sideload build",
|
||||
"text": "Sideload adds Device Control", "originalText": "Sideload adds Device Control",
|
||||
"fontSize": 12, "fontFamily": 3, "textAlign": "center", "verticalAlign": "middle",
|
||||
"strokeColor": "#9a6313", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#c2410c", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100041, "version": 1, "versionNonce": 41, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
@@ -150,23 +150,23 @@
|
||||
|
||||
{
|
||||
"type": "rectangle", "id": "r_cli", "x": 1040, "y": 524, "width": 240, "height": 72,
|
||||
"strokeColor": "#6b4fb0", "backgroundColor": "#efeafb", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "#ddd6fe", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "dashed", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100050, "version": 1, "versionNonce": 50, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "roundness": { "type": 3 }
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_cli1", "x": 1058, "y": 540, "width": 200, "height": 22,
|
||||
"text": "Relay CLI", "originalText": "Relay CLI",
|
||||
"text": "Hermes-Relay CLI", "originalText": "Hermes-Relay CLI",
|
||||
"fontSize": 16, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#5b3fa0", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100051, "version": 1, "versionNonce": 51, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_cli2", "x": 1058, "y": 566, "width": 214, "height": 16,
|
||||
"text": "the agent's hands on any computer", "originalText": "the agent's hands on any computer",
|
||||
"text": "Hands on any paired computer", "originalText": "Hands on any paired computer",
|
||||
"fontSize": 11, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -176,7 +176,7 @@
|
||||
|
||||
{
|
||||
"type": "arrow", "id": "a_vanilla", "x": 400, "y": 266, "width": 610, "height": 78,
|
||||
"strokeColor": "#167a6e", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#047857", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 3, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100060, "version": 1, "versionNonce": 60, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false,
|
||||
@@ -185,25 +185,25 @@
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_van_label", "x": 470, "y": 192, "width": 470, "height": 20,
|
||||
"text": "VANILLA HERMES · no plugin needed", "originalText": "VANILLA HERMES · no plugin needed",
|
||||
"text": "STANDARD PATH", "originalText": "STANDARD PATH",
|
||||
"fontSize": 15, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#167a6e", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#047857", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100061, "version": 1, "versionNonce": 61, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_van_feats", "x": 470, "y": 218, "width": 400, "height": 24,
|
||||
"text": "Chat · Manage · Voice", "originalText": "Chat · Manage · Voice",
|
||||
"text": "Chat · Sessions · Manage · Voice", "originalText": "Chat · Sessions · Manage · Voice",
|
||||
"fontSize": 18, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#0f5750", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#047857", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100062, "version": 1, "versionNonce": 62, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_van_ports", "x": 470, "y": 248, "width": 360, "height": 16,
|
||||
"text": "dashboard :9119 · API :8642", "originalText": "dashboard :9119 · API :8642",
|
||||
"text": "Direct Dashboard/Gateway connection", "originalText": "Direct Dashboard/Gateway connection",
|
||||
"fontSize": 11, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#94a3b8", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
@@ -213,7 +213,7 @@
|
||||
|
||||
{
|
||||
"type": "arrow", "id": "a_relay_app", "x": 400, "y": 452, "width": 610, "height": 44,
|
||||
"strokeColor": "#6b4fb0", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "dashed", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100070, "version": 1, "versionNonce": 70, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false,
|
||||
@@ -222,7 +222,7 @@
|
||||
},
|
||||
{
|
||||
"type": "arrow", "id": "a_relay_cli", "x": 400, "y": 486, "width": 640, "height": 74,
|
||||
"strokeColor": "#6b4fb0", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 2, "strokeStyle": "dashed", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100071, "version": 1, "versionNonce": 71, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false,
|
||||
@@ -231,30 +231,64 @@
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_rel_label", "x": 470, "y": 350, "width": 470, "height": 20,
|
||||
"text": "+ RELAY PLUGIN · pair to unlock", "originalText": "+ RELAY PLUGIN · pair to unlock",
|
||||
"text": "OPTIONAL RELAY", "originalText": "OPTIONAL RELAY",
|
||||
"fontSize": 15, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#6b4fb0", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100072, "version": 1, "versionNonce": 72, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_rel_feats", "x": 470, "y": 376, "width": 540, "height": 22,
|
||||
"text": "Terminal · Bridge · Relay voice · Desktop tools", "originalText": "Terminal · Bridge · Relay voice · Desktop tools",
|
||||
"fontSize": 16, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#4b2f88", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"text": "Terminal · Media · Notifications · Enhanced voice", "originalText": "Terminal · Media · Notifications · Enhanced voice",
|
||||
"fontSize": 15, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#6d28d9", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100073, "version": 1, "versionNonce": 73, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "tx_rel_ports", "x": 470, "y": 406, "width": 300, "height": 16,
|
||||
"text": "WSS :8767", "originalText": "WSS :8767",
|
||||
"text": "Paired and scoped by feature", "originalText": "Paired and scoped by feature",
|
||||
"fontSize": 11, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#94a3b8", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100074, "version": 1, "versionNonce": 74, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "line", "id": "guarantee_line", "x": 110, "y": 636, "width": 1200, "height": 0,
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100080, "version": 1, "versionNonce": 80, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "points": [[0, 0], [1200, 0]]
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "guarantee_chat", "x": 120, "y": 658, "width": 330, "height": 20,
|
||||
"text": "Chat never routes through Relay", "originalText": "Chat never routes through Relay",
|
||||
"fontSize": 14, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#047857", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100081, "version": 1, "versionNonce": 81, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "guarantee_api", "x": 510, "y": 658, "width": 360, "height": 20,
|
||||
"text": "API server is compatibility fallback only", "originalText": "API server is compatibility fallback only",
|
||||
"fontSize": 14, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#64748b", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100082, "version": 1, "versionNonce": 82, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
},
|
||||
{
|
||||
"type": "text", "id": "guarantee_device", "x": 930, "y": 658, "width": 380, "height": 20,
|
||||
"text": "Device Control requires Relay + sideload", "originalText": "Device Control requires Relay + sideload",
|
||||
"fontSize": 14, "fontFamily": 3, "textAlign": "left", "verticalAlign": "top",
|
||||
"strokeColor": "#c2410c", "backgroundColor": "transparent", "fillStyle": "solid",
|
||||
"strokeWidth": 1, "strokeStyle": "solid", "roughness": 0, "opacity": 100, "angle": 0,
|
||||
"seed": 100083, "version": 1, "versionNonce": 83, "isDeleted": false, "groupIds": [],
|
||||
"boundElements": null, "link": null, "locked": false, "containerId": null, "lineHeight": 1.25
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 168 KiB After Width: | Height: | Size: 542 KiB |