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.
65 lines
2.8 KiB
JavaScript
65 lines
2.8 KiB
JavaScript
// The catalog → magpie model rows.
|
|
|
|
import test from "node:test"
|
|
import assert from "node:assert/strict"
|
|
import { BOOTSTRAP, rowsOf, rowOf, modelIdOf, isFree, isPremium, namesOf } from "../src/models.mjs"
|
|
|
|
const catalog = [
|
|
{ display_name: "Default", supports_tools: true, support_thinking: true, model_access_type: "free_unlimited", display_multiplier: 0 },
|
|
{ display_name: "DeepSeek-V4.1-Flash", supports_images: true, supports_tools: true, support_thinking: true, model_access_type: "free_metered", display_multiplier: 0.2 },
|
|
{ display_name: "Kimi-K3.1-Pro", supports_images: true, supports_tools: true, support_thinking: true, model_access_type: "premium_only", display_multiplier: 1 },
|
|
{ display_name: "Hidden-Thing", hidden: true, model_access_type: "free_metered" },
|
|
]
|
|
|
|
test("the model id is the catalog's display name, verbatim", () => {
|
|
assert.equal(modelIdOf(catalog[1]), "DeepSeek-V4.1-Flash")
|
|
assert.deepEqual(namesOf(catalog), ["Default", "DeepSeek-V4.1-Flash", "Kimi-K3.1-Pro", "Hidden-Thing"])
|
|
})
|
|
|
|
test("free / premium come from model_access_type", () => {
|
|
assert.equal(isFree(catalog[0]), true)
|
|
assert.equal(isFree(catalog[1]), true)
|
|
assert.equal(isFree(catalog[2]), false)
|
|
assert.equal(isPremium(catalog[2]), true)
|
|
})
|
|
|
|
test("rowsOf drops hidden models, and premium ones when asked", () => {
|
|
assert.deepEqual(Object.keys(rowsOf(catalog)), ["Default", "DeepSeek-V4.1-Flash", "Kimi-K3.1-Pro"])
|
|
assert.deepEqual(Object.keys(rowsOf(catalog, { freeOnly: true })), ["Default", "DeepSeek-V4.1-Flash"])
|
|
})
|
|
|
|
test("a row says what an agent may do: reason yes, client tools no", () => {
|
|
const row = rowOf(catalog[1])
|
|
assert.equal(row.id, "DeepSeek-V4.1-Flash")
|
|
assert.equal(row.providerID, "tabbit")
|
|
assert.equal(row.api.npm, "@ai-sdk/openai-compatible")
|
|
assert.equal(row.capabilities.reasoning, true)
|
|
// Tabbit's tools are server-side; a client-declared tool cannot be honoured.
|
|
assert.equal(row.capabilities.toolcall, false)
|
|
assert.equal(row.capabilities.input.image, true)
|
|
assert.equal(catalog[2].supports_images, true)
|
|
})
|
|
|
|
test("a text-only model does not claim image input", () => {
|
|
const row = rowOf(catalog[0])
|
|
assert.equal(row.capabilities.input.image, false)
|
|
})
|
|
|
|
test("known limits win over the default, and the default is used otherwise", () => {
|
|
const deep = rowOf(catalog[1])
|
|
assert.equal(deep.limit.context, 1048576)
|
|
const other = rowOf({ display_name: "Whatever" }, { context: 12345, output: 678 })
|
|
assert.deepEqual(other.limit, { context: 12345, output: 678 })
|
|
})
|
|
|
|
test("the bootstrap catalog is non-empty and every row is well formed", () => {
|
|
assert.ok(BOOTSTRAP.length >= 3)
|
|
const rows = rowsOf(BOOTSTRAP)
|
|
assert.ok(Object.keys(rows).length >= 3)
|
|
for (const row of Object.values(rows)) {
|
|
assert.equal(row.providerID, "tabbit")
|
|
assert.ok(row.id && row.name)
|
|
assert.ok(row.limit.context > 0)
|
|
}
|
|
})
|