diff --git a/Android/build.sh b/Android/build.sh index 76d8a96..4e142d1 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 1d45e6b..ae5ff2e 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/Endpoints.swift b/Linux/Endpoints.swift index c909073..f8d7d66 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 6bf225a..e6f5359 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 47cef3d..3df7055 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 1d09cd5..171afd2 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 8a84114..947738b 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/Linux/tests/mesh.sh b/Linux/tests/mesh.sh index 710cd26..d47c29d 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 00b486a..d2809eb 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 35ab0f6..765cbc3 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 d1f72f1..2b76328 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 7042774..49b04cf 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 d5af922..faa91b6 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:-}