Skip to content

Commit a0adc41

Browse files
committed
fix(ci): restore catalog tests and audit
1 parent 0d3fe8a commit a0adc41

4 files changed

Lines changed: 39 additions & 9 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@
431431
"qs": "6.15.2",
432432
"rollup": "4.59.0",
433433
"serialize-javascript": "7.0.5",
434+
"shell-quote": "1.8.4",
434435
"simple-git": "3.36.0",
435436
"smol-toml": "1.6.1",
436437
"srvx": "0.11.13",

pnpm-lock.yaml

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/utils/teamModelCatalog.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,32 @@ function getRuntimeCatalogLaunchModels(
644644
return models.length > 0 ? models : null;
645645
}
646646

647+
function isOpenCodeSummaryOnlyModelList(
648+
models: readonly string[],
649+
providerStatus?: RuntimeAwareProviderStatus | null
650+
): boolean {
651+
if (providerStatus?.modelCatalog?.providerId !== 'opencode') {
652+
return false;
653+
}
654+
655+
const trimmedModels = models.map((model) => model.trim()).filter(Boolean);
656+
if (trimmedModels.length !== 1) {
657+
return false;
658+
}
659+
660+
const summaryModel = trimmedModels[0].toLowerCase();
661+
const catalogDefaultIds = [
662+
providerStatus.modelCatalog.defaultLaunchModel,
663+
providerStatus.modelCatalog.defaultModelId,
664+
providerStatus.modelCatalog.models.find((model) => model.isDefault)?.launchModel,
665+
providerStatus.modelCatalog.models.find((model) => model.isDefault)?.id,
666+
]
667+
.map((model) => model?.trim().toLowerCase())
668+
.filter((model): model is string => Boolean(model));
669+
670+
return summaryModel === 'opencode/big-pickle' || catalogDefaultIds.includes(summaryModel);
671+
}
672+
647673
function mergeModelLists(primary: readonly string[], supplemental: readonly string[]): string[] {
648674
const merged = new Map<string, string>();
649675
for (const model of [...primary, ...supplemental]) {
@@ -689,7 +715,9 @@ export function getVisibleTeamProviderModels(
689715
const catalogModels =
690716
providerId === 'opencode' ? getRuntimeCatalogLaunchModels(providerId, providerStatus) : null;
691717
const sourceModels =
692-
providerId === 'opencode' && catalogModels && !hasExplicitModels
718+
providerId === 'opencode' &&
719+
catalogModels &&
720+
(!hasExplicitModels || isOpenCodeSummaryOnlyModelList(models, providerStatus))
693721
? mergeModelLists(catalogModels, models)
694722
: models;
695723

test/renderer/components/cli/CliStatusVisibility.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,8 +1995,8 @@ describe('CLI status visibility during completed install state', () => {
19951995

19961996
expect(host.textContent).not.toContain('Authenticated');
19971997
expect(host.textContent).not.toContain('Providers:');
1998-
expect((host.firstElementChild as HTMLElement | null)?.getAttribute('style')).toContain(
1999-
'245, 158, 11'
1998+
expect((host.firstElementChild as HTMLElement | null)?.getAttribute('style')).toMatch(
1999+
/(?:245,\s*158,\s*11|#f59e0b)/i
20002000
);
20012001

20022002
await act(async () => {
@@ -2073,8 +2073,8 @@ describe('CLI status visibility during completed install state', () => {
20732073
});
20742074

20752075
expect(host.textContent).toContain('Providers: 0/2 connected');
2076-
expect((host.firstElementChild as HTMLElement | null)?.getAttribute('style')).toContain(
2077-
'245, 158, 11'
2076+
expect((host.firstElementChild as HTMLElement | null)?.getAttribute('style')).toMatch(
2077+
/(?:245,\s*158,\s*11|#f59e0b)/i
20782078
);
20792079

20802080
await act(async () => {

0 commit comments

Comments
 (0)