From e4b6a6726461b15bc2aa4b63d5dd2ecc2e6f19b1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 17:08:43 +0000 Subject: [PATCH 1/2] Setup page: another machine's picture reaches it (0.9.14) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picking another member on the Setup page showed "Asking…" for ever, on the Mac and on Linux: the member's service refused GET /mesh/setup/map from the network (403, "Other machines can read /status and /metrics only"), since that path was missing from the paths other machines may ask for. /mesh/models, which the Models page reads from members the same way, had the same gap. Both are now let through (their handlers still check the member's signature) and may be relayed through another member, for machines only reachable that way. While a member doesn't answer, the page now says so ("isn't answering, I'll keep asking") instead of "Asking…" with nothing after it. Linux/tests/mesh.sh reads ada's Setup page from bo directly and from cy through bo, and checks a stranger still can't read either path. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EE8zW7URxt26sM521VJyiZ Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com> --- Android/build.sh | 2 +- App/StatusJSON.swift | 2 +- Linux/Endpoints.swift | 2 ++ Linux/MeshRoutes.swift | 3 ++- Linux/SetupRoutes.swift | 17 ++++++++++++++--- Linux/kde/app/AppVersion.js | 2 +- Linux/kde/plasmoid/metadata.json | 2 +- Linux/tests/mesh.sh | 9 ++++++++- build-library-app.sh | 2 +- scripts/package-flatpak.sh | 2 +- scripts/package-linux.sh | 2 +- scripts/package-service.sh | 2 +- scripts/package.sh | 2 +- 13 files changed, 35 insertions(+), 14 deletions(-) diff --git a/Android/build.sh b/Android/build.sh index 59cf91d7..76d8a966 100755 --- a/Android/build.sh +++ b/Android/build.sh @@ -24,7 +24,7 @@ platform=${ANDROID_PLATFORM:-35} jar=$sdk/platforms/android-$platform/android.jar [ -f "$jar" ] || { echo "No $jar: install the platform with sdkmanager \"platforms;android-$platform\"." >&2; exit 1; } tools=$(ls -d "$sdk"/build-tools/* | sort -V | tail -1) -version=${APP_VERSION:-0.9.13} +version=${APP_VERSION:-0.9.14} IFS=. read -r major minor patch <<<"$version.0.0" code=$((major * 10000 + minor * 100 + ${patch%%[^0-9]*})) diff --git a/App/StatusJSON.swift b/App/StatusJSON.swift index eb0f3b76..1d45e6b6 100644 --- a/App/StatusJSON.swift +++ b/App/StatusJSON.swift @@ -440,7 +440,7 @@ struct LocalResponse { extension StatusReport { /// Tokenmeter's version. The Mac app reads it from its Info.plist, which build-library-app.sh writes; the /// Linux service has no Info.plist, so it uses `releaseVersion`. Keep that in step with the build scripts. - static let releaseVersion = "0.9.13" + static let releaseVersion = "0.9.14" static var appVersion: String { Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? releaseVersion } diff --git a/Linux/Endpoints.swift b/Linux/Endpoints.swift index c9090732..f8d7d66a 100644 --- a/Linux/Endpoints.swift +++ b/Linux/Endpoints.swift @@ -29,6 +29,8 @@ final class StatusEndpoint { "/mesh/install.sh", "/mesh/package", // What members ask each other about updates; the handlers check the signature. "/mesh/update", "/mesh/update/package", "/mesh/tools/process", + // Another member's Setup page and Models page; the handlers check the signature. + "/mesh/setup/map", "/mesh/models", // Standard runs between members; the handlers check the signature. BenchMesh.path, // Asked for with the agents' key, which their handlers check. diff --git a/Linux/MeshRoutes.swift b/Linux/MeshRoutes.swift index 6bf225a6..e6f53591 100644 --- a/Linux/MeshRoutes.swift +++ b/Linux/MeshRoutes.swift @@ -16,7 +16,8 @@ enum MeshRoutes { /// What a member may read of another through this one: what members read of each other. @MainActor static var relayed: Set { ["/status", "/metrics", SharedHistory.path, MachineHistory.path, SharedInsights.path, SharedRoom.path, - "/mesh/update", "/mesh/update/package", "/mesh/tools/process", BenchMesh.path] + "/mesh/update", "/mesh/update/package", "/mesh/tools/process", "/mesh/setup/map", "/mesh/models", + BenchMesh.path] } @MainActor static func start(port: Int) { diff --git a/Linux/SetupRoutes.swift b/Linux/SetupRoutes.swift index 47cef3d8..3df7055d 100644 --- a/Linux/SetupRoutes.swift +++ b/Linux/SetupRoutes.swift @@ -14,6 +14,8 @@ import FoundationNetworking enum SetupRoutes { private static var remote: [String: SetupAnswer] = [:] private static var asked: [String: Date] = [:] + /// Members that didn't answer the last time they were asked, so the page says so instead of "Asking…". + private static var silent: Set = [] static func here() -> SetupAnswer { var answer = SetupMap.current(machine: StatusReport.machineName, servicePort: TokenmeterService.statusPort) @@ -34,12 +36,21 @@ enum SetupRoutes { if (asked[machine].map { Date().timeIntervalSince($0) > 10 } ?? true) { asked[machine] = Date() Task { @MainActor in - if let got = await fetch(machine) { remote[machine] = got } + if let got = await fetch(machine) { + remote[machine] = got + silent.remove(machine) + } else { + silent.insert(machine) + } } } + let quiet = silent.contains(machine) var answer = remote[machine] ?? SetupAnswer(machine: member.name, sheet: SetupSheet(), seen: 0, lines: 0, improve: 0, - gizmo: "Asking \(member.name)…", mood: "content", cards: [], - empty: "Asking \(member.name) how its agents are set up…", at: Date().timeIntervalSince1970) + gizmo: quiet ? "\(member.name) isn't answering. I'll keep asking." : "Asking \(member.name)…", + mood: quiet ? "concerned" : "content", cards: [], + empty: quiet ? "\(member.name) didn't answer. Is Tokenmeter running there, and up to date?" + : "Asking \(member.name) how its agents are set up…", + at: Date().timeIntervalSince1970) answer.machineID = machine answer.machine = member.name answer.machines = choices() diff --git a/Linux/kde/app/AppVersion.js b/Linux/kde/app/AppVersion.js index 87bdc170..1d09cd58 100644 --- a/Linux/kde/app/AppVersion.js +++ b/Linux/kde/app/AppVersion.js @@ -3,4 +3,4 @@ // update keeps saying the version it is, while the service reports its own (backend.snapshot.version). // scripts/package-linux.sh and package-flatpak.sh write it from the package's version; keep it in step with // StatusReport.releaseVersion when bumping (a unit test checks it). -var version = "0.9.13" +var version = "0.9.14" diff --git a/Linux/kde/plasmoid/metadata.json b/Linux/kde/plasmoid/metadata.json index ff060cb1..8a841141 100644 --- a/Linux/kde/plasmoid/metadata.json +++ b/Linux/kde/plasmoid/metadata.json @@ -7,7 +7,7 @@ "Icon": "tokenmeter", "Category": "System Information", "License": "Apache-2.0", - "Version": "0.9.13", + "Version": "0.9.14", "Website": "https://github.com/tokenmeter1/Tokenmeter" }, "X-Plasma-API-Minimum-Version": "6.0", diff --git a/Linux/tests/mesh.sh b/Linux/tests/mesh.sh index 710cd265..d47c29d9 100644 --- a/Linux/tests/mesh.sh +++ b/Linux/tests/mesh.sh @@ -99,6 +99,13 @@ until_is $ada/mesh "$online" "['ada', 'bo', 'cy']" "ada doesn't see cy online" # cy can't reach ada, so it reads it through bo and says so. until_is $cy/mesh '[(m["online"], m["via"]) for m in d["members"] if m["name"] == "ada"]' "[(True, 'bo')]" "cy doesn't read ada through bo" until_is $cy/machines 'sorted((m["report"]["host"], m.get("via")) for m in d["machines"] if m["online"])' "[('ada', 'bo'), ('bo', None)]" "cy's list of machines" +# The Setup page and the Models page read another member: bo straight from ada, cy through bo. +member_id() { curl -sf "$1/mesh" | field "[m[\"id\"] for m in d[\"members\"] if m[\"name\"] == \"$2\"][0]"; } +ada_id=$(member_id $bo ada) +until_is "$bo/setup/map?machine=$ada_id" 'd["machine"], d["remote"], not d["gizmo"].startswith("Asking") and "answering" not in d["gizmo"]' "('ada', True, True)" "bo's Setup page never heard from ada" +until_is "$cy/setup/map?machine=$(member_id $cy ada)" 'd["machine"], d["remote"], not d["gizmo"].startswith("Asking") and "answering" not in d["gizmo"]' "('ada', True, True)" "cy's Setup page never heard from ada through bo" +if curl -sf -m 3 "http://$address:7761/mesh/setup/map" >/dev/null; then fail "a stranger read the Setup page"; fi +if curl -sf -m 3 "http://$address:7761/mesh/models" >/dev/null; then fail "a stranger read the Models page"; fi # di asks cy. Ignored there, it is in everyone's Ignored list, and bo can allow it after all. HOME="$work/di" "$tokenmeter" mesh --port 7764 | grep -q "Found on this network" || fail "tokenmeter mesh doesn't list what it found" @@ -118,4 +125,4 @@ until_is $cy/mesh "$names" "['ada', 'bo', 'cy']" "cy didn't hear di was removed" until_is $di/mesh "$names" "['di']" "di didn't learn it was removed" until_is $ada/machines 'sorted(m["report"]["host"] for m in d["machines"] if m["online"])' "['bo', 'cy']" "ada's list of machines after removing di" if curl -sf -X POST $ada/mesh -d '{}' >/dev/null; then fail "an empty decision was taken"; fi -echo "The mesh: finding each other, asking, Not Now, allowing, being added, passing the list on, members' history, Ignore and allowing after all, reading through another member, removing: all as expected." +echo "The mesh: finding each other, asking, Not Now, allowing, being added, passing the list on, members' history, Ignore and allowing after all, reading through another member, the Setup page of another member, removing: all as expected." diff --git a/build-library-app.sh b/build-library-app.sh index 2e742583..00b486a0 100755 --- a/build-library-app.sh +++ b/build-library-app.sh @@ -18,7 +18,7 @@ for word in "$@"; do esac done app="$project_dir/Tokenmeter.app" -version=${APP_VERSION:-0.9.13} +version=${APP_VERSION:-0.9.14} build=${APP_BUILD:-1} # SwiftUI's @State is a compiler macro in the macOS 26 SDK. The Command Line Tools ship that SDK without diff --git a/scripts/package-flatpak.sh b/scripts/package-flatpak.sh index b1a394a8..35ab0f6f 100755 --- a/scripts/package-flatpak.sh +++ b/scripts/package-flatpak.sh @@ -7,7 +7,7 @@ # Needs flatpak and flatpak-builder; the KDE runtime and SDK are fetched from Flathub. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.13} +version=${APP_VERSION:-0.9.14} arch=$(uname -m) id=io.github.tokenmeter1.tokenmeter name="Tokenmeter-$version-linux-$arch" diff --git a/scripts/package-linux.sh b/scripts/package-linux.sh index f5f7995f..d1f72f1c 100755 --- a/scripts/package-linux.sh +++ b/scripts/package-linux.sh @@ -4,7 +4,7 @@ # and install.sh. Needs the Swift toolchain; run it on Linux. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.13} +version=${APP_VERSION:-0.9.14} arch=$(uname -m) name="Tokenmeter-$version-linux-$arch" diff --git a/scripts/package-service.sh b/scripts/package-service.sh index d8378bae..70427745 100755 --- a/scripts/package-service.sh +++ b/scripts/package-service.sh @@ -18,7 +18,7 @@ # On a Mac, SIGN_IDENTITY signs the program with a Developer ID; without it the program is ad-hoc signed. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.13} +version=${APP_VERSION:-0.9.14} case "$(uname -s)" in Darwin) os=macos ;; Linux) os=linux ;; diff --git a/scripts/package.sh b/scripts/package.sh index 315ce0b7..d5af922a 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -16,7 +16,7 @@ set -euo pipefail project_dir=${0:A:h:h} app="$project_dir/Tokenmeter.app" dist="$project_dir/dist" -export APP_VERSION=${APP_VERSION:-0.9.13} +export APP_VERSION=${APP_VERSION:-0.9.14} identity=${SIGN_IDENTITY:-} profile=${NOTARY_PROFILE:-} From d81a63ee1c7fb68756c30af3b91c9dbc10032888 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 1 Dec 2026 18:11:02 +0000 Subject: [PATCH 2/2] Version 0.9.15 (0.9.14 went to the pinned strip) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EE8zW7URxt26sM521VJyiZ Co-Authored-By: tokenmeter1 <358883051+tokenmeter1@users.noreply.github.com> --- Android/build.sh | 2 +- App/StatusJSON.swift | 2 +- Linux/kde/app/AppVersion.js | 2 +- Linux/kde/plasmoid/metadata.json | 2 +- build-library-app.sh | 2 +- scripts/package-flatpak.sh | 2 +- scripts/package-linux.sh | 2 +- scripts/package-service.sh | 2 +- scripts/package.sh | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Android/build.sh b/Android/build.sh index 76d8a966..4e142d10 100755 --- a/Android/build.sh +++ b/Android/build.sh @@ -24,7 +24,7 @@ platform=${ANDROID_PLATFORM:-35} jar=$sdk/platforms/android-$platform/android.jar [ -f "$jar" ] || { echo "No $jar: install the platform with sdkmanager \"platforms;android-$platform\"." >&2; exit 1; } tools=$(ls -d "$sdk"/build-tools/* | sort -V | tail -1) -version=${APP_VERSION:-0.9.14} +version=${APP_VERSION:-0.9.15} IFS=. read -r major minor patch <<<"$version.0.0" code=$((major * 10000 + minor * 100 + ${patch%%[^0-9]*})) diff --git a/App/StatusJSON.swift b/App/StatusJSON.swift index 1d45e6b6..ae5ff2e1 100644 --- a/App/StatusJSON.swift +++ b/App/StatusJSON.swift @@ -440,7 +440,7 @@ struct LocalResponse { extension StatusReport { /// Tokenmeter's version. The Mac app reads it from its Info.plist, which build-library-app.sh writes; the /// Linux service has no Info.plist, so it uses `releaseVersion`. Keep that in step with the build scripts. - static let releaseVersion = "0.9.14" + static let releaseVersion = "0.9.15" static var appVersion: String { Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? releaseVersion } diff --git a/Linux/kde/app/AppVersion.js b/Linux/kde/app/AppVersion.js index 1d09cd58..171afd28 100644 --- a/Linux/kde/app/AppVersion.js +++ b/Linux/kde/app/AppVersion.js @@ -3,4 +3,4 @@ // update keeps saying the version it is, while the service reports its own (backend.snapshot.version). // scripts/package-linux.sh and package-flatpak.sh write it from the package's version; keep it in step with // StatusReport.releaseVersion when bumping (a unit test checks it). -var version = "0.9.14" +var version = "0.9.15" diff --git a/Linux/kde/plasmoid/metadata.json b/Linux/kde/plasmoid/metadata.json index 8a841141..947738b6 100644 --- a/Linux/kde/plasmoid/metadata.json +++ b/Linux/kde/plasmoid/metadata.json @@ -7,7 +7,7 @@ "Icon": "tokenmeter", "Category": "System Information", "License": "Apache-2.0", - "Version": "0.9.14", + "Version": "0.9.15", "Website": "https://github.com/tokenmeter1/Tokenmeter" }, "X-Plasma-API-Minimum-Version": "6.0", diff --git a/build-library-app.sh b/build-library-app.sh index 00b486a0..d2809eb8 100755 --- a/build-library-app.sh +++ b/build-library-app.sh @@ -18,7 +18,7 @@ for word in "$@"; do esac done app="$project_dir/Tokenmeter.app" -version=${APP_VERSION:-0.9.14} +version=${APP_VERSION:-0.9.15} build=${APP_BUILD:-1} # SwiftUI's @State is a compiler macro in the macOS 26 SDK. The Command Line Tools ship that SDK without diff --git a/scripts/package-flatpak.sh b/scripts/package-flatpak.sh index 35ab0f6f..765cbc36 100755 --- a/scripts/package-flatpak.sh +++ b/scripts/package-flatpak.sh @@ -7,7 +7,7 @@ # Needs flatpak and flatpak-builder; the KDE runtime and SDK are fetched from Flathub. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.14} +version=${APP_VERSION:-0.9.15} arch=$(uname -m) id=io.github.tokenmeter1.tokenmeter name="Tokenmeter-$version-linux-$arch" diff --git a/scripts/package-linux.sh b/scripts/package-linux.sh index d1f72f1c..2b763281 100755 --- a/scripts/package-linux.sh +++ b/scripts/package-linux.sh @@ -4,7 +4,7 @@ # and install.sh. Needs the Swift toolchain; run it on Linux. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.14} +version=${APP_VERSION:-0.9.15} arch=$(uname -m) name="Tokenmeter-$version-linux-$arch" diff --git a/scripts/package-service.sh b/scripts/package-service.sh index 70427745..49b04cf7 100755 --- a/scripts/package-service.sh +++ b/scripts/package-service.sh @@ -18,7 +18,7 @@ # On a Mac, SIGN_IDENTITY signs the program with a Developer ID; without it the program is ad-hoc signed. set -eu project_dir=$(cd "$(dirname "$0")/.." && pwd) -version=${APP_VERSION:-0.9.14} +version=${APP_VERSION:-0.9.15} case "$(uname -s)" in Darwin) os=macos ;; Linux) os=linux ;; diff --git a/scripts/package.sh b/scripts/package.sh index d5af922a..faa91b62 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -16,7 +16,7 @@ set -euo pipefail project_dir=${0:A:h:h} app="$project_dir/Tokenmeter.app" dist="$project_dir/dist" -export APP_VERSION=${APP_VERSION:-0.9.14} +export APP_VERSION=${APP_VERSION:-0.9.15} identity=${SIGN_IDENTITY:-} profile=${NOTARY_PROFILE:-}