@cat-factory/app 0.268.1 → 0.269.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import type { ModelPreset } from '~/types/model-presets'
|
|
3
|
+
import { useModelPresetsStore } from '~/stores/modelPresets'
|
|
4
|
+
import { useModelPresetHealth } from '~/composables/useModelPresetHealth'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The startup model-preset advisory. Its sibling `usePipelineHealth` has had a spec since the
|
|
8
|
+
* catalog-drift bug; this one had none until `mdp_chatgpt` shipped and made the gap visible: the
|
|
9
|
+
* advisory NAMES a built-in the board holds no row for, and a name is the only thing in that modal
|
|
10
|
+
* a user can act on.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
let nextId = 0
|
|
14
|
+
function stored(over: Partial<ModelPreset> = {}): ModelPreset {
|
|
15
|
+
return {
|
|
16
|
+
id: `mdp_stored_${nextId++}`,
|
|
17
|
+
name: 'Stored',
|
|
18
|
+
baseModelId: 'kimi-k2.7',
|
|
19
|
+
overrides: {},
|
|
20
|
+
isDefault: false,
|
|
21
|
+
version: 1,
|
|
22
|
+
createdAt: nextId,
|
|
23
|
+
...over,
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Seed the store the way a snapshot hydrate does (rows + the catalog version/name pair), then scan. */
|
|
28
|
+
function scan(
|
|
29
|
+
presets: ModelPreset[],
|
|
30
|
+
versions: Record<string, number>,
|
|
31
|
+
names: Record<string, string> = {},
|
|
32
|
+
) {
|
|
33
|
+
useModelPresetsStore().hydrate(presets, versions, names)
|
|
34
|
+
return useModelPresetHealth()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
describe('useModelPresetHealth', () => {
|
|
38
|
+
it('names a new built-in from the catalog map, not from its humanised id', () => {
|
|
39
|
+
// The regression this file exists for. Every board created before the preset shipped hits this
|
|
40
|
+
// branch on its next load, and the humanised id reads "chatgpt" (rendered "Chatgpt" by the
|
|
41
|
+
// modal's `capitalize`) for a preset the rest of the product calls GPT-5.6 Sol.
|
|
42
|
+
const { newPresets } = scan([], { mdp_chatgpt: 1 }, { mdp_chatgpt: 'GPT-5.6 Sol' })
|
|
43
|
+
expect(newPresets.value).toEqual([{ type: 'new', id: 'mdp_chatgpt', name: 'GPT-5.6 Sol' }])
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('falls back to the humanised id when the facade ships no name map', () => {
|
|
47
|
+
// Forward-compatibility only: the field is optional on the wire, so an older facade's snapshot
|
|
48
|
+
// must still produce an offer rather than a blank row.
|
|
49
|
+
const { newPresets } = scan([], { mdp_chatgpt: 1 })
|
|
50
|
+
expect(newPresets.value).toEqual([{ type: 'new', id: 'mdp_chatgpt', name: 'chatgpt' }])
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('prefers the STORED row name over the catalog one for an outdated built-in', () => {
|
|
54
|
+
// A stored built-in is what the user sees in their library, and its name is what they renamed
|
|
55
|
+
// it to (or the older catalog name a reseed is about to replace). Reporting the catalog's newer
|
|
56
|
+
// name here would describe the row by the value the fix installs, not the one on screen.
|
|
57
|
+
const { outdated, newPresets } = scan(
|
|
58
|
+
[stored({ id: 'mdp_claude', name: 'Claude Opus 4.8', version: 1 })],
|
|
59
|
+
{ mdp_claude: 2 },
|
|
60
|
+
{ mdp_claude: 'Claude Opus 5' },
|
|
61
|
+
)
|
|
62
|
+
expect(newPresets.value).toEqual([])
|
|
63
|
+
expect(outdated.value).toEqual([
|
|
64
|
+
{ type: 'outdated', id: 'mdp_claude', name: 'Claude Opus 4.8', fromVersion: 1, toVersion: 2 },
|
|
65
|
+
])
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
it('reports nothing when every built-in is stored at its catalog version', () => {
|
|
69
|
+
const { issues, hasIssues } = scan(
|
|
70
|
+
[stored({ id: 'mdp_kimi', name: 'Kimi K2.7', version: 1 })],
|
|
71
|
+
{ mdp_kimi: 1 },
|
|
72
|
+
{ mdp_kimi: 'Kimi K2.7' },
|
|
73
|
+
)
|
|
74
|
+
expect(issues.value).toEqual([])
|
|
75
|
+
expect(hasIssues.value).toBe(false)
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('ignores a user-created preset, which no catalog version covers', () => {
|
|
79
|
+
const { issues } = scan([stored({ id: 'mdp_mine', version: 99 })], { mdp_kimi: 1 })
|
|
80
|
+
expect(issues.value.map((i) => i.id)).toEqual(['mdp_kimi'])
|
|
81
|
+
})
|
|
82
|
+
})
|
|
@@ -17,11 +17,23 @@ export interface ModelPresetIssue {
|
|
|
17
17
|
toVersion?: number
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* A built-in's display name for an issue message: the stored row's when there is one, else the
|
|
22
|
+
* catalog's own name from the snapshot's companion map.
|
|
23
|
+
*
|
|
24
|
+
* The humanised id (`mdp_kimi` to "kimi", rendered capitalised) is the FALLBACK for a facade that
|
|
25
|
+
* ships no name map, not the primary answer. It reads acceptably for the built-ins whose ids ARE
|
|
26
|
+
* their names and wrongly for the first one where it is not: `mdp_chatgpt` came out as "Chatgpt" in
|
|
27
|
+
* the modal offering to add it, a name for GPT-5.6 Sol that appears nowhere else in the product,
|
|
28
|
+
* on exactly the boards that predate the preset and therefore see this advisory.
|
|
29
|
+
*/
|
|
30
|
+
function builtinName(
|
|
31
|
+
id: string,
|
|
32
|
+
stored: ModelPreset | undefined,
|
|
33
|
+
names: Record<string, string>,
|
|
34
|
+
): string {
|
|
22
35
|
if (stored) return stored.name
|
|
23
|
-
|
|
24
|
-
return id.replace(/^mdp_/, '').replace(/_/g, ' ')
|
|
36
|
+
return names[id] ?? id.replace(/^mdp_/, '').replace(/_/g, ' ')
|
|
25
37
|
}
|
|
26
38
|
|
|
27
39
|
/**
|
|
@@ -41,7 +53,7 @@ export function useModelPresetHealth() {
|
|
|
41
53
|
for (const [id, catalogVersion] of Object.entries(store.catalogVersions)) {
|
|
42
54
|
const stored = byId.get(id)
|
|
43
55
|
if (!stored) {
|
|
44
|
-
out.push({ type: 'new', id, name: builtinName(id, undefined) })
|
|
56
|
+
out.push({ type: 'new', id, name: builtinName(id, undefined, store.catalogNames) })
|
|
45
57
|
continue
|
|
46
58
|
}
|
|
47
59
|
if (catalogVersion > (stored.version ?? 0)) {
|
|
@@ -26,10 +26,27 @@ export const useModelPresetsStore = defineStore('modelPresets', () => {
|
|
|
26
26
|
* `useModelPresetHealth`.
|
|
27
27
|
*/
|
|
28
28
|
const catalogVersions = ref<Record<string, number>>({})
|
|
29
|
+
/**
|
|
30
|
+
* The catalog's own NAME per id in {@link catalogVersions}, from the same snapshot field pair.
|
|
31
|
+
* Read only where a built-in has no stored row to take a name off, which is the "new built-in"
|
|
32
|
+
* advisory and nothing else. Empty for a facade that ships no name map.
|
|
33
|
+
*/
|
|
34
|
+
const catalogNames = ref<Record<string, string>>({})
|
|
29
35
|
|
|
30
|
-
function hydrate(
|
|
36
|
+
function hydrate(
|
|
37
|
+
list: ModelPreset[],
|
|
38
|
+
versions?: Record<string, number>,
|
|
39
|
+
names?: Record<string, string>,
|
|
40
|
+
) {
|
|
31
41
|
presets.value = [...list].sort((a, b) => a.createdAt - b.createdAt)
|
|
32
|
-
|
|
42
|
+
// The two catalog maps move TOGETHER, being one snapshot read split in two and keyed
|
|
43
|
+
// identically by construction. Assigning names on their own truthiness would let a facade
|
|
44
|
+
// shipping versions and no names leave the previous board's names indexed against this board's
|
|
45
|
+
// ids, which is the one way the pair can disagree (see the pipelines store).
|
|
46
|
+
if (versions) {
|
|
47
|
+
catalogVersions.value = versions
|
|
48
|
+
catalogNames.value = names ?? {}
|
|
49
|
+
}
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
/** The workspace default (fallback for a task that picks none). */
|
|
@@ -99,6 +116,7 @@ export const useModelPresetsStore = defineStore('modelPresets', () => {
|
|
|
99
116
|
return {
|
|
100
117
|
presets,
|
|
101
118
|
catalogVersions,
|
|
119
|
+
catalogNames,
|
|
102
120
|
defaultPreset,
|
|
103
121
|
resolve,
|
|
104
122
|
modelForKind,
|
|
@@ -87,7 +87,11 @@ export function applySnapshotToStores(snapshot: WorkspaceSnapshot, baselines?: L
|
|
|
87
87
|
useSharedStacksStore().hydrate(snapshot.sharedStacks ?? [])
|
|
88
88
|
useWorkspaceSettingsStore().hydrate(snapshot.settings)
|
|
89
89
|
useAgentConfigStore().hydrate(snapshot.agentConfigCatalog ?? [])
|
|
90
|
-
useModelPresetsStore().hydrate(
|
|
90
|
+
useModelPresetsStore().hydrate(
|
|
91
|
+
snapshot.modelPresets ?? [],
|
|
92
|
+
snapshot.modelPresetCatalogVersions,
|
|
93
|
+
snapshot.modelPresetCatalogNames,
|
|
94
|
+
)
|
|
91
95
|
useConsensusGroupsStore().hydrate(snapshot.consensusGroups ?? [])
|
|
92
96
|
useServiceFragmentDefaultsStore().hydrate(snapshot.serviceFragmentDefaults?.fragmentIds)
|
|
93
97
|
useRecurringPipelinesStore().hydrate(snapshot.recurringPipelines ?? [])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cat-factory/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.269.0",
|
|
4
4
|
"description": "Reusable Nuxt layer for the Agent Architecture Board SPA (components, stores, composables, pages). Consume it from a thin deployment app via `extends: ['@cat-factory/app']` and point it at your backend with NUXT_PUBLIC_API_BASE. See deploy/frontend for an example.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"valibot": "^1.4.2",
|
|
41
41
|
"vue": "3.5.41",
|
|
42
42
|
"wretch": "^3.0.9",
|
|
43
|
-
"@cat-factory/contracts": "0.
|
|
43
|
+
"@cat-factory/contracts": "0.305.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@toad-contracts/testing": "0.3.2",
|