joycode 0.2.5: verified Astra and DeepSeek context windows from the account catalogue (#707)
GPT-6 Astra and DeepSeek-V4.1-Flash take a larger limit.context when the account's own catalogue offers one in extJson.contextWindowByPlatform["JoyCode Desktop"]: the smaller of that and a measured cap (900,000 / 1,000,000), floored to 100k, never below the catalogue's maxTotalTokens. Output limits, other models, malformed or missing metadata and the static fallback are unchanged. The caps come from the author's real probes (Astra ok at 921,497 input, context_length_exceeded near 922k; DeepSeek ok at 1,000,073, its error names 1,048,576). Claude-Opus-5-hq stays at 200k (its 900k probe was refused). Review: no new host, credential, dependency or workflow change; version 0.2.5 is free (main 0.2.4, dist has up to 0.2.4). Run at bdfb41d8 on mote: packages/joycode bun test 76 pass 0 fail; bun scripts/check.mjs ok. Broken by hand: context back to the catalogue's maxTotalTokens turns the two new context tests red (2 fail). Not tried: no JoyCode account here, so the catalogue's contextWindowByPlatform field and the probes were not re-run by the reviewer.
This commit is contained in:
@@ -50,6 +50,70 @@ test('model adapter chooses the SDK that speaks its upstream protocol', async t
|
||||
assert.equal(models['Claude-Opus-5-hq'].api.npm, '@ai-sdk/anthropic')
|
||||
for (const model of Object.values(models)) assert.equal(model.api.url, 'https://api-ai.jd.com/v1')
|
||||
})
|
||||
test('raises context only for exact input-verified models and preserves output limits', async t => {
|
||||
const { models } = await load(t, { list: [
|
||||
{
|
||||
chatApiModel: 'GPT-6 Astra', maxTotalTokens: 200000, respMaxTokens: 17000,
|
||||
extJson: { contextWindowByPlatform: { 'JoyCode Desktop': 1500000 } },
|
||||
},
|
||||
{
|
||||
chatApiModel: 'DeepSeek-V4.1-Flash', maxTotalTokens: 200000, respMaxTokens: 18000,
|
||||
extJson: JSON.stringify({
|
||||
adapterType: 'openai-response',
|
||||
contextWindowByPlatform: { 'JoyCode Desktop': 1500000 },
|
||||
}),
|
||||
},
|
||||
{
|
||||
chatApiModel: 'GPT-6 Astra-preview', maxTotalTokens: 200000, respMaxTokens: 19000,
|
||||
extJson: { contextWindowByPlatform: { 'JoyCode Desktop': 2000000 } },
|
||||
},
|
||||
{
|
||||
chatApiModel: 'Claude-Opus-5-hq', maxTotalTokens: 200000, respMaxTokens: 20000,
|
||||
extJson: { adapterType: 'anthropic', contextWindowByPlatform: { 'JoyCode Desktop': 2000000 } },
|
||||
},
|
||||
] })
|
||||
assert.equal(models['GPT-6 Astra'].limit.context, 900000)
|
||||
assert.equal(models['DeepSeek-V4.1-Flash'].limit.context, 1000000)
|
||||
assert.equal(models['GPT-6 Astra-preview'].limit.context, 200000)
|
||||
assert.equal(models['Claude-Opus-5-hq'].limit.context, 200000)
|
||||
assert.equal(models['GPT-6 Astra'].limit.output, 17000)
|
||||
assert.equal(models['DeepSeek-V4.1-Flash'].limit.output, 18000)
|
||||
assert.equal(models['DeepSeek-V4.1-Flash'].api.npm, '@ai-sdk/openai')
|
||||
})
|
||||
test('floors smaller directory limits and preserves larger base contexts', async t => {
|
||||
const { models } = await load(t, { list: [
|
||||
{
|
||||
chatApiModel: 'GPT-6 Astra', maxTotalTokens: 200000, respMaxTokens: 17000,
|
||||
extJson: { contextWindowByPlatform: { 'JoyCode Desktop': 850000 } },
|
||||
},
|
||||
{
|
||||
chatApiModel: 'DeepSeek-V4.1-Flash', maxTotalTokens: 1200000, respMaxTokens: 18000,
|
||||
extJson: { contextWindowByPlatform: { 'JoyCode Desktop': 1300000 } },
|
||||
},
|
||||
] })
|
||||
assert.equal(models['GPT-6 Astra'].limit.context, 800000)
|
||||
assert.equal(models['DeepSeek-V4.1-Flash'].limit.context, 1200000)
|
||||
assert.equal(models['GPT-6 Astra'].limit.output, 17000)
|
||||
assert.equal(models['DeepSeek-V4.1-Flash'].limit.output, 18000)
|
||||
})
|
||||
test('requires a valid numeric JoyCode Desktop directory context', async t => {
|
||||
const cases = [
|
||||
{ name: 'missing extJson', id: 'GPT-6 Astra' },
|
||||
{ name: 'malformed extJson JSON', id: 'DeepSeek-V4.1-Flash', extJson: '{' },
|
||||
{ name: 'missing platform entry', id: 'GPT-6 Astra', extJson: {} },
|
||||
{ name: 'numeric string', id: 'DeepSeek-V4.1-Flash', extJson: { contextWindowByPlatform: { 'JoyCode Desktop': '1000000' } } },
|
||||
{ name: 'nonpositive context', id: 'GPT-6 Astra', extJson: { contextWindowByPlatform: { 'JoyCode Desktop': 0 } } },
|
||||
]
|
||||
for (const scenario of cases) {
|
||||
await t.test(scenario.name, async t => {
|
||||
const model = { chatApiModel: scenario.id, maxTotalTokens: 200000, respMaxTokens: 12000 }
|
||||
if (Object.hasOwn(scenario, 'extJson')) model.extJson = scenario.extJson
|
||||
const { models } = await load(t, { list: [model] })
|
||||
assert.equal(models[scenario.id].limit.context, 200000)
|
||||
assert.equal(models[scenario.id].limit.output, 12000)
|
||||
})
|
||||
}
|
||||
})
|
||||
test('excluded tenants do not inherit public pricing', async t => {
|
||||
const { models } = await load(t, { tenant: 'JD' })
|
||||
assert.equal(models['GLM-5.3-agent'].rate, undefined)
|
||||
|
||||
Reference in New Issue
Block a user