web.tabbit.ai answers a chat turn's runs call with 429, code 492 ("Welcome
to Tabbit Browser...") unless the request carries a unique-uuid header.
Tabbit Browser sends a fresh uuid on every API call (a net-export capture
showed four different values across runs, two joins and usage), and the
gate accepts any well-formed one. headersFor now adds
crypto.randomUUID() as unique-uuid to every request, on both sites.
Version 0.1.2; the README's international-site note describes the gate
instead of saying turns are refused (#834).
Test: tests/unique-uuid.test.mjs posts two runs on each site through a
mocked fetch and asserts a v4 uuid that differs per call. No network.
Run at 1bffccd6 merged onto main d34785ae (mote, Bun 1.4.2 / Node 22,
temp HOME): packages/tabbit node --test 72 pass / 0 fail, bun test 72 / 0;
bun scripts/check.mjs tabbit and whole repo ok; repo-root bun test 6827 pass / 0 fail (6847 run, 314s).
Broken by hand: main's api.mjs under the head's tests turns both new tests
red (0 pass / 2 fail). CI run 42380909152 green.
0.1.2 is not on dist (0.1.0, 0.1.1) or npm.
Not tried: any real call to web.tabbit.ai or web.tabbit.com.
20 lines
1000 B
JavaScript
20 lines
1000 B
JavaScript
import test from "node:test"
|
|
import assert from "node:assert/strict"
|
|
import { runTurn } from "../src/api.mjs"
|
|
|
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/
|
|
|
|
for (const site of ["https://web.tabbit.ai", "https://web.tabbit.com"]) {
|
|
test(`runs on ${site} carries unique-uuid`, async () => {
|
|
const seen = [], original = globalThis.fetch
|
|
globalThis.fetch = async (input, init = {}) => { seen.push(new Headers(init.headers ?? {})); return Response.json({ run_id: "r", status: "QUEUED" }) }
|
|
try {
|
|
const creds = { token: "eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1LTEifQ.sig", header: "token=[REDACTED_VALUE]", site }
|
|
await runTurn(creds, "room-1", { content: "hi", model: "Default" })
|
|
await runTurn(creds, "room-1", { content: "hi", model: "Default" })
|
|
assert.match(seen[0].get("unique-uuid") ?? "", UUID)
|
|
assert.notEqual(seen[0].get("unique-uuid"), seen[1].get("unique-uuid"))
|
|
} finally { globalThis.fetch = original }
|
|
})
|
|
}
|