Skip to content

Use core v0.48.0 - #202

Merged
fylorn merged 1 commit into
devfrom
chore/core-v0.48.0
Sep 25, 2026
Merged

fylorn merged 1 commit into
devfrom
chore/core-v0.48.0

Conversation

@fylorn

@fylorn fylorn commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

What this changes

Pins ThinkWatch Core v0.48.0 (control API 21) and adapts the app to its protocol changes, keeping the current UI:

  • In-flight snapshot. GET /in-flight now answers { now_ms, requests: [{ id, events }] }. The traffic list (applyInFlight), the overview's in-flight count, the routing map (useFlights) and the upstreams' per-upstream count replay each running request's events through their existing reducers. A page opened mid-request now shows the status code, the serving upstream and the whole routing path, where it used to know only the start.
  • Sessions from the start. request_started.session is the stored session id, so RequestRow.session is set when the request starts and a running turn is grouped into its session at once (grouped traffic view). The history merge only fills a missing session.
  • Rule-refused requests are recorded now (empty upstream, no attempts). The traffic row and the drawer show "—" as the upstream, the row menu drops "only this upstream", and session headers skip the empty name. The drawer's Routing tab: routing is present for every non-local row, so empty attempts say "Routing has not finished yet" while running and "No upstream attempts were recorded for this request." afterwards; the "no routing" sentence now only covers local answers.
  • ChatGPT account. ChatgptUsage no longer carries email and plan. The upstream table and the account section label the row from ProviderView.oauth.account (read by core from the token, no upstream call). The page still calls ChatgptUsage once on open for the cold-start quota (useAccountQuotas). All 17 known plans get Codex's display names (team → Business, prolite → Pro, …); unknown words are shown as they come. The sign-in dialog labels the plan the same way.
  • Security log. SecurityEventsPage gains total and by_outcome; "load more" keeps the new page's values. The header is unchanged here.
  • Whitelist. The read-only RouteStats (GET /summary/routes) is added to call.rs ALLOWED and control.ts WEBVIEW_ENDPOINTS.
  • Menu bar. The running time is core's elapsed_ms rebased onto this machine's clock instead of at_ms compared with the local clock (they differ on a remote core).
  • Screenshot pipeline. The sample config's ChatGPT access token is a JWT carrying an email and a plan, so the oracle JSON (regenerated against v0.48.0) has oauth.account from real core; mocks follow the new shapes, including a RouteStats mock that counts rows like tw-store.

No new or changed message codes.

Why

