Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Android/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]*}))

Expand Down
2 changes: 1 addition & 1 deletion App/StatusJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions Linux/Endpoints.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion Linux/MeshRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> {
["/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) {
Expand Down
17 changes: 14 additions & 3 deletions Linux/SetupRoutes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = []

static func here() -> SetupAnswer {
var answer = SetupMap.current(machine: StatusReport.machineName, servicePort: TokenmeterService.statusPort)
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion Linux/kde/app/AppVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion Linux/kde/plasmoid/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 8 additions & 1 deletion Linux/tests/mesh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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."
2 changes: 1 addition & 1 deletion build-library-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/package-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion scripts/package-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion scripts/package-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;;
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:-}

Expand Down
Loading