workbuddy 0.1.40: chats carry the current desktop client's headers

WorkBuddy accounts are being restricted, and a report says WorkBuddy now
checks request-header fingerprints. Diffed the plugin's chat request
against each build's current desktop app, read (never run) from the
update feeds on 2026-10-28:
- China: WorkBuddy 5.9.3.42398134 (copilot.tencent.com/v2/update),
  bundled @genie/agent-cli 2.165.0.
- WorkBuddy AI: 5.8.4.41366630 (www.workbuddy.ai/v2/update), CLI 2.161.0.
The chat is the CLI's OpenAI client (openai 6.25.0) through
axiosToFetchAdapter, with UserAgentHttpInterceptor and the desktop's
CLIENT_INFO_* env (sidecar-manager getCachedBaseEnv).

What differed, and now matches:
- User-Agent: was WorkBuddy/5.5.6; the client sends
  "WorkBuddy/<app> <applicationName>/<app> CLI/<cli>":
  WorkBuddy/5.9.3 WorkBuddy/5.9.3 CLI/2.165.0 (China),
  WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0 (AI). The /v3/config
  models call (was CLI/2.0.0 WorkBuddy/5.5.6) takes the same one, as the
  CLI's CloudProductProvider sends it through the same interceptor.
- X-IDE-Version: was 5.5.6; now the app's version.
- X-Agent-Type: main was sent on WorkBuddy AI only; the adapter sets it on
  every model call on both builds.
- X-Agent-Runtime: local-agent, new in 5.9 (the desktop's local transport
  puts agentRuntime local-agent in the prompt meta); China build only,
  5.8.4 has no such header.
- Accept: application/json and the OpenAI SDK's X-Stainless-* (Lang js,
  Package-Version 6.25.0, OS/Arch of this machine, Runtime node,
  Runtime-Version v22.21.1 = Electron 37.10.3's Node, Retry-Count 0,
  Timeout 1200); the adapter strips them only in its skip-auth mode.
- The desktop's own calls (billing, plugin API) send WorkBuddy/<app>;
  they now send the current app version instead of 5.5.6.

Not matched: X-Device-Token (TuringShield native SDK, sent since at
least 5.6.2), traceparent (only while server-side tracing is enabled),
and transport-level differences (Bun's fetch vs axios on Node: header
order, Accept-Encoding).

Run: HOME=$(mktemp -d) bun test packages/workbuddy: 184 pass, 0 fail.
With the old index.mjs the 4 changed tests fail (UA, IDE version,
config UA, the new per-build header test).
Not tried: a real account's chat or /v3/config with the new
User-Agent (unauthenticated /v3/config answers the same for old and new).
No text added names magpie or WorkBuddy's limits.
This commit is contained in:
yetone
2026-10-28 03:20:46 +08:00
parent 47cda88fbe
commit b2fe48ea2e
6 changed files with 109 additions and 14 deletions
+14 -2
View File
@@ -124,7 +124,11 @@ estimate.
Each chat carries WorkBuddy's headers:
- `Authorization`, `X-User-Id`, `X-Domain`, `X-Product: SaaS`, `X-IDE-Type: WorkBuddy`;
- `User-Agent: WorkBuddy/5.5.6`. Without it, WorkBuddy answers error 10085;
- the desktop CLI's `User-Agent`, `WorkBuddy/<app> <appName>/<app> CLI/<cli>`:
`WorkBuddy/5.9.3 WorkBuddy/5.9.3 CLI/2.165.0` on the China build and
`WorkBuddy/5.8.4 workbuddy-ai/5.8.4 CLI/2.161.0` on WorkBuddy AI, each
build's current app on 2026-10-28; `X-IDE-Version` is the app's version.
A User-Agent not starting `WorkBuddy/<version>` is answered error 10085;
- the client's, which WorkBuddy's usage list shows as the client that asked
(使用端): `X-Agent-Purpose: conversation`, `X-IDE-Name: WorkBuddy`,
`X-IDE-Version`, `X-Agent-Intent: craft`, `X-Requested-With`. Both builds
@@ -139,7 +143,15 @@ Each chat carries WorkBuddy's headers:
else the chat's first user message; nothing is made up when neither names
one, a made-up conversation of the request's own being what splits one
conversation into many in the usage detail;
- WorkBuddy AI also takes `X-Agent-Type: main`.
- what the CLI adds to a model request alone: `X-Agent-Type: main` on both
builds, `X-Agent-Runtime: local-agent` on the China build (new in 5.9),
`Accept: application/json`, and the `X-Stainless-*` headers of the OpenAI
SDK it sends through (openai 6.25.0 on Electron 37's Node v22.21.1, a
1200s timeout, no retries).
Not sent: `X-Device-Token`, which the desktop app gets from Tencent's
native device SDK before each prompt, and a `traceparent`, which the CLI
adds only while its server-side tracing is on.
A chat that doesn't open with a system message is given WorkBuddy's
default one, as the app does.