Core v0.48.0 fills the protocol gaps the page redesigns ran into (ThinkWatch-Core#193, #195, #197). The breaking shape changes (/in-flight, session_fp → session, ChatgptUsage, CostBucketGroup, SecurityEventsPage, the routing view) have to land in one step with the pin, because the control handshake requires an exact API version.

How it was verified

  • pnpm typecheck, pnpm test (361 tests, new ones for snapshot replay, sessions at start, refused rows and plan labels), pnpm build.
  • cargo fmt --check, cargo clippy --all-targets -D warnings, cargo clippy --lib -D warnings, cargo test in src-tauri, with a twcore built from the v0.48.0 tag: the 7 control-plane tests complete the handshake against it; the ts_bindings and msg_codes checks pass.
  • Full preview harness updated to the new protocol, every page loaded in zh and en with no console errors. Checked in the DOM: the in-flight row replayed from the snapshot shows 200 and 1180→… on anthropic and sits inside its session when grouped; the routing map lights key → route → group → upstream (3 edges) for it right after opening; the refused request shows "—" and its Routing tab reads "Matched rule no-opus / No upstream attempts were recorded"; the ChatGPT row reads "Plus · dev@example.com" from oauth.account; SecurityEvents totals are equal on every page and add up by outcome.

🤖 Generated with Claude Code

…ats, ChatGPT account from the token

- Pin every tw-* crate to v0.48.0 (CONTROL_API_VERSION 21) and regenerate
  src/generated/tw-api.ts. No new or changed message codes.
- /in-flight is now { now_ms, requests: [{ id, events }] }. The traffic list
  (applyInFlight), the overview's in-flight count, the routing map (useFlights)
  and the upstreams' per-upstream count replay each request's events through
  their existing reducers, so a page opened mid-request shows the status code,
  the serving upstream and the whole routing path, not just the start.
- request_started carries the stored session id: RequestRow.session is set at
  the start, so a running turn is grouped into its session right away. The
  history merge only fills a missing session now.
- Rule-refused requests are stored rows with an empty upstream: the traffic
  table and drawer show "—" there, drop "only this upstream" for them, and
  session headers skip the empty name. The drawer's routing tab reads routing
  that is now present for every non-local row: empty attempts say "pending"
  while running and "no upstream attempts" afterwards; the "no routing" text
  only covers local answers.
- ChatgptUsage lost email and plan: the upstream table and the account section
  label ChatGPT upstreams from ProviderView.oauth.account. The page still asks
  ChatgptUsage once on open for the cold-start quota (useAccountQuotas). All 17
  known plans are labelled like Codex does; unknown words are shown as they are.
- SecurityEventsPage gains total and by_outcome; loading another page keeps
  the new page's totals.
- Whitelist the read-only RouteStats endpoint (call.rs ALLOWED and control.ts).
- Menu bar: running time comes from core's elapsed_ms rebased onto this
  machine's clock, not from comparing core's at_ms with the local clock.
- Screenshot pipeline: the ChatGPT account comes from a JWT in the sample
  config (oracle JSON regenerated against v0.48.0), mocks follow the new
  shapes, and a RouteStats mock counts rows like tw-store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn merged commit ca7a625 into dev Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the chore/core-v0.48.0 branch September 25, 2026 05:28
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn added a commit that referenced this pull request Sep 25, 2026
…hots (#201)

* docs: rewrite the READMEs for the current app and use the new screenshots

The READMEs showed screenshots of the old sidebar, including a Findings
page that no longer exists, and said nothing about connecting to a
remote core, the interface languages or the system tray. Both are
rewritten in the same structure, from what the code does today:

- An opening in the approved register, then the platforms, the
  interface languages and in-app updates.
- One section per page (Overview, Traffic, Clients, Keys, Upstreams,
  Routing, Security, MCP, Settings). Security is written from
  tw-config's guard defaults and built-in rules, MCP from tw-adopt's
  targets and tw-scan's sources, and the list of system notifications
  from src-tauri/src/notices/rules.rs.
- "Connecting to a remote core": Settings > Connection, the pages that
  always act on this machine (Clients, MCP), where the connection key
  is kept, what changes while connected; links to Core's server
  deployment guide.
- Layout: the control channel over a unix socket, a loopback port or a
  remote TCP port, each behind the Noise NNpsk0 handshake, replacing
  the per-launch credential the old text described.

Images now come from the committed pipeline: the zh README uses
docs/screenshots/zh/, the English one docs/screenshots/en/, both with
the light/dark <picture> switch, and the overview sits in the
introduction of both. A fresh `pnpm shots` run on this base produced
identical files, so no image changes. The 28 old root-level images are
deleted; nothing in this repository, the website or the organization
profile links to them (the latter two keep their own copies).

Build from source now fetches twcore first: Tauri checks declared
resources at compile time, so `pnpm tauri dev` fails in a fresh
checkout without it, while CONTRIBUTING said it needed nothing. Also
spell "Apple silicon", and give package.json and Cargo.toml a
description that names the platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: name the platforms before the gateway in the English opening

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: say how a new version is announced, and give the mismatch command

The Updates section said a small window appears when there is a new
version. The automatic check sends a system notification instead
(updater.rs: update_loop -> notify_update), and only when notices are
set to system notifications. The update window opens from that
notification, from the Install Version item that replaces Check for
Updates in the menu bar or tray menu, and from Settings > About. The
notifications paragraph now mentions the new-version notification too.

For a Homebrew installation the check reads the tap's cask, so the
sentence that said when the window appears now says when a new version
is reported.

Connecting to a remote core: when the server's core version differs,
the app gives `sudo twcore upgrade --version <version> --restart`, which
installs the expected version whether it is newer or older than the
installed one (#204). Both languages say the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot the screenshots on core v0.48.0

`pnpm shots` on dev 2fa65fd changes five scenes, because #202 and #203
changed what they show:

- remote-add: the connection test reports core 0.48.0, the version the
  app now pins (a 0.47.0 server would be a version mismatch). The alt
  text in both READMEs says 0.48.0.
- traffic: the request in progress shows its status code and token
  count, replayed from /in-flight.
- routing and dry-run: the map marks the upstream with a request in
  flight.
- security: the header counts the entries by outcome.

The other alt texts still describe their images. The website copies in
docs/screenshots/web/ are regenerated with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: re-shoot five scenes after the overview, routing and traffic changes; fetch-core.sh says dev builds need it too

Overview, routing, dry-run, remote-switcher and traffic changed on dev
(#206, #207, #208). The comment at the top of fetch-core.sh still said a
dev build needs neither the network nor resources/twcore; the Tauri build
checks the resource at compile time, so a fresh checkout runs the script
once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant