3 Commits
Author SHA1 Message Date
yetone 22272f1be8 tabbit 0.1.5: a 403 that is an HTML error page is not a lapsed sign-in (#1199)
yukinomon measured it (#1199): Tabbit's international site answered the
daily check-in with a 403 whose body was a "Service Unavailable" HTML
page, with no server or cf-ray header (every JSON answer there carries
server: uvicorn). 0.1.4 took every 403 but the 492 paywall as a refused
sign-in, so magpie marked the account for a new sign-in; the same token
answered every route half an hour later.

- refusalOf calls a 403 whose non-empty body isn't JSON a page; call()
  throws it as a plain TabbitError with the page's <title>, with no
  signIn and no "refused the sign-in" text.
- It settles nothing about the token's site: an unsettled token isn't
  sent to the other site for it, and such a page from the other site
  leaves the site unsettled too.
- A 401, and a 403 with Tabbit's own JSON, are refused sign-ins as
  before.

Run (mote, HOME=$(mktemp -d)):
- bun test packages/tabbit: 91 pass, 0 fail.
- bun scripts/check.mjs tabbit: ok.

Broken by hand: origin/main's api.mjs with the new tests: 2 fail (the
chat path and the check-in path).

Not tried: a real Tabbit account behind such a page; the page's bytes
are the reporter's.
2026-11-16 12:10:02 +08:00
yetone af7b4cc765 tabbit 0.1.4: a turn's prompt stays under Tabbit's character limit, so long transcripts stop coming back as 492 (#833)
Tabbit refuses a turn whose content is 20,500 characters or more. The answer is code 492 inside the SSE stream, after about 40s. The reporter measured it on 0.1.3: 20,490 characters pass and 20,500 fail. The limit counts characters, not bytes: 61 KB of Chinese at 20,410 characters passed. Concurrency of 2 and 4 didn't reproduce it. An OpenCode agent's system prompt plus the flattened history reaches that size quickly.

flatten now keeps a new room's prompt within 18,000 characters. It keeps, in order, the final user message (at most two thirds), the system prompt (up to 60% of what is left when there are earlier turns), and the earlier turns newest first. A turn that doesn't fit is clipped to its head and tail, or left out with an "[earlier conversation omitted]" note. A continued room's single message is clipped to the same limit.

Run: on a separate test Mac, `npm test` in packages/tabbit passed 88 of 88, and `bun scripts/check.mjs tabbit` was ok.

Broken by hand: with 0.1.3's index.mjs, the 4 new limit tests fail. A property test over system, turn-count and length sizes first caught two budget slips (18,029 and 18,016 characters), both fixed.

Not tried: a real Tabbit turn. I have no Tabbit account. The reporter offered to run their OpenCode case again.

Reported-by: Beyfish <Beyfish@users.noreply.github.com>
2026-11-13 00:26:53 +08:00
hclhcl 7ea611975a tabbit: Tabbit (web.tabbit.com) as a provider, with live catalog, check-in and cycle usage (#673)
Adds @magpie-community/opencode-tabbit-auth 0.1.0 (packages/tabbit) and its
registry.json entry. Tabbit (web.tabbit.com) becomes a provider:
- A live model catalog.
- Turns run as room -> run -> SSE join. Each turn has its own stream
  timeout (TABBIT_STREAM_TIMEOUT_MS, default 300 s), and the 30 s request
  timeout no longer covers join.
- A run is stopped through /proxy/v0/chat/stop/ when the client aborts or
  the stream times out.
- A cut turn ends as an error event (streaming) or a 502, never as a
  "stop" finish, and its room is not reused.
- Rooms are keyed by account and session, with a 30 min TTL and a cap of 256.
- 400/401/403/404/429 pass through with retry-after.
- The daily desktop_pet check-in is free.
- Cycle usage.
- macOS desktop sign-in reads the Tabbit Browser cookie store from a temp
  copy that is removed in a finally. Windows and Linux paste the token.

Run at 5be6e90 on mote (macOS):
- bun test: 58 pass. node --test tests/*.test.mjs: 58 pass.
  bun scripts/check.mjs: ok.
- Broken by hand, and each change turned its test red:
  - no rmSync of the cookie copy;
  - 429 not passed through;
  - room keyed by session only;
  - stop sent on an already-aborted signal;
  - no abort listener on the request;
  - streaming truncation ignored;
  - the old truncation rule;
  - totalTimeout back on join;
  - no wake of a quiet reader;
  - onTimeout not called;
  - no room pruning.
- Probes against a local SSE server:
  - A 35 s turn gives 200 under Bun (streaming and non-streaming) and under
    Node.
  - A silent stream with TABBIT_STREAM_TIMEOUT_MS=3000 ends at 3 s under
    Bun and Node (an error event, or a 502 non-streaming), and the server
    sees the stop at 3 s.
- tabbit-* temp dirs in TMPDIR: the same count before and after the bun and
  node runs.

Not tried: a real Tabbit account.
2026-11-03 21:39:56 +08:00