mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-21 20:03:08 +00:00
chore(worktree): preset model do launcher via OPENCODE_WORKTREE_MODEL — fallback comum deepseek-v4-flash (alinhamento infra-solla/iara-pwa)
This commit is contained in:
parent
c69376f3c2
commit
c8a1f53904
2 changed files with 26 additions and 16 deletions
|
|
@ -20,14 +20,17 @@ export const PLAN_BRANCH_PREFIX = 'plans/plan-issue'
|
||||||
export const WORKTREE_TERMINAL_ENV = 'TEQO_WORKTREE_TERMINAL'
|
export const WORKTREE_TERMINAL_ENV = 'TEQO_WORKTREE_TERMINAL'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preset model for the opencode launch — change the preset by editing this
|
* Preset model for the opencode launch — fallback comum aos 3 repos do fluxo
|
||||||
* constant. OPS78: routes through the Vercel AI Gateway (cache/stability/
|
* (infra-solla, teqo, iara-pwa). Override sem editar código: global via
|
||||||
* failover) instead of the direct provider. OPS82: the preset is the cheaper
|
* `export OPENCODE_WORKTREE_MODEL=…`, ou por repo na chave
|
||||||
* `-0731` flavor (input $0.076/M vs $0.13/M); the low/high/max variants are
|
* `OPENCODE_WORKTREE_MODEL` da `.forgejo/worktree.env`. Ex-OPS78/OPS82: o
|
||||||
* exposed by the `provider.vercel` override in the global opencode config
|
* preset era o flavor `-0731` via Vercel AI Gateway; voltou ao provider
|
||||||
* (`~/.config/opencode/opencode.jsonc`, outside the repo — OPS89).
|
* direto porque o gateway está sem créditos (erros "positive credit balance"
|
||||||
|
* em 24/08/2026) e porque unificar o default reduz a sobrescrita confusa de
|
||||||
|
* seleção de modelo do TUI (opencode issues #8349/#13456).
|
||||||
*/
|
*/
|
||||||
export const OPENCODE_PRESET_MODEL = 'vercel/deepseek/deepseek-v4-flash-0731'
|
export const OPENCODE_PRESET_MODEL =
|
||||||
|
process.env.OPENCODE_WORKTREE_MODEL || 'deepseek/deepseek-v4-flash'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skill command sent as the launch's initial message per purpose. `next`
|
* Skill command sent as the launch's initial message per purpose. `next`
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,13 @@ type TestIssue = {
|
||||||
meta?: { id?: string }
|
meta?: { id?: string }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valor esperado do preset no ambiente corrente: o fallback comum quando
|
||||||
|
* OPENCODE_WORKTREE_MODEL não está exportado (CI), ou o valor exportado
|
||||||
|
* (shell local) — o lib resolve exatamente nessa precedência.
|
||||||
|
*/
|
||||||
|
const presetInEffect = () => process.env.OPENCODE_WORKTREE_MODEL || 'deepseek/deepseek-v4-flash'
|
||||||
|
|
||||||
const issue = (over: Partial<TestIssue> = {}): TestIssue => ({
|
const issue = (over: Partial<TestIssue> = {}): TestIssue => ({
|
||||||
number: 1,
|
number: 1,
|
||||||
title: 'C15 — FullCalendar em /campanha/agenda',
|
title: 'C15 — FullCalendar em /campanha/agenda',
|
||||||
|
|
@ -148,7 +155,7 @@ describe('opencodeLaunchDirective (terminal-only opencode launch, OPS26 + OPS33)
|
||||||
|
|
||||||
it('next launches with the preset model, --auto and the /work-issue command sent (value always quoted)', () => {
|
it('next launches with the preset model, --auto and the /work-issue command sent (value always quoted)', () => {
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'next', terminal: true })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'next', terminal: true })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto --prompt "/work-issue"`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto --prompt "/work-issue"`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
@ -156,33 +163,33 @@ describe('opencodeLaunchDirective (terminal-only opencode launch, OPS26 + OPS33)
|
||||||
expect(
|
expect(
|
||||||
opencodeLaunchDirective({ dir, purpose: 'next', terminal: true, issueNumber: 595 }),
|
opencodeLaunchDirective({ dir, purpose: 'next', terminal: true, issueNumber: 595 }),
|
||||||
).toBe(
|
).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto --prompt "/work-issue --issue 595"`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto --prompt "/work-issue --issue 595"`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('plan launches with the same presets and /plan-issue sent (OPS31, value quoted)', () => {
|
it('plan launches with the same presets and /plan-issue sent (OPS31, value quoted)', () => {
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'plan', terminal: true })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'plan', terminal: true })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto --prompt "/plan-issue"`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto --prompt "/plan-issue"`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('new launches prompt-less too — "apenas conversar", no skill sent', () => {
|
it('new launches prompt-less too — "apenas conversar", no skill sent', () => {
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'new', terminal: true })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'new', terminal: true })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('plan/new ignore the issueNumber — only next carries the claimed issue', () => {
|
it('plan/new ignore the issueNumber — only next carries the claimed issue', () => {
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'plan', terminal: true, issueNumber: 7 })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'plan', terminal: true, issueNumber: 7 })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto --prompt "/plan-issue"`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto --prompt "/plan-issue"`,
|
||||||
)
|
)
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'new', terminal: true, issueNumber: 7 })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'new', terminal: true, issueNumber: 7 })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('pins the preset constants — changing the model is editing a constant', () => {
|
it('pins the preset constants — fallback comum deepseek-v4-flash, override via OPENCODE_WORKTREE_MODEL', () => {
|
||||||
expect(OPENCODE_PRESET_MODEL).toBe('vercel/deepseek/deepseek-v4-flash-0731')
|
expect(OPENCODE_PRESET_MODEL).toBe(presetInEffect())
|
||||||
expect(WORKTREE_TERMINAL_ENV).toBe('TEQO_WORKTREE_TERMINAL')
|
expect(WORKTREE_TERMINAL_ENV).toBe('TEQO_WORKTREE_TERMINAL')
|
||||||
expect(OPENCODE_SKILL_COMMAND_BY_PURPOSE).toEqual({
|
expect(OPENCODE_SKILL_COMMAND_BY_PURPOSE).toEqual({
|
||||||
next: '/work-issue',
|
next: '/work-issue',
|
||||||
|
|
@ -193,7 +200,7 @@ describe('opencodeLaunchDirective (terminal-only opencode launch, OPS26 + OPS33)
|
||||||
|
|
||||||
it('an unknown purpose degrades to a prompt-less launch (fail-safe direction)', () => {
|
it('an unknown purpose degrades to a prompt-less launch (fail-safe direction)', () => {
|
||||||
expect(opencodeLaunchDirective({ dir, purpose: 'bogus', terminal: true })).toBe(
|
expect(opencodeLaunchDirective({ dir, purpose: 'bogus', terminal: true })).toBe(
|
||||||
`launch opencode ${dir} --model vercel/deepseek/deepseek-v4-flash-0731 --auto`,
|
`launch opencode ${dir} --model ${presetInEffect()} --auto`,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue